From: Katsumi Yamaoka Date: Fri, 27 Jul 2012 08:01:44 +0000 (+0000) Subject: message.el: Make header fill function work properly X-Git-Tag: emacs-24.2.90~1060 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0000d0d54bb9cbc835172d9f5f8ff7595786af62;p=emacs.git message.el: Make header fill function work properly --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 83cb55d3594..80ede10c8c4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2012-07-27 Katsumi Yamaoka + + * message.el (message-kill-address): Don't kill last newline. + (message-skip-to-next-address): Don't move to the next header. + (message-fill-field-address): Work properly. + 2012-07-25 Julien Danjou * gnus-art.el (gnus-kill-sticky-article-buffers): Reintroduce. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ecc797314c4..e56a6c6d078 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2603,7 +2603,7 @@ Point is left at the beginning of the narrowed-to region." (interactive) (let ((start (point))) (message-skip-to-next-address) - (kill-region start (point)))) + (kill-region start (if (bolp) (1- (point)) (point))))) (autoload 'Info-goto-node "info") @@ -6099,7 +6099,7 @@ Headers already prepared in the buffer are not modified." (while (and (not (= (point) end)) (or (not (eq char ?,)) quoted)) - (skip-chars-forward "^,\"" (point-max)) + (skip-chars-forward "^,\"" end) (when (eq (setq char (following-char)) ?\") (setq quoted (not quoted))) (unless (= (point) end) @@ -6136,17 +6136,22 @@ If the current line has `message-yank-prefix', insert it on the new line." (point-max)))) (defun message-fill-field-address () - (while (not (eobp)) - (message-skip-to-next-address) - (let (last) - (if (and (> (current-column) 78) - last) - (progn - (save-excursion - (goto-char last) - (insert "\n\t")) - (setq last (1+ (point)))) - (setq last (1+ (point))))))) + (let (end last) + (while (not end) + (message-skip-to-next-address) + (cond ((bolp) + (end-of-line 0) + (setq end 1)) + ((eobp) + (setq end 0))) + (when (and (> (current-column) 78) + last) + (save-excursion + (goto-char last) + (delete-char (- (skip-chars-backward " \t"))) + (insert "\n\t"))) + (setq last (point))) + (forward-line end))) (defun message-fill-field-general () (let ((begin (point))