mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-14 19:54:44 -08:00
Don't let an empty summary change current message.
* mail/rmailsum.el (rmail-summary-rmail-update): Detect empty summary and don't change selected message. (rmail-summary-goto-msg): Likewise.
This commit is contained in:
parent
5356e1a3d9
commit
0dc04f4210
2 changed files with 77 additions and 63 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2013-05-05 Richard Stallman <rms@gnu.org>
|
||||
|
||||
* mail/rmailsum.el (rmail-summary-rmail-update):
|
||||
Detect empty summary and don't change selected message.
|
||||
(rmail-summary-goto-msg): Likewise.
|
||||
|
||||
2013-05-05 Alan Mackenzie <acm@muc.de>
|
||||
|
||||
* progmodes/cc-defs.el (c-version): Increment to 5.32.5.
|
||||
|
|
|
|||
|
|
@ -490,8 +490,7 @@ message."
|
|||
;; we "don't have" a summary.
|
||||
(setq rmail-summary-buffer nil)
|
||||
;; I have not a clue what this clause is doing. If you read this
|
||||
;; chunk of code and have a clue, then please email that clue to
|
||||
;; pmr@pajato.com
|
||||
;; chunk of code and have a clue, then please write it here.
|
||||
(if rmail-enable-mime
|
||||
(with-current-buffer rmail-buffer
|
||||
(setq rmail-summary-buffer nil)))
|
||||
|
|
@ -1122,57 +1121,59 @@ Search, the `unseen' attribute is restored.")
|
|||
(forward-line -1))
|
||||
(beginning-of-line)
|
||||
(skip-chars-forward " ")
|
||||
(let ((msg-num (string-to-number (buffer-substring
|
||||
(point)
|
||||
(progn (skip-chars-forward "0-9")
|
||||
(point))))))
|
||||
;; Always leave `unseen' removed
|
||||
;; if we get out of isearch mode.
|
||||
;; Don't let a subsequent isearch restore that `unseen'.
|
||||
(if (not isearch-mode)
|
||||
(setq rmail-summary-put-back-unseen nil))
|
||||
;; If the summary is empty, don't do anything.
|
||||
(unless (eobp)
|
||||
(let ((msg-num (string-to-number (buffer-substring
|
||||
(point)
|
||||
(progn (skip-chars-forward "0-9")
|
||||
(point))))))
|
||||
;; Always leave `unseen' removed
|
||||
;; if we get out of isearch mode.
|
||||
;; Don't let a subsequent isearch restore that `unseen'.
|
||||
(if (not isearch-mode)
|
||||
(setq rmail-summary-put-back-unseen nil))
|
||||
|
||||
(or (eq rmail-current-message msg-num)
|
||||
(let ((window (get-buffer-window rmail-buffer t))
|
||||
(owin (selected-window)))
|
||||
(if isearch-mode
|
||||
(progn
|
||||
;; If we first saw the previous message in this search,
|
||||
;; and we have gone to a different message while searching,
|
||||
;; put back `unseen' on the former one.
|
||||
(when rmail-summary-put-back-unseen
|
||||
(rmail-set-attribute rmail-unseen-attr-index t
|
||||
rmail-current-message)
|
||||
(save-excursion
|
||||
(goto-char rmail-summary-put-back-unseen)
|
||||
(rmail-summary-mark-seen rmail-current-message t t)))
|
||||
;; Arrange to do that later, for the new current message,
|
||||
;; if it still has `unseen'.
|
||||
(setq rmail-summary-put-back-unseen
|
||||
(if (rmail-message-unseen-p msg-num)
|
||||
(point))))
|
||||
(setq rmail-summary-put-back-unseen nil))
|
||||
;; Go to the desired message.
|
||||
(setq rmail-current-message msg-num)
|
||||
;; Update the summary to show the message has been seen.
|
||||
(rmail-summary-mark-seen msg-num t)
|
||||
(if window
|
||||
;; Using save-window-excursion would cause the new value
|
||||
;; of point to get lost.
|
||||
(unwind-protect
|
||||
(progn
|
||||
(select-window window)
|
||||
(rmail-show-message msg-num t))
|
||||
(select-window owin))
|
||||
(if (buffer-name rmail-buffer)
|
||||
(with-current-buffer rmail-buffer
|
||||
(rmail-show-message msg-num t))))
|
||||
;; In linum mode, the message buffer must be specially
|
||||
;; updated (Bug#4878).
|
||||
(and (fboundp 'linum-update)
|
||||
(buffer-name rmail-buffer)
|
||||
(linum-update rmail-buffer))))
|
||||
(rmail-summary-update-highlight nil)))))
|
||||
(or (eq rmail-current-message msg-num)
|
||||
(let ((window (get-buffer-window rmail-buffer t))
|
||||
(owin (selected-window)))
|
||||
(if isearch-mode
|
||||
(progn
|
||||
;; If we first saw the previous message in this search,
|
||||
;; and we have gone to a different message while searching,
|
||||
;; put back `unseen' on the former one.
|
||||
(when rmail-summary-put-back-unseen
|
||||
(rmail-set-attribute rmail-unseen-attr-index t
|
||||
rmail-current-message)
|
||||
(save-excursion
|
||||
(goto-char rmail-summary-put-back-unseen)
|
||||
(rmail-summary-mark-seen rmail-current-message t t)))
|
||||
;; Arrange to do that later, for the new current message,
|
||||
;; if it still has `unseen'.
|
||||
(setq rmail-summary-put-back-unseen
|
||||
(if (rmail-message-unseen-p msg-num)
|
||||
(point))))
|
||||
(setq rmail-summary-put-back-unseen nil))
|
||||
;; Go to the desired message.
|
||||
(setq rmail-current-message msg-num)
|
||||
;; Update the summary to show the message has been seen.
|
||||
(rmail-summary-mark-seen msg-num t)
|
||||
(if window
|
||||
;; Using save-window-excursion would cause the new value
|
||||
;; of point to get lost.
|
||||
(unwind-protect
|
||||
(progn
|
||||
(select-window window)
|
||||
(rmail-show-message msg-num t))
|
||||
(select-window owin))
|
||||
(if (buffer-name rmail-buffer)
|
||||
(with-current-buffer rmail-buffer
|
||||
(rmail-show-message msg-num t))))
|
||||
;; In linum mode, the message buffer must be specially
|
||||
;; updated (Bug#4878).
|
||||
(and (fboundp 'linum-update)
|
||||
(buffer-name rmail-buffer)
|
||||
(linum-update rmail-buffer))))
|
||||
(rmail-summary-update-highlight nil))))))
|
||||
|
||||
(defun rmail-summary-save-buffer ()
|
||||
"Save the buffer associated with this RMAIL summary."
|
||||
|
|
@ -1208,6 +1209,10 @@ Returns non-nil if message N was found."
|
|||
(buffer-substring (point)
|
||||
(min (point-max) (+ 6 (point))))))
|
||||
(total (with-current-buffer buf rmail-total-messages)))
|
||||
;; CURMSG should be nil when there's no current summary message
|
||||
;; (for instance, if the summary is empty).
|
||||
(if (= curmsg 0)
|
||||
(setq curmsg nil))
|
||||
;; If message number N was specified, find that message's line
|
||||
;; or set message-not-found.
|
||||
;; If N wasn't specified or that message can't be found.
|
||||
|
|
@ -1228,17 +1233,20 @@ Returns non-nil if message N was found."
|
|||
(setq n curmsg)
|
||||
(setq message-not-found t)
|
||||
(goto-char cur))))
|
||||
(rmail-summary-mark-seen n)
|
||||
(rmail-summary-update-highlight message-not-found)
|
||||
(beginning-of-line)
|
||||
(unless skip-rmail
|
||||
(let ((selwin (selected-window)))
|
||||
(unwind-protect
|
||||
(progn (rmail-pop-to-buffer buf)
|
||||
(rmail-show-message n))
|
||||
(select-window selwin)
|
||||
;; The actions above can alter the current buffer. Preserve it.
|
||||
(set-buffer obuf))))
|
||||
;; N can be nil now, along with CURMSG,
|
||||
;; if the summary is empty.
|
||||
(when n
|
||||
(rmail-summary-mark-seen n)
|
||||
(rmail-summary-update-highlight message-not-found)
|
||||
(beginning-of-line)
|
||||
(unless skip-rmail
|
||||
(let ((selwin (selected-window)))
|
||||
(unwind-protect
|
||||
(progn (rmail-pop-to-buffer buf)
|
||||
(rmail-show-message n))
|
||||
(select-window selwin)
|
||||
;; The actions above can alter the current buffer. Preserve it.
|
||||
(set-buffer obuf)))))
|
||||
(not message-not-found)))
|
||||
|
||||
;; Update the highlighted line in an rmail summary buffer.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue