Emacs Sawfish mode is a major mode for

  • editing sawfish programs, and
  • interactive evaluation of sawfish code,

written by Dave Pearson.

It's included in Sawfish >=1.7.0.

Evaluation of sawfish code[]

You need a running instance of Sawfish for sawfish code evaluation, since evaluation is done by the Sawfish server, which then communicates with emacs through a socket.

The output evaluation message is sent back to the emacs buffer and displayed in the echo area or in a dedicated *sawfish* buffer.

The interface mimics elisp expressions evaluation. For example to evaluate:

(message "Hello world!")

you simply put the cursor at the end of the form and then type C-x-e (or C-M-x if the cursor is inside the form), then emacs will send the command to the sawfish server which will evaluate it, then will show in the echo area the "Hello world!" string.


sawfish.el is now included in Sawfish.

In order to install the sawfish mode, you need to download the sawfish.el file and place it in the emacs load-path, then to put some lines in your .emacs or init.el emacs configuration file. Follow the example elisp snippet for doing it:

;; sawfish mode settings
;; load the first sawfish.el or sawfish.elc file found in the load-path
(load "sawfish")
;; this tells emacs to automatically activate the sawfish-mode whenever open
;; file with "sawfishrc" or "jl" (John Lisp) suffix
(add-to-list 'auto-mode-alist '(".*sawfishrc\\'" . sawfish-mode ))
(add-to-list 'auto-mode-alist '(".*\\.jl\\'" . sawfish-mode ))
;; if you're using ECB, tells to use the compilation buffer to show long
;; sawfish messages  
(add-to-list 'ecb-compilation-buffer-names '("*sawfish*"))

For other instructions call the describe-mode function in emacs (usually bound to C-h-m) into an emacs buffer after enabling sawfish-mode.

If you want to evaluate some sawfish code upon initialization of emacs sawfish-mode, then do

(add-hook 'sawfish-mode-hook
           (lambda ()
             (sawfish-eval '(require '

But after restart of Sawfish, it's forgotten.


One bug in highlight & syntax parsing is solved by this.

  • Sometimes communication with Sawfish fails if it includes letter '#'.
  • Sometimes the temporary buffer hangs around, and it annoys.


Autoloading functions for sawfish-mode is described in Tips page.

See also[]

  • Emacs is a sawfish side script to commuicate with Emacs.
  • Emacs info search
  • Sawclient has code for emacs to have sawfish help make sure the right buffers are displayed.