mu4e: Update mu4e~headers-move

Fixes: #2339.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-06 22:02:32 +03:00
parent f9550f3cb6
commit 8844ddac23

View File

@ -1602,24 +1602,25 @@ window . "
(defun mu4e~headers-move (lines) (defun mu4e~headers-move (lines)
"Move point LINES lines forward (if LINES is positive) or "Move point LINES lines.
backward (if LINES is negative). If this succeeds, return the new Move foward if LINES is positive or backwards if LINES is
docid. Otherwise, return nil." negative. If this succeeds, return the new docid. Otherwise,
return nil."
(unless (eq major-mode 'mu4e-headers-mode) (unless (eq major-mode 'mu4e-headers-mode)
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode)) (mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
(cl-flet ((goto-next-line (cl-flet ((goto-next-line
(arg) (arg)
(condition-case _err (condition-case _err
(prog1 (prog1
(let (line-move-visual) (let (line-move-visual)
(and (line-move arg) 0)) (and (line-move arg) 0))
;; Skip invisible text at BOL possibly hidden by ;; Skip invisible text at BOL possibly hidden by
;; the end of another invisible overlay covering ;; the end of another invisible overlay covering
;; previous EOL. ;; previous EOL.
(move-to-column 2)) (move-to-column 2))
((beginning-of-buffer end-of-buffer) ((beginning-of-buffer end-of-buffer)
1)))) 1))))
(let* ((_succeeded (zerop (goto-next-line lines))) (let* ((succeeded (zerop (goto-next-line lines)))
(docid (mu4e~headers-docid-at-point))) (docid (mu4e~headers-docid-at-point)))
;; move point, even if this function is called when this window is not ;; move point, even if this function is called when this window is not
;; visible ;; visible
@ -1638,7 +1639,9 @@ docid. Otherwise, return nil."
(mu4e-headers-view-message))) (mu4e-headers-view-message)))
;; attempt to highlight the new line, display the message ;; attempt to highlight the new line, display the message
(mu4e~headers-highlight docid) (mu4e~headers-highlight docid)
docid)))) (if succeeded
docid
nil)))))
(defun mu4e-headers-next (&optional n) (defun mu4e-headers-next (&optional n)
"Move point to the next message header. "Move point to the next message header.