Re: how to get a structure/module tree?

Christopher Roy Bratusek wrote:

> besides, there's the `xterm' function. so you may also do:
> (define-special-variable xterm-program "xterm")
> ("_xterm" (xterm))

This doesn't work:

  (define-special-variable xterm-program "xterm -lc")
  (define-special-variable user-apps-menu '(
      ; variables xterm and run-shell-command are undefined here!
      ("_xterm" (xterm))

So if using (xterm), some "(require ...)" is missing.

I currently have:

  (defmacro def-svar (name #!rest val-n-doc)
      `(define-special-variable ,name ,@val-n-doc))
  (def-svar xterm-program "xterm -lc")
  (def-svar customize-redirect ">/tmp/sawfish-out.txt 2>&1 </dev/null")
  (def-svar user-apps-menu '(
      ("_xterm" (system "xterm -lc &"))
      ("_urxvt -e bash" (system "urxvt -e bash &"))
      () ; Separation horizontal bar

I was worried about the macro definition "dev-svar", because (I think)
librep macros aren't hygienic (ie. side effect free regarding variable
capture), but it seems to work.

  $ rep
  rep 0.90.5, Copyright (C) 1999-2000 John Harper
  user> (defmacro def-svar (name #!rest val-n-doc)
    `(define-special-variable ,name ,@val-n-doc))
  user> ,expand (def-svar klax 'popl "watn nu?")
  (progn (defvar klax () "watn nu?") (setq klax (quote popl)))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]