From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79942 Path: news.gmane.org!not-for-mail From: Dave Abrahams Newsgroups: gmane.emacs.gnus.general Subject: [feature request] `message-send-rename-function' hooks Date: Thu, 15 Sep 2011 20:50:20 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1316134256 31921 80.91.229.12 (16 Sep 2011 00:50:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Sep 2011 00:50:56 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M28236@lists.math.uh.edu Fri Sep 16 02:50:52 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Mdm-0000r6-Ch for ding-account@gmane.org; Fri, 16 Sep 2011 02:50:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1R4MdW-00068O-0y; Thu, 15 Sep 2011 19:50:34 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1R4MdU-00068A-NB for ding@lists.math.uh.edu; Thu, 15 Sep 2011 19:50:32 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R4MdT-0008Az-1d for ding@lists.math.uh.edu; Thu, 15 Sep 2011 19:50:32 -0500 Original-Received: from mail-qy0-f179.google.com ([209.85.216.179]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1R4MdR-0007vj-EB for ding@gnus.org; Fri, 16 Sep 2011 02:50:29 +0200 Original-Received: by qyk33 with SMTP id 33so3679029qyk.17 for ; Thu, 15 Sep 2011 17:50:23 -0700 (PDT) Original-Received: by 10.224.217.132 with SMTP id hm4mr1595533qab.33.1316134222999; Thu, 15 Sep 2011 17:50:22 -0700 (PDT) Original-Received: from pluto.local (207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com. [207.172.223.249]) by mx.google.com with ESMTPS id ic20sm8959944qab.24.2011.09.15.17.50.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Sep 2011 17:50:22 -0700 (PDT) Original-Received: by pluto.local (Postfix, from userid 501) id 038C9F1831B; Thu, 15 Sep 2011 20:50:20 -0400 (EDT) X-Debbugs-Version: 5.110018 X-Debbugs-Package: gnus User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin) X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79942 Archived-At: 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=E2=80=94and I /d= o/ hate repetition=E2=80=94I am wishing for some way to re-use most of the buf= fer 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=3D 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 10= 38.36) of 2011-09-12 on pluto.luannocracy.com 200 Leafnode NNTP Daemon, version 1.11.8 running at localhost (my fqdn: plu= to.boostpro.com) 500 Unknown command --=20 Dave Abrahams BoostPro Computing http://www.boostpro.com