mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 21:54:10 +01:00
emacs: Make message-summary button extend to very beginning of message.
There's no visible change here---we're just making the button extend through the invisible portions of the message before the message-summary line. The reason this is important is that it's easy for the user to position point at the (invisible) `point-min', so we want to ensure that there's a valid button there.
This commit is contained in:
parent
8e126fe1fb
commit
11490cfebe
1 changed files with 15 additions and 4 deletions
19
notmuch.el
19
notmuch.el
|
@ -729,7 +729,18 @@ which this thread was originally shown."
|
||||||
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
|
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
|
||||||
'face 'message-header-other)))))))
|
'face 'message-header-other)))))))
|
||||||
|
|
||||||
(defun notmuch-show-markup-header (depth)
|
(defun notmuch-show-markup-header (message-begin depth)
|
||||||
|
"Buttonize and decorate faces in a message header.
|
||||||
|
|
||||||
|
MESSAGE-BEGIN is the position of the absolute first character in
|
||||||
|
the message (including all delimiters that will end up being
|
||||||
|
invisible etc.). This is to allow a button to reliably extend to
|
||||||
|
the beginning of the message even if point is positioned at an
|
||||||
|
invisible character (such as the beginning of the buffer).
|
||||||
|
|
||||||
|
DEPTH specifies the depth at which this message appears in the
|
||||||
|
tree of the current thread, (the top-level messages have depth 0
|
||||||
|
and each reply increases depth by 1)."
|
||||||
(re-search-forward notmuch-show-header-begin-regexp)
|
(re-search-forward notmuch-show-header-begin-regexp)
|
||||||
(forward-line)
|
(forward-line)
|
||||||
(let ((beg (point-marker))
|
(let ((beg (point-marker))
|
||||||
|
@ -742,7 +753,7 @@ which this thread was originally shown."
|
||||||
(let ((end (point-marker)))
|
(let ((end (point-marker)))
|
||||||
(indent-rigidly beg end depth)
|
(indent-rigidly beg end depth)
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(setq btn (make-button (line-beginning-position) summary-end :type 'notmuch-button-body-toggle-type))
|
(setq btn (make-button message-begin summary-end :type 'notmuch-button-body-toggle-type))
|
||||||
(forward-line)
|
(forward-line)
|
||||||
(add-to-invisibility-spec invis-spec)
|
(add-to-invisibility-spec invis-spec)
|
||||||
(overlay-put (make-overlay subject-end end)
|
(overlay-put (make-overlay subject-end end)
|
||||||
|
@ -766,11 +777,11 @@ which this thread was originally shown."
|
||||||
|
|
||||||
(defun notmuch-show-markup-message ()
|
(defun notmuch-show-markup-message ()
|
||||||
(if (re-search-forward notmuch-show-message-begin-regexp nil t)
|
(if (re-search-forward notmuch-show-message-begin-regexp nil t)
|
||||||
(progn
|
(let ((message-begin (match-beginning 0)))
|
||||||
(re-search-forward notmuch-show-depth-regexp)
|
(re-search-forward notmuch-show-depth-regexp)
|
||||||
(let ((depth (string-to-number (buffer-substring (match-beginning 1) (match-end 1))))
|
(let ((depth (string-to-number (buffer-substring (match-beginning 1) (match-end 1))))
|
||||||
(btn nil))
|
(btn nil))
|
||||||
(setq btn (notmuch-show-markup-header depth))
|
(setq btn (notmuch-show-markup-header message-begin depth))
|
||||||
(notmuch-show-markup-body depth btn)))
|
(notmuch-show-markup-body depth btn)))
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue