emacs-devel
[Top][All Lists]
Advanced

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

Re: scratch/command 064f146 1/2: Change command to interactive ... modes


From: Stefan Kangas
Subject: Re: scratch/command 064f146 1/2: Change command to interactive ... modes
Date: Sun, 14 Feb 2021 10:03:57 -0600

Stefan Kangas <stefankangas@gmail.com> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> If it's not backward-compatible at all, however, I wouldn't feel
>> comfortable with using it in my packages for years to come.
>
> Could we write a macro `future-interactive' that will expand to the
> correct thing depending on the version of Emacs?  We could put something
> like that in GNU ELPA.  (I'm not sure the order in which things are
> expanded, so this might not work.)

This seems to work as expected on both master and Emacs 27:

(defmacro future-interactive (arg-descriptor &rest modes)
  (if (< emacs-major-version 28)
      `(interactive ,arg-descriptor)
    `(interactive ,arg-descriptor ,@(mapcar #'eval modes))))

(defun foo (arg)
  (future-interactive "P" 'fundamental-mode)
  (message "P was %s" arg))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]