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

Marco Baringer mb at bese.it
Thu Nov 30 16:03:38 UTC 2006


_deepfire at feelingofgreen.ru writes:

> +(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)

would a let work jsut as well here? (i'd like to avoid a new global if
it's only purpose is to choose which hook to run).

>             (run-hooks ',hooksym)
>             (call-interactively 'slime))))))

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the slime-devel mailing list