summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2021-06-17 20:33:35 +0300
committerGitHub <noreply@github.com>2021-06-17 20:33:35 +0300
commitc3c8e534547f93384e194bb82c04a4e2fddc0731 (patch)
treea34047d3223545ff35a6c490b056bb55c48cb66b
parent9020389a5625391da8f996eadf2e022d118d4881 (diff)
parent50f6f539f5e54c6bdc9abd5c6895e8f3856bf0a5 (diff)
Merge pull request #2036 from thierryvolpiatto/line_move_visual
Ensure mu4e~headers-move honor line-move-ignore-invisible
-rw-r--r--mu4e/mu4e-headers.el46
1 files changed, 26 insertions, 20 deletions
diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el
index e1f9713..4663e1c 100644
--- a/mu4e/mu4e-headers.el
+++ b/mu4e/mu4e-headers.el
@@ -1843,26 +1843,32 @@ backward (if LINES is negative). If this succeeds, return the new
docid. Otherwise, return nil."
(unless (eq major-mode 'mu4e-headers-mode)
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
- (let* ((_succeeded (zerop (forward-line lines)))
- (docid (mu4e~headers-docid-at-point)))
- ;; move point, even if this function is called when this window is not
- ;; visible
- (when docid
- ;; update all windows showing the headers buffer
- (walk-windows
- (lambda (win)
- (when (eq (window-buffer win) (mu4e-get-headers-buffer))
- (set-window-point win (point))))
- nil t)
- (if (eq mu4e-split-view 'single-window)
- (when (eq (window-buffer) (mu4e-get-view-buffer))
- (mu4e-headers-view-message))
- ;; update message view if it was already showing
- (when (and mu4e-split-view (window-live-p mu4e~headers-view-win))
- (mu4e-headers-view-message)))
- ;; attempt to highlight the new line, display the message
- (mu4e~headers-highlight docid)
- docid)))
+ (cl-flet ((goto-next-line
+ (arg)
+ (condition-case _err
+ (and (line-move arg) 0)
+ ((beginning-of-buffer end-of-buffer)
+ 1))))
+ (let* ((_succeeded (zerop (goto-next-line lines)))
+ (docid (mu4e~headers-docid-at-point)))
+ ;; move point, even if this function is called when this window is not
+ ;; visible
+ (when docid
+ ;; update all windows showing the headers buffer
+ (walk-windows
+ (lambda (win)
+ (when (eq (window-buffer win) (mu4e-get-headers-buffer))
+ (set-window-point win (point))))
+ nil t)
+ (if (eq mu4e-split-view 'single-window)
+ (when (eq (window-buffer) (mu4e-get-view-buffer))
+ (mu4e-headers-view-message))
+ ;; update message view if it was already showing
+ (when (and mu4e-split-view (window-live-p mu4e~headers-view-win))
+ (mu4e-headers-view-message)))
+ ;; attempt to highlight the new line, display the message
+ (mu4e~headers-highlight docid)
+ docid))))
(defun mu4e-headers-next (&optional n)
"Move point to the next message header.