* mu4e-hdrs.el: cleanup the handling of the mark fringe
This commit is contained in:
@ -98,15 +98,24 @@ are of the form:
|
|||||||
|
|
||||||
|
|
||||||
;;;; internal variables/constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;; internal variables/constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defconst mu4e~hdrs-fringe " " "*internal* The space on the left of
|
|
||||||
message headers to put marks.")
|
|
||||||
|
|
||||||
|
;; the fringe is the space on the left of headers, where we put marks below some
|
||||||
|
;; handy definitions; only `mu4e-hdrs-fringe-len' should be change (if ever),
|
||||||
|
;; the others follow from that.
|
||||||
|
(defconst mu4e~hdrs-fringe-len 2
|
||||||
|
"Width of the fringe for marks on the left.")
|
||||||
|
(defconst mu4e~hdrs-fringe (make-string mu4e~hdrs-fringe-len ?\s)
|
||||||
|
"The space on the left of message headers to put marks.")
|
||||||
|
(defconst mu4e~hdrs-fringe-format (format "%%-%ds" mu4e~hdrs-fringe-len)
|
||||||
|
"Format string to set a mark and leave remaining space.")
|
||||||
|
|
||||||
|
;; docid cookies
|
||||||
(defconst mu4e~docid-pre "\376"
|
(defconst mu4e~docid-pre "\376"
|
||||||
"Each header starts (invisibly) with the `mu4e-docid-pre',
|
"Each header starts (invisibly) with the `mu4e-docid-pre',
|
||||||
followed by the docid, followd by `mu4e-docid-post'.")
|
followed by the docid, followed by `mu4e-docid-post'.")
|
||||||
(defconst mu4e~docid-post "\377"
|
(defconst mu4e~docid-post "\377"
|
||||||
"Each header starts (invisibly) with the `mu4e-docid-pre',
|
"Each header starts (invisibly) with the `mu4e-docid-pre',
|
||||||
followed by the docid, followd by `mu4e-docid-post'.")
|
followed by the docid, followed by `mu4e-docid-post'.")
|
||||||
|
|
||||||
(defun mu4e~hdrs-clear ()
|
(defun mu4e~hdrs-clear ()
|
||||||
"Clear the header buffer and related data structures."
|
"Clear the header buffer and related data structures."
|
||||||
@ -454,7 +463,7 @@ after the end of the search results."
|
|||||||
(setq header-line-format
|
(setq header-line-format
|
||||||
(cons
|
(cons
|
||||||
(make-string
|
(make-string
|
||||||
(+ (length mu4e~hdrs-fringe) (floor (fringe-columns 'left t))) ?\s)
|
(+ mu4e~hdrs-fringe-len (floor (fringe-columns 'left t))) ?\s)
|
||||||
(map 'list
|
(map 'list
|
||||||
(lambda (item)
|
(lambda (item)
|
||||||
(let ((field (cdr (assoc (car item) mu4e-header-names)))
|
(let ((field (cdr (assoc (car item) mu4e-header-names)))
|
||||||
@ -561,12 +570,16 @@ with DOCID which must be present in the headers buffer."
|
|||||||
;; (which is invisible). jump past that…
|
;; (which is invisible). jump past that…
|
||||||
(unless (re-search-forward mu4e~docid-post nil t)
|
(unless (re-search-forward mu4e~docid-post nil t)
|
||||||
(error "Cannot find the `mu4e~docid-post' separator"))
|
(error "Cannot find the `mu4e~docid-post' separator"))
|
||||||
;; we found the separator we move point one to the right for the
|
|
||||||
;; the area to write the marker.
|
|
||||||
;;(forward-char)
|
|
||||||
;; clear old marks, and add the new ones.
|
;; clear old marks, and add the new ones.
|
||||||
(delete-char (length mu4e~hdrs-fringe))
|
(let ((msg (get-text-property (point) 'msg)))
|
||||||
(insert (propertize mark 'face 'mu4e-hdrs-marks-face) " ") ;; FIXME
|
(delete-char mu4e~hdrs-fringe-len)
|
||||||
|
(insert (propertize
|
||||||
|
(format mu4e~hdrs-fringe-format mark)
|
||||||
|
'face 'mu4e-header-marks-face
|
||||||
|
'docid docid
|
||||||
|
'msg msg)))
|
||||||
|
|
||||||
(goto-char oldpoint))))
|
(goto-char oldpoint))))
|
||||||
|
|
||||||
|
|
||||||
@ -584,7 +597,9 @@ at (point-max) otherwise. If MSG is not nil, add it as the text-property `msg'."
|
|||||||
(propertize
|
(propertize
|
||||||
(concat
|
(concat
|
||||||
(mu4e~docid-cookie docid)
|
(mu4e~docid-cookie docid)
|
||||||
mu4e~hdrs-fringe str "\n") 'docid docid 'msg msg)))))))
|
mu4e~hdrs-fringe
|
||||||
|
str "\n")
|
||||||
|
'docid docid 'msg msg)))))))
|
||||||
|
|
||||||
(defun mu4e~hdrs-remove-header (docid &optional ignore-missing)
|
(defun mu4e~hdrs-remove-header (docid &optional ignore-missing)
|
||||||
"Remove header with DOCID at POINT; when IGNORE-MISSING is
|
"Remove header with DOCID at POINT; when IGNORE-MISSING is
|
||||||
|
|||||||
Reference in New Issue
Block a user