emacs-devel
[Top][All Lists]
Advanced

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

Re: Smarter M-x that filters on major-mode


From: Lars Ingebrigtsen
Subject: Re: Smarter M-x that filters on major-mode
Date: Thu, 11 Feb 2021 18:29:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

> How 'bout
>
>     (declare (M-x-pred EXP))
>
> which turns into
>
>     (define-symbol-prop '[SYM] (lambda () EXP))
>
> so EXP can be (derived-mode-p 'foo-mode) or it can be nil, or ...

I happened onto another possible use here while testing things -- making
commands available after loading some other package.  That is, we
currently have stuff like

(defun gnus-summary-thing ()
  (interactive)
  (require 'thing)
  (do-thing-stuff))

which just signals an error if `thing' doesn't exist.  Instead we could
do something like:

(defun gnus-summary-thing ()
  (interactive)
  (declare (M-x-pred (find-library "thing")))
  (require 'thing)
  (do-thing-stuff))

-- 
(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]