bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec


From: Lars Ingebrigtsen
Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?
Date: Sun, 18 Aug 2019 16:06:27 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Štěpán Němec <address@hidden> writes:

> Well, the closest I see in my init is this (in fact I have been doing it
> differently and more uglily, but now I see this is simpler):
>
> (defun my-compose-mail-advice (orig &rest args)
>   "Read From: address interactively."
>   (interactive (lambda (spec)
>                  (let* ((user-mail-address
>                          (completing-read "From: " '("address@hidden"
>                                                      "address@hidden")))
>                         (from (message-make-from user-full-name
>                                                  user-mail-address))
>                         (spec (advice-eval-interactive-spec spec)))
>                    ;; notmuch doesn't understand "From", it has to be a symbol
>                    (push (cons 'From from) (nth 2 spec))
>                    spec)))
>   (apply orig args))
>
> (advice-add 'compose-mail :around #'my-compose-mail-advice)

That's a good example.  I've now added it to the trunk with some slight
modifications.

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