[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Macro expansion containing ‘interactive’
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Macro expansion containing ‘interactive’ |
Date: |
Thu, 19 Aug 2021 15:42:22 +0000 |
> >> In an attempt to create a compatibility wrapper for the new optional mode
> >> list parameter of ‘interactive’ I am facing difficulties. The definition
> >> looks like this:
> >
> > `interactive` is not a special form. Just like docstrings, it's a part
> > of the syntax of `lambda`, so you need to define a `foo-lambda` if you
> > want it to work reliably.
>
> Yup. When doing code that needs to be backwards-compatible here, it's
> better to use a declare form instead:
>
> (defun foo ()
> (declare (modes dired-mode))
> (interactive)
> ...)
Are you sure that that modes `declare' form is
backward-compatible with, say, Emacs 20? This
is the only definition of `declare' in Emacs 20,
and it's in `cl-macs.el' - i.e., a (primitive)
emulation of Common Lisp's `declare':
(defmacro declare (&rest specs)
(if (cl-compiling-file)
(while specs
(if (listp cl-declare-stack)
(cl-push (car specs)
cl-declare-stack))
(cl-do-proclaim (cl-pop specs) nil)))
nil)
Re: Macro expansion containing ‘interactive’, Michael Heerdegen, 2021/08/19