* [feature request] `message-send-rename-function' hooks
@ 2011-09-16 0:50 Dave Abrahams
2011-09-21 17:50 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Dave Abrahams @ 2011-09-16 0:50 UTC (permalink / raw)
To: ding
I am using the `message-send-rename-function' below. The astute
observer will notice that most of the code is lifted straight out of
`message-do-send-housekeeping'. Hating repetition as I do—and I /do/
hate repetition—I am wishing for some way to re-use most of the buffer
renaming code that's already there.
For *my* purposes, it would be sufficient to break out the code from
`message-do-send-housekeeping' and create what is essentially the
default `message-send-rename-function'. I could then have my rename
function call that and then adjust the buffer name again. Others might
want more control, of course.
Thoughts?
--8<---------------cut here---------------start------------->8---
(defun dwa/message-send-rename ()
"Renames sent message buffers to include the Subject field when
used as the value of `message-send-rename-function'."
(message-narrow-to-headers)
(unwind-protect
(when (string-match
"\\`\\*\\(sent \\|unsent \\)?\\(.+\\)\\*[^\\*]*\\|\\`mail to "
(buffer-name))
(let ((name (match-string 2 (buffer-name)))
to group)
(if (not (or (null name)
(string-equal name "mail")
(string-equal name "posting")))
(setq name (concat "*sent " name ": "))
(message-narrow-to-headers)
(setq to (message-fetch-field "to"))
(setq group (message-fetch-field "newsgroups"))
(widen)
(setq name
(cond
(to (concat "*sent mail to "
(or (car (mail-extract-address-components to))
to) ": "))
((and group (not (string= group "")))
(concat "*sent posting on " group ": "))
(t "*sent mail: "))))
(setq name (concat name (message-fetch-field "subject") "*"))
(unless (string-equal name (buffer-name))
(rename-buffer name t))))
(widen)))
--8<---------------cut here---------------end--------------->8---
No Gnus v0.18
GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0, Carbon Version 1.6.0 AppKit 1038.36)
of 2011-09-12 on pluto.luannocracy.com
200 Leafnode NNTP Daemon, version 1.11.8 running at localhost (my fqdn: pluto.boostpro.com)
500 Unknown command
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [feature request] `message-send-rename-function' hooks
2011-09-16 0:50 [feature request] `message-send-rename-function' hooks Dave Abrahams
@ 2011-09-21 17:50 ` Lars Magne Ingebrigtsen
2011-09-21 18:19 ` Dave Abrahams
0 siblings, 1 reply; 3+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-21 17:50 UTC (permalink / raw)
To: Dave Abrahams; +Cc: ding
Dave Abrahams <dave@boostpro.com> writes:
> For *my* purposes, it would be sufficient to break out the code from
> `message-do-send-housekeeping' and create what is essentially the
> default `message-send-rename-function'. I could then have my rename
> function call that and then adjust the buffer name again. Others might
> want more control, of course.
I've now separated the code out into
`message-default-send-rename-function'.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [feature request] `message-send-rename-function' hooks
2011-09-21 17:50 ` Lars Magne Ingebrigtsen
@ 2011-09-21 18:19 ` Dave Abrahams
0 siblings, 0 replies; 3+ messages in thread
From: Dave Abrahams @ 2011-09-21 18:19 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen; +Cc: ding
on Wed Sep 21 2011, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:
> Dave Abrahams <dave@boostpro.com> writes:
>
>> For *my* purposes, it would be sufficient to break out the code from
>> `message-do-send-housekeeping' and create what is essentially the
>> default `message-send-rename-function'. I could then have my rename
>> function call that and then adjust the buffer name again. Others might
>> want more control, of course.
>
> I've now separated the code out into
> `message-default-send-rename-function'.
Thanks!
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-21 18:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16 0:50 [feature request] `message-send-rename-function' hooks Dave Abrahams
2011-09-21 17:50 ` Lars Magne Ingebrigtsen
2011-09-21 18:19 ` Dave Abrahams
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).