* move fringe stuff, headers-leave-behavior to mu4e-mark.el, as it's needed

there

  - there was a circular dependency with mu4e-hdrs, now solved by this move
This commit is contained in:
djcb 2012-04-30 17:36:38 +03:00
parent 131e1c9b51
commit fd48ca002c
2 changed files with 30 additions and 27 deletions

View File

@ -60,17 +60,6 @@
:type 'string
:group 'mu4e-headers)
(defcustom mu4e-headers-leave-behavior 'ask
"What to do when user leaves the headers view (e.g. quits,
refreshes or does a new search). Value is one of the following
symbols:
- ask (ask the user whether to ignore the marks)
- apply (automatically apply the marks before doing anything else)
- ignore (automatically ignore the marks without asking)."
:type 'symbol
:group 'mu4e-headers)
(defcustom mu4e-headers-visible-lines 10
"Number of lines to display in the header view when using the
horizontal split-view. This includes the header-line at the top,
@ -100,15 +89,6 @@ are of the form:
;;;; internal variables/constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e~hdrs-query nil "The most recent search expression.")
;; 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"
@ -463,7 +443,7 @@ after the end of the search results."
(setq header-line-format
(cons
(make-string
(+ mu4e~hdrs-fringe-len (floor (fringe-columns 'left t))) ?\s)
(+ mu4e~mark-fringe-len (floor (fringe-columns 'left t))) ?\s)
(map 'list
(lambda (item)
(let ((field (cdr (assoc (car item) mu4e-header-names)))
@ -573,13 +553,12 @@ with DOCID which must be present in the headers buffer."
;; clear old marks, and add the new ones.
(let ((msg (get-text-property (point) 'msg)))
(delete-char mu4e~hdrs-fringe-len)
(delete-char mu4e~mark-fringe-len)
(insert (propertize
(format mu4e~hdrs-fringe-format mark)
(format mu4e~mark-fringe-format mark)
'face 'mu4e-header-marks-face
'docid docid
'msg msg)))
(goto-char oldpoint))))
@ -597,7 +576,7 @@ at (point-max) otherwise. If MSG is not nil, add it as the text-property `msg'."
(propertize
(concat
(mu4e~docid-cookie docid)
mu4e~hdrs-fringe
mu4e~mark-fringe
str "\n")
'docid docid 'msg msg)))))))

View File

@ -29,6 +29,17 @@
(require 'mu4e-proc)
(require 'mu4e-utils)
(defcustom mu4e-headers-leave-behavior 'ask
"What to do when user leaves the headers view (e.g. quits,
refreshes or does a new search). Value is one of the following
symbols:
- ask (ask the user whether to ignore the marks)
- apply (automatically apply the marks before doing anything else)
- ignore (automatically ignore the marks without asking)."
:type 'symbol
:group 'mu4e-headers)
;;; marks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e~mark-map nil
"Map (hash) of docid->markinfo; when a message is marked, the
@ -44,6 +55,19 @@ where
;; currently, there can't be more than one, but we never know what will
;; happen in the future
;; the fringe is the space on the left of headers, where we put marks below some
;; handy definitions; only `mu4e-mark-fringe-len' should be change (if ever),
;; the others follow from that.
(defconst mu4e~mark-fringe-len 2
"Width of the fringe for marks on the left.")
(defconst mu4e~mark-fringe (make-string mu4e~mark-fringe-len ?\s)
"The space on the left of message headers to put marks.")
(defconst mu4e~mark-fringe-format (format "%%-%ds" mu4e~mark-fringe-len)
"Format string to set a mark and leave remaining space.")
(defun mu4e~mark-initialize ()
"Initialize the marks subsystem."
@ -100,8 +124,8 @@ The following marks are available, and the corresponding props:
(let* ((targetstr (propertize (concat "-> " target " ")
'face 'mu4e-system-face))
;; mu4e-goto-docid docid t \will take us just after the
;; docid cookie and then we skip the mu4e~hdrs-fringe
(start (+ (length mu4e~hdrs-fringe)
;; docid cookie and then we skip the mu4e~mark-fringe
(start (+ (length mu4e~mark-fringe)
(mu4e~goto-docid docid t)))
(overlay (make-overlay start (+ start (length targetstr)))))
(overlay-put overlay 'display targetstr)