emacs-devel
[Top][All Lists]
Advanced

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

RE: [External] : Re: Current mode command discovery


From: Drew Adams
Subject: RE: [External] : Re: Current mode command discovery
Date: Mon, 22 Feb 2021 05:27:52 +0000

> * The :enable thing in menu items

Don't forget :filter (which can also apply to commands bound to keyboard keys).

> All of these are ways to say that the command exists, but can't be
> executed right now.  We could introduce one new mechanism that replaces
> all this spread-out information in one place, where it belongs:
> 
> (defun kill-region (...)
>   (declare (inhibited (lambda ()
>                         (and (not (region-active-p))
>                              "The region is not active"))))...)
> Or something along those lines.

Again, a lispy way to attach such info (and not just info saying why a command 
can't be invoked right ow) to a named function is to just use symbol 
properties.  Why do you insist on modifying source code this way?

It's not like these are declarations for the byte-compiler.  There's no need to 
hard-code this info in the source code.

Or even if you insist on doing it there, just use `put'.  That lets anyone do 
it anywhere: users, anyone, anytime.



reply via email to

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