mu4e-thread: use mu4e-headers-(prev|next)-thread

Use the existing implementation.
This commit is contained in:
Dirk-Jan C. Binnema 2023-04-23 10:54:55 +03:00
parent b73e075c7b
commit a81b540f66
1 changed files with 12 additions and 30 deletions

View File

@ -105,41 +105,23 @@ ORIG-FUN is the original functions, taking ARGS."
(setq point (point))) (setq point (point)))
point)) point))
(defun mu4e-thread-goto-prev () (declare-function 'mu4e-headers-prev-thread "mu4e-headers")
"Go to the root of the previous thread, return nil if thread is the first." (declare-function 'mu4e-headers-next-thread "mu4e-headers")
(interactive)
(mu4e-thread-goto-root) (defalias 'mu4e-thread-goto-prev 'mu4e-headers-prev-thread)
(when-let ((point (mu4e-thread-prev))) (defalias 'mu4e-thread-goto-next 'mu4e-headers-next-thread)
(goto-char point)
point))
(defun mu4e-thread-prev () (defun mu4e-thread-prev ()
"Get the root of the previous thread (if any)." "Get the root of the previous thread (if any)."
(let ((_point)) (save-excursion
(save-excursion (when (mu4e-thread-goto-prev)
(mu4e-thread-goto-root) (mu4e-thread-root))))
(unless (eq (point-min) (point))
(forward-line -1)
(mu4e-thread-goto-root)
(point)))))
(defun mu4e-thread-goto-next () (defun mu4e-thread-next()
"Go to the root of the next thread.
Return t if there was a next thread, nil otherwise."
(interactive)
(when-let ((point (mu4e-thread-next)))
(goto-char point)))
(defun mu4e-thread-next ()
"Get the root of the next thread (if any)." "Get the root of the next thread (if any)."
(let ((point)) (save-excursion
(save-excursion (when (mu4e-thread-goto-next)
(forward-line +1) (mu4e-thread-root))))
(while (and (not (eobp))
(not (mu4e-thread-is-root)))
(forward-line +1))
(setq point (point))
point)))
(defun mu4e-thread-is-folded () (defun mu4e-thread-is-folded ()
"Test if thread at point is folded." "Test if thread at point is folded."