]> code.delx.au - gnu-emacs/commitdiff
(mh-rescan-folder): Try to keep cursor at current message, even if cur
authorBill Wohler <wohler@newt.com>
Tue, 10 Jan 2006 01:56:32 +0000 (01:56 +0000)
committerBill Wohler <wohler@newt.com>
Tue, 10 Jan 2006 01:56:32 +0000 (01:56 +0000)
sequence is no longer present (closes SF #1207247).

lisp/mh-e/ChangeLog
lisp/mh-e/mh-e.el

index ddd7d94c8d02ec33ab422d6af6b3f19c8508002e..99aa9b5a98c594f01388d291e50d3f6f1dc62047 100644 (file)
@@ -1,5 +1,9 @@
 2006-01-09  Bill Wohler  <wohler@newt.com>
 
+       * mh-e.el (mh-rescan-folder): Try to keep cursor at current
+       message, even if cur sequence is no longer present (closes SF
+       #1207247).
+
        * mh-comp.el: Use ";; Shush compiler." comment consistently per
        Mark's suggestion.
        (mh-letter-mode): Derive from mail-mode and delete code copied
index 31ae49bfc4391b031e6d2551c47cd316e6b0d2f5..43743e3cad23a04143e9bbcb5f1e1f2d478a8559 100644 (file)
@@ -1208,8 +1208,13 @@ if DONT-EXEC-PENDING is non-nil."
                                         mh-interpret-number-as-range-flag)
                        nil)))
   (setq mh-next-direction 'forward)
-  (let ((threaded-flag (memq 'unthread mh-view-ops)))
+  (let ((threaded-flag (memq 'unthread mh-view-ops))
+        (msg-num (mh-get-msg-num nil)))
     (mh-scan-folder mh-current-folder (or range "all") dont-exec-pending)
+    ;; If there isn't a cur sequence, mh-scan-folder goes to the first message.
+    ;; Try to stay where we were.
+    (if (null (car (mh-seq-to-msgs 'cur)))
+        (mh-goto-msg msg-num t t))
     (cond (threaded-flag (mh-toggle-threads))
           (mh-index-data (mh-index-insert-folder-headers)))))
 
@@ -1293,7 +1298,6 @@ RANGE is read in interactive use."
   (if (not (mh-outstanding-commands-p))
       (mh-set-folder-modified-p nil)))
 
-
 (defun mh-folder-line-matches-show-buffer-p ()
   "Return t if the message under point in folder-mode is in the show buffer.
 Return nil in any other circumstance (no message under point, no
@@ -1474,7 +1478,6 @@ structures."
       (setq mh-previous-window-config config)))
   nil)
 
-
 (defun mh-update-sequences ()
   "Flush MH-E's state out to MH.
 
@@ -2262,7 +2265,6 @@ removed."
       (mh-remove-sequence-notation msg nil t))
     (clrhash mh-sequence-notation-history)))
 
-
 (defun mh-goto-cur-msg (&optional minimal-changes-flag)
   "Position the cursor at the current message.
 When optional argument MINIMAL-CHANGES-FLAG is non-nil, the