]> git.notmuchmail.org Git - notmuch/commitdiff
Add indentation to imenu in notmuch-show
authorDamien Cassou <damien@cassou.me>
Sun, 18 Jun 2017 10:04:35 +0000 (12:04 +0200)
committerDavid Bremner <david@tethera.net>
Fri, 30 Jun 2017 11:33:29 +0000 (08:33 -0300)
emacs/notmuch-show.el

index 0f157ec56ffb1e1f506e7ba7425de8d1d884549c..a4399abb97aa07a4ff08ca125819eb716ac054ae 100644 (file)
@@ -247,6 +247,19 @@ every user interaction with notmuch."
   :type 'function
   :group 'notmuch-show)
 
+(defcustom notmuch-show-imenu-indent nil
+  "Should Imenu display messages indented.
+
+By default, Imenu (see Info node `(emacs) Imenu') in a
+notmuch-show buffer displays all messages straight.  This is
+because the default Emacs frontend for Imenu makes it difficult
+to select an Imenu entry with spaces in front.  Other imenu
+frontends such as counsel-imenu does not have this limitation.
+In these cases, Imenu entries can be indented to reflect the
+position of the message in the thread."
+  :type 'boolean
+  :group 'notmuch-show)
+
 (defmacro with-current-notmuch-show-message (&rest body)
   "Evaluate body with current buffer set to the text of current message"
   `(save-excursion
@@ -2484,7 +2497,10 @@ 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)))
+  (buffer-substring-no-properties (if notmuch-show-imenu-indent
+                                     (line-beginning-position)
+                                   (point))
+                                 (line-end-position)))
 
 (provide 'notmuch-show)