From: Dave Abrahams <dave@boostpro.com>
To: ding@gnus.org
Subject: [feature request] `message-send-rename-function' hooks
Date: Thu, 15 Sep 2011 20:50:20 -0400 [thread overview]
Message-ID: <m2ehzhqpir.fsf@pluto.luannocracy.com> (raw)
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
next reply other threads:[~2011-09-16 0:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 0:50 Dave Abrahams [this message]
2011-09-21 17:50 ` Lars Magne Ingebrigtsen
2011-09-21 18:19 ` Dave Abrahams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2ehzhqpir.fsf@pluto.luannocracy.com \
--to=dave@boostpro.com \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).