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)
|
||||
"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,
|
||||
return nil.
|
||||
|
||||
If pointing at a message after the move and there is a
|
||||
view-window, open the message unless
|
||||
`mu4e-headers-open-after-move' is non-nil."
|
||||
(unless (eq major-mode 'mu4e-headers-mode)
|
||||
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
|
||||
(cl-flet ((goto-next-line
|
||||
(arg)
|
||||
(condition-case _err
|
||||
(prog1
|
||||
(cl-assert (eq major-mode 'mu4e-headers-mode))
|
||||
(when (ignore-errors
|
||||
(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
|
||||
;; the end of another invisible overlay covering
|
||||
;; previous EOL.
|
||||
(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
|
||||
(move-to-column 2)
|
||||
;; update all windows showing the headers buffer
|
||||
(walk-windows
|
||||
(lambda (win)
|
||||
|
@ -1467,9 +1462,7 @@ view-window, open the message unless
|
|||
(mu4e-headers-view-message))
|
||||
;; attempt to highlight the new line, display the message
|
||||
(mu4e~headers-highlight docid)
|
||||
(if succeeded
|
||||
docid
|
||||
nil)))))
|
||||
docid)))))
|
||||
|
||||
(defun mu4e-headers-next (&optional n)
|
||||
"Move point to the next message header.
|
||||
|
|
Loading…
Reference in New Issue