* advising gnus-summary-resend-message, the clean way
@ 2011-11-07 21:53 Peter Münster
2011-11-07 23:18 ` Katsumi Yamaoka
0 siblings, 1 reply; 2+ messages in thread
From: Peter Münster @ 2011-11-07 21:53 UTC (permalink / raw)
To: ding
Hello,
I want to use bbdb completion, even in the mini-buffer, so my first
idea[1] was, to advise gnus-summary-resend-message:
--8<---------------cut here---------------start------------->8---
(defadvice gnus-summary-resend-message (around pm/resend-with-bbdb activate)
"Resend message with bbdb address completion."
(flet ((message-read-from-minibuffer (p &optional d)
(bbdb-completing-read-mails p d)))
ad-do-it))
--8<---------------cut here---------------end--------------->8---
But it does not work, I think it's because
`message-read-from-minibuffer' is called from the `interactive' form.
Redefining `message-read-from-minibuffer' works well:
--8<---------------cut here---------------start------------->8---
(defun message-read-from-minibuffer (prompt &optional initial-contents)
(bbdb-completing-read-mails prompt initial-contents))
--8<---------------cut here---------------end--------------->8---
But it does not seem clean to me: when there will be other usages of
message-read-from-minibuffer in future gnus versions, this redefinition
could break things.
For now, it works for me, but I would like to know, how it should be
done the clean way.
[1]: Eric Abrahamsen gave me some hints.
--
Peter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: advising gnus-summary-resend-message, the clean way
2011-11-07 21:53 advising gnus-summary-resend-message, the clean way Peter Münster
@ 2011-11-07 23:18 ` Katsumi Yamaoka
0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2011-11-07 23:18 UTC (permalink / raw)
To: ding
Peter Münster wrote:
> I want to use bbdb completion, even in the mini-buffer, so my first
> idea[1] was, to advise gnus-summary-resend-message:
> (defadvice gnus-summary-resend-message (around pm/resend-with-bbdb activate)
> "Resend message with bbdb address completion."
> (flet ((message-read-from-minibuffer (p &optional d)
> (bbdb-completing-read-mails p d)))
> ad-do-it))
> But it does not work, I think it's because
> `message-read-from-minibuffer' is called from the `interactive' form.
[...]
In advice.el there are some examples to tweak the interactive form.
Maybe this is what you want:
(defadvice gnus-summary-resend-message (before pm/resend-with-bbdb activate)
"Resend message with bbdb address completion."
(interactive
(list (bbdb-completing-read-mails
"Resend message(s) to: "
(when (and gnus-summary-resend-default-address
(gnus-buffer-live-p gnus-original-article-buffer))
(with-current-buffer gnus-original-article-buffer
(nnmail-fetch-field "to"))))
current-prefix-arg)))
This shows advised function definition w/o byte-compilation.
(let ((ad-default-compilation-action 'never))
(defadvice gnus-summary-resend-message ...FORMS...)
(pp (symbol-function 'gnus-summary-resend-message))
nil)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-07 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 21:53 advising gnus-summary-resend-message, the clean way Peter Münster
2011-11-07 23:18 ` Katsumi Yamaoka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).