mu4e-thread: share mu4e-headers-thread-root-p with threads

Add mu4e-headers-thread-rootp which follows the mu4e-threads definition;
and use it in both mu4e-headers and mu4e-threads
This commit is contained in:
Dirk-Jan C. Binnema
2023-04-23 10:47:16 +03:00
parent d8817c1b74
commit b73e075c7b
2 changed files with 26 additions and 23 deletions

View File

@ -85,15 +85,8 @@ ORIG-FUN is the original functions, taking ARGS."
(mu4e-warn "Cannot mark when folded")
(apply orig-fun args)))
(defun mu4e-thread-is-root ()
"Test if message at point is the root of the current thread."
(when-let* ((msg (get-text-property (point) 'msg))
(meta (mu4e-message-field msg :meta)))
(let* ((orphan (plist-get meta :orphan))
(first-child (plist-get meta :first-child))
(root (plist-get meta :root)))
(or root (and orphan first-child)))))
(declare-function 'mu4e~headers-thread-root-p "mu4e-headers")
(defalias 'mu4e-thread-is-root 'mu4e~headers-thread-root-p)
(defun mu4e-thread-goto-root ()
"Go to the root of the current thread."