Scripts quick access edit this

Synopsis Edit

Utilities for debugging sawfish code.

Description Edit

This includes window-snooper (by Chris Bratusek), as well as a system for displaying debugging messages in a window on the screen.

The warn function will send a message to standard-error, and the display-warning function will display a message on the screen. Both of these functions accept any combination of lisp objects, and give a message with a timestamp and a textual representation of the lisp object. This is useful for examining the contents of variables or checking the result of evaluating lisp forms at run time.

I'm providing this because it's useful to me, not because I think it's the best way to do things. I'm interested in any suggestions or ideas for other things to include, or different ways of doing things.

Installation Edit

To use:

(require 'debug-utils)

If this is for debugging your .sawfishrc it's enough to require it there. But if you are debugging sawfish modules you'll want to temporarily require it in the module you're debugging while you're working on it. That way you can use, e.g., warn and display-warning to tell you what's going on as the module runs.

To use the window snooper you'll need something like this in your .sawfishrc:

(bind-keys global-keymap
           "C-S-s" 'window-snooper)

There's also a window logger which will log the creation and destruction of windows. To use it:

(add-hook 'after-initialization-hook window-logger-init)

Configuration Edit

Debug messages are stored in an internal buffer so that each new message doesn't hide the previous one. When a message is displayed the entire buffer is displayed as well. Use the set-debug-buffer-length to specify how many lines of messages to keep. If it is set too large it will not fit on the screen and you wont be able to see new messages, so be sure to choose a reasonable number.

You can set debug-message-timeout to specify how long debug messages displayed on the screen should remain. Set it to nil to disable the timeout -- then you'll have to click on the debug window to dismiss it.

If debug-clear-buffer-on-timeout is t (the default) the buffer is wiped when the timeout is reached. If you set it to nil old messages are saved, and will be displayed again when any new debug messages are displayed. In that case you'll need to call (clear-debug-display t) if you want to erase the buffer.

See documentation in the script for more details.

See also Edit

  • window-info Another script like window-snooper included in this script.
Community content is available under CC-BY-SA unless otherwise noted.