[slime-devel] Re: per-slime-dialect slime-connected-hook implementation

Samium Gromoff _deepfire at feelingofgreen.ru
Fri Dec 1 17:52:33 UTC 2006


At Fri, 01 Dec 2006 09:11:27 +0100 (CET),
Harald Hanche-Olsen wrote:
> 
> + Samium Gromoff <_deepfire at feelingofgreen.ru>:
> 
> | Only if a let-bound variable could be made dynamic-extent, which, as
> | far as i know (i could be wrong,) elisp cannot do.
> 
> Uh, as far as I know, that is the ONLY kind of let elisp knows about.
> 
> (The cl package for emacs works pretty hard to make a lexically scoped
> version of let.)

Hmm, perhaps i am doing something wrong, but, i tried to replace
the defvar + setq with a let, and now emacs says:
    
    error in process filter: Symbol's value as variable is void: *slime-in-dialect*

basically the change

-(defvar *slime-in-dialect* nil)
+;; (defvar *slime-in-dialect* nil)
 
 (defmacro define-slime-dialect (name &optional program hook connhook)
   "Define a command slime-dialect-NAME to start a specific Lisp.
 PROGRAM is the command to start the inferior process.
 HOOK is function which is run before the process is started."
   (let ((funsym (intern (format "slime-dialect-%s" name)))
         (hooksym (intern (format "slime-dialect-%s-hook" name)))
         (connhooksym (intern (format "slime-dialect-%s-connected-hook" name)))
         (progsym (intern (format "slime-dialect-%s-program" name))))
     `(progn
        (defvar ,progsym ,program)
        (defvar ,hooksym ,hook)
        (defvar ,connhooksym ,connhook)
        (add-hook 'slime-connected-hook
 		 (lambda ()
 		   (when (equal *slime-in-dialect* ,name)
 		     (run-hooks ',connhooksym))))
        (defun ,funsym ()
          ,(format "Start up slime according to `%s'." progsym)
          (interactive)
-         (let ((inferior-lisp-program ,progsym))
-	        (setq *slime-in-dialect* ,name)
+         (let ((inferior-lisp-program ,progsym)
+	        (*slime-in-dialect* ,name))
            (run-hooks ',hooksym)
            (call-interactively 'slime))))))

breaks it.

> - Harald

regards, Samium Gromoff



More information about the slime-devel mailing list