[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Smarter M-x that filters on major-mode
From: |
Jose A. Ortega Ruiz |
Subject: |
Re: Smarter M-x that filters on major-mode |
Date: |
Thu, 11 Feb 2021 22:22:21 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
On Thu, Feb 11 2021, Lars Ingebrigtsen wrote:
> We now have
>
> (defun foo2 (arg)
> (command c-mode "p")
> (message "%s 2" arg))
You probably have already thought of it, and discarded it for a good
reason, but why not, instead of a new `command' form, just add a new
(optional) argument to `interactive'?
(defun foo2 (arg)
(interactive "p" c-mode)
(message "%s 2" arg))
it could even accept more than one mode
(defun foo2 (arg)
(interactive "p" text-mode json-mode)
(message "%s 2" arg))
and for users it'd be arguably easier to recognize what it means at a
glance (since we all know about `interactive').
i could even imagine a top level declaration like, say,
`(default-interactive-mode my-mode)' which would supply to all commands
in that .el that value for the optional arg (to easyly update packages
that define a mode and mostly commands just for it, something i at least
do very often), adding just a line to the file. or it could be a local
variable and work a bit like lexical-binding...
;;; my-mode.el --- a very useful mode -*- interactive-mode: my-mode -*-
- Re: Smarter M-x that filters on major-mode, (continued)
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Eli Zaretskii, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode,
Jose A. Ortega Ruiz <=
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/12
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Stefan Kangas, 2021/02/12
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/12
- Re: Smarter M-x that filters on major-mode, jao, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Dmitry Gutov, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/12
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/12
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/12