[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:17:15 -0600 |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> 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))
>
> Cool! Does it survive byte compilation, too? Hm... I guess so,
> because macros should be expanded by that time, I guess?
It seems to survive, yes.
Byte-code on Emacs 27:
(defalias 'foo #[(arg) "\301\302^H\"\207" [arg message "P was %s"] 3 nil "P"])
Byte-code on master:
(defalias 'foo #[(arg) "\301\302^H\"\207" [arg message "P was %s"] 3
nil ["P" (fundamental-mode)]])
So I could pack it up as a new GNU ELPA package `future-interactive',
and anyone who wants to use it, can. Or should it be a core package
perhaps?
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Dmitry Gutov, 2021/02/13
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/13
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Dmitry Gutov, 2021/02/13
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Stefan Kangas, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Stefan Kangas, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes,
Stefan Kangas <=
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Stefan Kangas, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Stefan Kangas, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Eli Zaretskii, 2021/02/14
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/16
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Eli Zaretskii, 2021/02/16
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/16
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Eli Zaretskii, 2021/02/16
- Re: scratch/command 064f146 1/2: Change command to interactive ... modes, Lars Ingebrigtsen, 2021/02/16