From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>
To: notmuch@notmuchmail.org
Subject: lots of emacs mode enhancements
Date: Fri, 20 Nov 2009 00:26:33 -0800 [thread overview]
Message-ID: <86ws1lioue.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> (raw)
I've just been diving into the elisp, and have added a bunch of useful
features.
1) buttonized citation and signature expanders and made them locally
collapsable instead of globally (this could take some cleanup to remove
the global key-map binding or make it work again)
2) fixed an annoying warning about cons not being a face name
3) made header names bold to make it easier to distingush them from
their value
My next target is to carry the buttonization through to threads and
headers, and then I'm going to look into doing better mime-handling in
general.
also, RFP includes a -p argument that gives a patch :)
alex
----
The following changes since commit 9b560fb3eb87b2a4f9d092bc1b124ccb6d11c975:
Alexander Botero-Lowry (1):
Checkin some command-only tcsh completions
are available in the git repository at:
git://alexbl.net/notmuch.git master
Alexander Botero-Lowry (5):
Buttonize citation expander.
buttonize signatures as well
fix the message about cons not being a valid face attribute
Make expanding/collapsing signatures and citations local to them
make header names bold in show-mode
notmuch.el | 72 +++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/notmuch.el b/notmuch.el
index 1fc54c3..bb69aa3 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -440,6 +440,14 @@ which this thread was originally shown."
(if last
(notmuch-show-archive-thread))))))
+(defun notmuch-toggle-invisible-action (cite-button)
+ (let ((invis-spec (button-get button 'invisibility-spec)))
+ (if (invisible-p invis-spec)
+ (remove-from-invisibility-spec invis-spec)
+ (add-to-invisibility-spec invis-spec)
+ ))
+ (goto-char (button-end cite-button)))
+
(defun notmuch-show-markup-citations-region (beg end depth)
(goto-char beg)
(beginning-of-line)
@@ -451,25 +459,51 @@ which this thread was originally shown."
(progn
(while (looking-at citation)
(forward-line))
- (let ((overlay (make-overlay beg-sub (point))))
- (overlay-put overlay 'invisible 'notmuch-show-citation)
- (overlay-put overlay 'before-string
- (concat indent
- "[" (number-to-string (count-lines beg-sub (point)))
- "-line citation. Press 'c' to show.]\n")))))
+ (let ((overlay (make-overlay beg-sub (point)))
+ (invis-spec (make-symbol "notmuch-citation-region")))
+ (add-to-invisibility-spec invis-spec)
+ (overlay-put overlay 'invisible invis-spec)
+ (let (
+ (p (point))
+ (cite-button-text
+ (concat "[" (number-to-string (count-lines beg-sub (point)))
+ "-line citation.]"))
+ )
+ (goto-char (- beg-sub 1))
+ (insert (concat "\n" indent))
+ (let ((cite-button (insert-button cite-button-text)))
+ (button-put cite-button 'invisibility-spec invis-spec)
+ (button-put cite-button 'action 'notmuch-toggle-invisible-action)
+ (button-put cite-button 'help-echo
+ "mouse-2, RET: Show citation")
+
+ )
+ (insert "\n")
+ (goto-char (+ (length cite-button-text) p))
+ ))))
(move-to-column depth)
(if (looking-at notmuch-show-signature-regexp)
(let ((sig-lines (- (count-lines beg-sub end) 1)))
(if (<= sig-lines notmuch-show-signature-lines-max)
(progn
- (overlay-put (make-overlay beg-sub end)
- 'invisible 'notmuch-show-signature)
- (overlay-put (make-overlay beg (- beg-sub 1))
- 'after-string
- (concat "\n" indent
- "[" (number-to-string sig-lines)
- "-line signature. Press 's' to show.]"))
- (goto-char end)))))
+ (let ((invis-spec (make-symbol "notmuch-signature-region")))
+ (add-to-invisibility-spec invis-spec)
+ (overlay-put (make-overlay beg-sub end)
+ 'invisible invis-spec)
+
+ (goto-char (- beg-sub 1))
+ (insert (concat "\n" indent))
+ (let ((sig-button (insert-button
+ (concat "[" (number-to-string sig-lines)
+ "-line signature.]"))))
+ (button-put sig-button 'invisibility-spec invis-spec)
+ (button-put sig-button 'action
+ 'notmuch-toggle-invisible-action)
+ (button-put sig-button 'help-echo
+ "mouse-2, RET: Show signature")
+ )
+ (insert "\n")
+ (goto-char end))))))
(forward-line))))
(defun notmuch-show-markup-part (beg end depth)
@@ -516,12 +550,20 @@ which this thread was originally shown."
(let ((beg (point-marker)))
(end-of-line)
; Inverse video for subject
- (overlay-put (make-overlay beg (point)) 'face '((cons :inverse-video t)))
+ (overlay-put (make-overlay beg (point)) 'face '(:inverse-video t))
(forward-line 2)
(let ((beg-hidden (point-marker)))
(re-search-forward notmuch-show-header-end-regexp)
(beginning-of-line)
(let ((end (point-marker)))
+ (goto-char beg)
+ (forward-line)
+ (while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
+ (beginning-of-line)
+ (overlay-put (make-overlay (point) (re-search-forward ":"))
+ 'face 'bold)
+ (forward-line)
+ )
(indent-rigidly beg end depth)
(overlay-put (make-overlay beg-hidden end)
'invisible 'notmuch-show-header)
next reply other threads:[~2009-11-20 8:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 8:26 Alexander Botero-Lowry [this message]
2009-11-22 23:11 ` lots of emacs mode enhancements Carl Worth
2009-11-22 23:53 ` Carl Worth
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=86ws1lioue.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me \
--to=alex.boterolowry@gmail.com \
--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).