mirror of https://github.com/djcb/mu.git
mu4e-headers: mu4e~headers-move: consider folded headers
Ensure going backwards over folded headers works.
This commit is contained in:
parent
9544473e35
commit
f02f1c282c
|
@ -1425,32 +1425,27 @@ This variable is for let-binding when scripting.")
|
||||||
|
|
||||||
(defun mu4e~headers-move (lines)
|
(defun mu4e~headers-move (lines)
|
||||||
"Move point LINES lines.
|
"Move point LINES lines.
|
||||||
Move foward if LINES is positive or backwards if LINES is
|
Move forward if LINES is positive or backwards if LINES is
|
||||||
negative. If this succeeds, return the new docid. Otherwise,
|
negative. If this succeeds, return the new docid. Otherwise,
|
||||||
return nil.
|
return nil.
|
||||||
|
|
||||||
If pointing at a message after the move and there is a
|
If pointing at a message after the move and there is a
|
||||||
view-window, open the message unless
|
view-window, open the message unless
|
||||||
`mu4e-headers-open-after-move' is non-nil."
|
`mu4e-headers-open-after-move' is non-nil."
|
||||||
(unless (eq major-mode 'mu4e-headers-mode)
|
(cl-assert (eq major-mode 'mu4e-headers-mode))
|
||||||
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
|
(when (ignore-errors
|
||||||
(cl-flet ((goto-next-line
|
|
||||||
(arg)
|
|
||||||
(condition-case _err
|
|
||||||
(prog1
|
|
||||||
(let (line-move-visual)
|
(let (line-move-visual)
|
||||||
(and (line-move arg) 0))
|
(line-move lines)
|
||||||
|
t))
|
||||||
|
(let* ((docid (mu4e~headers-docid-at-point))
|
||||||
|
(folded (and docid (mu4e-thread-message-folded-p))))
|
||||||
|
(if folded
|
||||||
|
(mu4e~headers-move (if (< lines 0) -1 1)) ;; skip folded
|
||||||
|
(when docid
|
||||||
;; 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)
|
|
||||||
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
|
;; update all windows showing the headers buffer
|
||||||
(walk-windows
|
(walk-windows
|
||||||
(lambda (win)
|
(lambda (win)
|
||||||
|
@ -1467,9 +1462,7 @@ view-window, open the message unless
|
||||||
(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)
|
||||||
(if succeeded
|
docid)))))
|
||||||
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.
|
||||||
|
|
Loading…
Reference in New Issue