X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=0f157ec56ffb1e1f506e7ba7425de8d1d884549c;hp=e7c22da0f54c35f128b70721128dbe6c87393b26;hb=a83ab29930161d999ad1c45b6eb9cfbaa5e90ceb;hpb=1ec634461ea25d87cc16dbeb1318f8e30a07c9f1 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index e7c22da0..0f157ec5 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1516,7 +1516,11 @@ All currently available key bindings: \\{notmuch-show-mode-map}" (setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view) (setq buffer-read-only t - truncate-lines t)) + truncate-lines t) + (setq imenu-prev-index-position-function + #'notmuch-show-imenu-prev-index-position-function) + (setq imenu-extract-index-name-function + #'notmuch-show-imenu-extract-index-name-function)) (defun notmuch-tree-from-show-current-query () "Call notmuch tree with the current query" @@ -2465,6 +2469,23 @@ the new buffer." (mailcap-mime-types) nil nil nil nil "text/plain"))) (notmuch-show-apply-to-current-part-handle #'notmuch-show--mm-display-part mime-type)) +(defun notmuch-show-imenu-prev-index-position-function () + "Move point to previous message in notmuch-show buffer. +This function is used as a value for +`imenu-prev-index-position-function'." + (if (bobp) + nil + (notmuch-show-previous-message) + t)) + +(defun notmuch-show-imenu-extract-index-name-function () + "Return imenu name for line at point. +This function is used as a value for +`imenu-extract-index-name-function'. Point should be at the +beginning of the line." + (back-to-indentation) + (buffer-substring-no-properties (point) (line-end-position))) + (provide 'notmuch-show) ;;; notmuch-show.el ends here