From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Lillibridge Newsgroups: gmane.emacs.bugs Subject: bug#13330: 24.2; rmail-set-header doesn't work for multi-line headers Date: Tue, 01 Jan 2013 14:40:52 -0800 Message-ID: <87obh8ttl7.fsf@foil.strangled.net> Reply-To: mdl@alum.mit.edu NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1357080120 31059 80.91.229.3 (1 Jan 2013 22:42:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jan 2013 22:42:00 +0000 (UTC) To: 13330@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 01 23:42:16 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TqAXC-0004Uw-Uz for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jan 2013 23:42:11 +0100 Original-Received: from localhost ([::1]:50911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAWy-0000pM-2J for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jan 2013 17:41:56 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAWt-0000p2-AS for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:41:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqAWn-0001Ua-Hp for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:41:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAWn-0001U4-Dv for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:41:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TqAY2-0003oi-G3 for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mark Lillibridge Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Jan 2013 22:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13330 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135708015014627 (code B ref -1); Tue, 01 Jan 2013 22:43:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jan 2013 22:42:30 +0000 Original-Received: from localhost ([127.0.0.1]:39422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqAXW-0003ns-C2 for submit@debbugs.gnu.org; Tue, 01 Jan 2013 17:42:30 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33334) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqAXS-0003nj-Lu for submit@debbugs.gnu.org; Tue, 01 Jan 2013 17:42:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqAW9-0001P0-E8 for submit@debbugs.gnu.org; Tue, 01 Jan 2013 17:41:09 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:60295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAW9-0001Ow-BZ for submit@debbugs.gnu.org; Tue, 01 Jan 2013 17:41:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAW5-0000fO-BD for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:41:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqAW1-0001OR-AA for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:41:01 -0500 Original-Received: from alum-mailsec-scanner-5.mit.edu ([18.7.68.17]:64474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqAW1-0001ON-5Q for bug-gnu-emacs@gnu.org; Tue, 01 Jan 2013 17:40:57 -0500 X-AuditID: 12074411-b7fa36d0000008cc-6f-50e365f8f1bd Original-Received: from outgoing-alum.mit.edu (OUTGOING-ALUM.MIT.EDU [18.7.68.33]) by alum-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id BB.76.02252.8F563E05; Tue, 1 Jan 2013 17:40:56 -0500 (EST) Original-Received: from foil.strangled.net (c-67-188-235-212.hsd1.ca.comcast.net [67.188.235.212]) (authenticated bits=0) (User authenticated as mdl@ALUM.MIT.EDU) by outgoing-alum.mit.edu (8.13.8/8.12.4) with ESMTP id r01Mer2k006962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 1 Jan 2013 17:40:55 -0500 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKIsWRmVeSWpSXmKPExsUixO6iqPsj9XGAwbkOfovvB6ospn48w+bA 5PH3/Qcmj7ZpZgFMUdw2SYklZcGZ6Xn6dgncGRMbvzAWLBGtmHNHuIFxi0AXIyeHhICJxJaP B1kgbDGJC/fWs3UxcnEICVxmlGhf9IQVwrnCJPHj3CZGkCo2AU2J6c++s4PYIgKSEl/vtAIV cXAICzhLHDkSCBIWEpCSWLroBFgJi4CqxJ4pPUwgNq+AvsT2O9/YIWxBiZMzn4AtZhaQkDj4 4gXzBEaeWUhSs5CkFjAyrWKUS8wpzdXNTczMKU5N1i1OTszLSy3SNdXLzSzRS00p3cQICRbB HYwzTsodYhTgYFTi4b2t/zhAiDWxrLgy9xCjJAeTkijvtXigEF9SfkplRmJxRnxRaU5q8SFG CQ5mJRHe4i+PAoR4UxIrq1KL8mFS0hwsSuK8fEvU/YQE0hNLUrNTUwtSi2CyMhwcShK8F1KA hgoWpaanVqRl5pQgpJk4OEGGc0mJFKfmpaQWJZaWZMSD4iW+GBgxICkeoL2/QNp5iwsSc4Gi EK2nGHU5fq28+ZRRiCUvPy9VSpz3LUiRAEhRRmke3ApYanjFKA70sTDvcZAqHmBagZv0CmgJ E9ASLYYHIEtKEhFSUg2MUfs+GT/ZMuvPr7TAaZV2kw0z9sZdF7xs7Kya1NL/Svm/4FNNnTWv 2d3CD6TN+fD2YEPgE6aS0yZRbkmrbt8Skrr98FjTtmzhWWwyyzpv5i3wc2FW977i0rfuTLpx dYX4nNu6/g7sf/ce13v8e5+chZtCxha+/7L3dLexOT2bXyJ/7+EVT8cDSizFGYmG X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69278 Archived-At: This should be obvious from inspection (rmail.el:2166): (defun rmail-set-header-1 (name value) "Subroutine of `rmail-set-header'. Narrow to header, set header NAME to VALUE, replacing existing if present. VALUE nil means to remove NAME altogether." (if (search-forward "\n\n" nil t) (progn (forward-char -1) (narrow-to-region (point-min) (point)) (goto-char (point-min)) (if (re-search-forward (concat "^" (regexp-quote name) ":") nil 'move) (if value (progn (delete-region (point) (line-end-position)) (insert " " value)) (delete-region (line-beginning-position) (line-beginning-position 2))) (if value (insert name ": " value "\n")))) (rmail-error-bad-format))) (defun rmail-set-header (name &optional msgnum value) "Set message header NAME to VALUE in message number MSGNUM. If MSGNUM is nil, use the current message. NAME and VALUE are strings. VALUE may also be nil, meaning to remove the header." (rmail-apply-in-message msgnum 'rmail-set-header-1 name value) (with-current-buffer rmail-buffer ;; Ensure header changes get saved. ;; (Note replacing a header with an identical copy modifies.) (set-buffer-modified-p t) ;; However: don't save in mbox format over a Babyl file ;; merely because of this. (rmail-dont-modify-format))) but if not, evaluate (esc-:) "(rmail-set-header "subject" nil)" on a Rmail message with a multiline subject like: |X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, | RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 |From: Mark Lillibridge |To: |Subject: this is a long subject | with several lines | indeed |Date: Sat, 22 Oct 2011 12:05:57 -0700 |Reply-To: |Content-type: text/plain; charset=us-ascii | | |empty body The result (after hitting t twice to re-decode) is: |X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, | RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 |From: Mark Lillibridge |To: | with several lines | indeed |Date: Sat, 22 Oct 2011 12:05:57 -0700 |Reply-To: |Content-type: text/plain; charset=us-ascii | | |empty body Notice that only the first line of the Subject has been deleted. Should there be a warning that this function does not RFC2047 encode value so the caller is responsible for doing any such encoding if needed? - Mark