mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
emacs: More flexible washed faces.
The faces used when washing messages should be notmuch specific and inherit from the underlying emacs face rather than using it directly. This allows the washed face to be modified without requiring the modification of the underlying face.
This commit is contained in:
parent
bd96b4c4ba
commit
092b159be7
1 changed files with 19 additions and 2 deletions
|
@ -27,6 +27,10 @@
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
(defgroup notmuch-wash nil
|
||||||
|
"Cleaning up messages for display."
|
||||||
|
:group 'notmuch)
|
||||||
|
|
||||||
(defvar notmuch-wash-signature-regexp
|
(defvar notmuch-wash-signature-regexp
|
||||||
"^\\(-- ?\\|_+\\)$"
|
"^\\(-- ?\\|_+\\)$"
|
||||||
"Pattern to match a line that separates content from signature.")
|
"Pattern to match a line that separates content from signature.")
|
||||||
|
@ -95,6 +99,19 @@ current window. If this is a number, lines will be wrapped after
|
||||||
this many characters or at the window width (whichever one is
|
this many characters or at the window width (whichever one is
|
||||||
lower).")
|
lower).")
|
||||||
|
|
||||||
|
(defface notmuch-wash-toggle-button
|
||||||
|
'((t (:inherit font-lock-comment-face)))
|
||||||
|
"Face used for buttons toggling the visibility of washed away
|
||||||
|
message parts."
|
||||||
|
:group 'notmuch-wash
|
||||||
|
:group 'notmuch-faces)
|
||||||
|
|
||||||
|
(defface notmuch-wash-cited-text
|
||||||
|
'((t (:inherit message-cited-text)))
|
||||||
|
"Face used for cited text."
|
||||||
|
:group 'notmuch-wash
|
||||||
|
:group 'notmuch-faces)
|
||||||
|
|
||||||
(defun notmuch-wash-toggle-invisible-action (cite-button)
|
(defun notmuch-wash-toggle-invisible-action (cite-button)
|
||||||
;; Toggle overlay visibility
|
;; Toggle overlay visibility
|
||||||
(let ((overlay (button-get cite-button 'overlay)))
|
(let ((overlay (button-get cite-button 'overlay)))
|
||||||
|
@ -117,7 +134,7 @@ lower).")
|
||||||
(define-button-type 'notmuch-wash-button-invisibility-toggle-type
|
(define-button-type 'notmuch-wash-button-invisibility-toggle-type
|
||||||
'action 'notmuch-wash-toggle-invisible-action
|
'action 'notmuch-wash-toggle-invisible-action
|
||||||
'follow-link t
|
'follow-link t
|
||||||
'face 'font-lock-comment-face
|
'face 'notmuch-wash-toggle-button
|
||||||
:supertype 'notmuch-button-type)
|
:supertype 'notmuch-button-type)
|
||||||
|
|
||||||
(define-button-type 'notmuch-wash-button-citation-toggle-type
|
(define-button-type 'notmuch-wash-button-citation-toggle-type
|
||||||
|
@ -192,7 +209,7 @@ that PREFIX should not include a newline."
|
||||||
(let* ((cite-start (match-beginning 0))
|
(let* ((cite-start (match-beginning 0))
|
||||||
(cite-end (match-end 0))
|
(cite-end (match-end 0))
|
||||||
(cite-lines (count-lines cite-start cite-end)))
|
(cite-lines (count-lines cite-start cite-end)))
|
||||||
(overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text)
|
(overlay-put (make-overlay cite-start cite-end) 'face 'notmuch-wash-cited-text)
|
||||||
(when (> cite-lines (+ notmuch-wash-citation-lines-prefix
|
(when (> cite-lines (+ notmuch-wash-citation-lines-prefix
|
||||||
notmuch-wash-citation-lines-suffix
|
notmuch-wash-citation-lines-suffix
|
||||||
1))
|
1))
|
||||||
|
|
Loading…
Reference in a new issue