11 Mar 2003 lukeg   » (Master)

wainstead: In your Emacs Lisp snippets, you could use let instead of setq to get real local variables. The trouble with setq is that it will set an existing variable to the new value, by searching up the stack to find where the variable exists and defaulting to a global if none is found. So, there's a risk that it will interfere with some other variable. This is riskier than it might seem, since even "top-level" interactive commands could find themselves munging local variables in other functions that are making recursive edits.

For example, you could switch to let like this:

(defun sw-list ()
  (let ((buffer (get-buffer "*Ibuffer*")))
    (if (bufferp buffer)
          (switch-to-buffer buffer)
          (ibuffer-update nil))

More details at http://www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_49.html

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!