mu4e: mu4e-headers-find-if-next: move before search

when searching for the next match, go the end of the current line; when
searching for the previous match, go to the beginning of the current
line.
This commit is contained in:
djcb 2014-12-10 22:51:13 -08:00
parent faf7fc7953
commit 9162e3e68c
1 changed files with 5 additions and 3 deletions

View File

@ -1008,11 +1008,13 @@ message, you can use `mu4e-headers-find-if-next'."
(defun mu4e-headers-find-if-next (func &optional backwards)
"Like `mu4e-headers-find-if', but do not match the current header.
Move to the next header for which FUNC returns non-`nil', starting
from the current position."
Move to the next or (if BACKWARDS is non-`nil') header for which FUNC
returns non-`nil', starting from the current position."
(let ((pos))
(save-excursion
(forward-line (if backwards -1 1))
(if backwards
(beginning-of-line)
(end-of-line))
(setq pos (mu4e-headers-find-if func backwards)))
(when pos (goto-char pos))))