emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: command mode-specificity [was: scratch/command 064f


From: Lars Ingebrigtsen
Subject: Re: [External] : Re: command mode-specificity [was: scratch/command 064f146 1/2: Change...]
Date: Wed, 17 Feb 2021 16:42:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I think it would be good to try and clarify what should be the
> criterion, and not in terms of "should be listed in M-x" since that
> inherently depends on opinions, but rather in more technical terms that
> depend on what the command does.
> [ A bit like with docstrings: we like docstrings that say what the
>   function does rather than when/where it's meant to be used.  ]
>
> Maybe something like "would inevitably signal an error"?

I don't think there's any hard and fast criterion that can be used,
though.  For instance, there was one mode I tagged up that had a
`foo-quit' command, which just buried the buffer.  Now, that's a command
that can work anywhere...  but the reason it exists is presumably
because the person who wrote it either missed out on inheriting from
`special-mode', or didn't know you can bind `bury-buffer' directly, or
whatever.

In any case, it's not a command that anybody not using `foo' will (or
should) be using, so I'd say (and I did say) that it's a mode-specific
command.

Now, lots of commands do, indeed, signal an error outside the proper
mode, or completely mess things up outside the proper mode, and those
are no-brainers.

I'd planned on writing a little essay for the lispref manual about this,
once I'd gotten some more experience, because it's not immediately
obvious what's the right thing to do until you've evaluated a few
instances.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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