unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: notmuch@notmuchmail.org
Cc: Damien Cassou <damien@cassou.me>
Subject: [PATCH] Add indentation to imenu in notmuch-show
Date: Sun, 18 Jun 2017 12:04:35 +0200	[thread overview]
Message-ID: <20170618100435.7052-1-damien@cassou.me> (raw)

---
 emacs/notmuch-show.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0f157ec..a4399ab 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -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)
 
-- 
2.9.4

             reply	other threads:[~2017-06-18 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 10:04 Damien Cassou [this message]
2017-06-30 11:53 ` [PATCH] Add indentation to imenu in notmuch-show David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170618100435.7052-1-damien@cassou.me \
    --to=damien@cassou.me \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).