From: Glenn Morris <rgm@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 2228@emacsbugs.donarmstrong.com, rms@gnu.org
Subject: bug#2228: 23.0.90; rmail-cease-edit ignores changes to the message headers
Date: Wed, 11 Feb 2009 21:36:10 -0500 [thread overview]
Message-ID: <whvdrgl6ud.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <jwvbpt89ydm.fsf-monnier+emacsbugreports@gnu.org> (Stefan Monnier's message of "Wed, 11 Feb 2009 21:35:19 -0500")
Stefan Monnier wrote:
>> Me installing the 10 line fix I have for the above problem will not
>> make it any harder for someone to write those 200 lines in the future.
>
> Can you show us that fix?
*** rmailedit.el 10 Feb 2009 03:33:48 -0000 1.50
--- rmailedit.el 12 Feb 2009 02:36:41 -0000
***************
*** 78,88 ****
;;;###autoload
(defun rmail-edit-current-message ()
! "Edit the contents of this message."
(interactive)
(if (zerop rmail-total-messages)
(error "No messages in this buffer"))
! (set (make-local-variable 'rmail-old-pruned) (rmail-msg-is-pruned))
(rmail-edit-mode)
(set (make-local-variable 'rmail-old-text)
(save-restriction
--- 78,92 ----
;;;###autoload
(defun rmail-edit-current-message ()
! "Edit the contents of this message.
! Expands the header, moves point to the start of the body."
(interactive)
(if (zerop rmail-total-messages)
(error "No messages in this buffer"))
! (if (set (make-local-variable 'rmail-old-pruned) (rmail-msg-is-pruned))
! (rmail-toggle-header 0)) ; expand headers
! (goto-char (point-min))
! (search-forward "\n\n" nil t) ; move to start of body
(rmail-edit-mode)
(set (make-local-variable 'rmail-old-text)
(save-restriction
***************
*** 113,119 ****
;; Disguise any "From " lines so they don't start a new message.
(save-excursion
(goto-char (point-min))
! (or rmail-old-pruned (forward-line 1))
(while (re-search-forward "^>*From " nil t)
(beginning-of-line)
(insert ">")
--- 117,123 ----
;; Disguise any "From " lines so they don't start a new message.
(save-excursion
(goto-char (point-min))
! (forward-line 1) ; leave the initial ^From alone
(while (re-search-forward "^>*From " nil t)
(beginning-of-line)
(insert ">")
***************
*** 126,135 ****
(insert "\n"))
(unless (looking-back "\n\n")
(insert "\n")))
(let ((old rmail-old-text)
(pruned rmail-old-pruned)
character-coding is-text-message coding-system
! headers-end limit)
;; Go back to Rmail mode, but carefully.
(force-mode-line-update)
(let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook
--- 130,140 ----
(insert "\n"))
(unless (looking-back "\n\n")
(insert "\n")))
+ ;; FIXME should also ensure \n\n still ends the headers.
(let ((old rmail-old-text)
(pruned rmail-old-pruned)
character-coding is-text-message coding-system
! start limit)
;; Go back to Rmail mode, but carefully.
(force-mode-line-update)
(let ((rmail-buffer-swapped nil)) ; Prevent change-major-mode-hook
***************
*** 143,152 ****
;; If text has really changed, mark message as edited.
(unless (and (= (length old) (- (point-max) (point-min)))
(string= old (buffer-substring (point-min) (point-max))))
! (setq old nil)
! (goto-char (point-min))
! (search-forward "\n\n")
! (setq headers-end (point))
(rmail-swap-buffers-maybe)
(narrow-to-region (rmail-msgbeg rmail-current-message)
(rmail-msgend rmail-current-message))
--- 148,155 ----
;; If text has really changed, mark message as edited.
(unless (and (= (length old) (- (point-max) (point-min)))
(string= old (buffer-substring (point-min) (point-max))))
! (setq old nil
! start (goto-char (point-min)))
(rmail-swap-buffers-maybe)
(narrow-to-region (rmail-msgbeg rmail-current-message)
(rmail-msgend rmail-current-message))
***************
*** 165,176 ****
(if character-coding
(setq character-coding (downcase character-coding)))
! (goto-char limit)
(let ((inhibit-read-only t))
(let ((data-buffer (current-buffer))
(end (copy-marker (point) t)))
(with-current-buffer rmail-view-buffer
! (encode-coding-region headers-end (point-max) coding-system
data-buffer))
(delete-region end (point-max)))
--- 168,179 ----
(if character-coding
(setq character-coding (downcase character-coding)))
! (goto-char (point-min))
(let ((inhibit-read-only t))
(let ((data-buffer (current-buffer))
(end (copy-marker (point) t)))
(with-current-buffer rmail-view-buffer
! (encode-coding-region start (point-max) coding-system
data-buffer))
(delete-region end (point-max)))
next prev parent reply other threads:[~2009-02-12 2:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 15:30 bug#2228: 23.0.90; rmail-cease-edit ignores changes to the message headers Eli Zaretskii
2009-02-08 1:20 ` Richard M Stallman
2009-02-08 20:43 ` Glenn Morris
2009-02-09 20:38 ` Eli Zaretskii
2009-02-09 20:48 ` Glenn Morris
2009-02-10 20:02 ` Richard M Stallman
2009-02-10 20:27 ` Eli Zaretskii
2009-02-11 6:22 ` Richard M Stallman
2009-02-11 20:22 ` Eli Zaretskii
2009-02-18 4:39 ` Glenn Morris
2009-02-18 4:50 ` Processed: " Emacs bug Tracking System
2009-02-18 18:48 ` Eli Zaretskii
2009-02-21 11:42 ` Eli Zaretskii
2009-02-10 0:11 ` Richard M Stallman
2009-02-10 3:38 ` Glenn Morris
2009-02-10 8:56 ` Eli Zaretskii
2009-02-11 6:22 ` Richard M Stallman
2009-02-11 20:52 ` Glenn Morris
2009-02-12 2:35 ` Stefan Monnier
2009-02-12 2:36 ` Glenn Morris [this message]
2009-02-12 8:21 ` Glenn Morris
2009-02-12 13:47 ` Richard M Stallman
2009-02-12 17:44 ` Glenn Morris
2009-02-12 18:25 ` Glenn Morris
2009-02-13 6:32 ` Richard M Stallman
2009-02-10 8:40 ` Eli Zaretskii
2009-02-11 1:48 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2009-02-19 0:24 Xavier Maillard
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=whvdrgl6ud.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=2228@emacsbugs.donarmstrong.com \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.