* mm updates (add '(:found <n>)' handling)
This commit is contained in:
@ -168,8 +168,24 @@ if provided, or at the end of the buffer otherwise."
|
|||||||
(propertize line 'face 'mm/unread-face))
|
(propertize line 'face 'mm/unread-face))
|
||||||
(t ;; else
|
(t ;; else
|
||||||
(propertize line 'face 'mm/header-face)))))
|
(propertize line 'face 'mm/header-face)))))
|
||||||
(mm/hdrs-add-header line (plist-get msg :docid)
|
(mm/hdrs-add-header line (plist-get msg :docid)
|
||||||
(if point point (point-max)))))
|
(if point point (point-max)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun mm/hdrs-found-handler (count)
|
||||||
|
"Create a one line description of the number of headers found
|
||||||
|
after the end of the search results."
|
||||||
|
(with-current-buffer mm/hdrs-buffer
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-max))
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(insert (propertize
|
||||||
|
(case count
|
||||||
|
(0 "No matching messages found")
|
||||||
|
(1 "Found 1 message")
|
||||||
|
(otherwise (format "Found %d messages" count)))
|
||||||
|
'face 'mm/system-face 'intangible t))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
@ -188,25 +204,25 @@ if provided, or at the end of the buffer otherwise."
|
|||||||
(define-key map "q" 'mm/quit-buffer)
|
(define-key map "q" 'mm/quit-buffer)
|
||||||
;; (define-key map "o" 'mm/change-sort)
|
;; (define-key map "o" 'mm/change-sort)
|
||||||
(define-key map "g" 'mm/rerun-search)
|
(define-key map "g" 'mm/rerun-search)
|
||||||
|
|
||||||
;; navigation
|
;; navigation
|
||||||
(define-key map "n" 'mm/next-header)
|
(define-key map "n" 'mm/next-header)
|
||||||
(define-key map "p" 'mm/prev-header)
|
(define-key map "p" 'mm/prev-header)
|
||||||
(define-key map "j" 'mm/jump-to-maildir)
|
(define-key map "j" 'mm/jump-to-maildir)
|
||||||
|
|
||||||
;; marking/unmarking/executing
|
;; marking/unmarking/executing
|
||||||
(define-key map "m" 'mm/mark-for-move)
|
(define-key map "m" 'mm/mark-for-move)
|
||||||
|
|
||||||
(define-key map (kbd "<backspace>") 'mm/mark-for-trash)
|
(define-key map (kbd "<backspace>") 'mm/mark-for-trash)
|
||||||
(define-key map "d" 'mm/mark-for-trash)
|
(define-key map "d" 'mm/mark-for-trash)
|
||||||
|
|
||||||
(define-key map (kbd "<delete>") 'mm/mark-for-delete)
|
(define-key map (kbd "<delete>") 'mm/mark-for-delete)
|
||||||
(define-key map "D" 'mm/mark-for-delete)
|
(define-key map "D" 'mm/mark-for-delete)
|
||||||
|
|
||||||
(define-key map "u" 'mm/unmark)
|
(define-key map "u" 'mm/unmark)
|
||||||
(define-key map "U" 'mm/unmark-all)
|
(define-key map "U" 'mm/unmark-all)
|
||||||
(define-key map "x" 'mm/execute-marks)
|
(define-key map "x" 'mm/execute-marks)
|
||||||
|
|
||||||
;; message composition
|
;; message composition
|
||||||
(define-key map "r" 'mm/compose-reply)
|
(define-key map "r" 'mm/compose-reply)
|
||||||
(define-key map "f" 'mm/compose-forward)
|
(define-key map "f" 'mm/compose-forward)
|
||||||
@ -240,12 +256,12 @@ if provided, or at the end of the buffer otherwise."
|
|||||||
(define-key menumap [search] '("Search" . mm/search))
|
(define-key menumap [search] '("Search" . mm/search))
|
||||||
(define-key menumap [jump] '("Jump to maildir" . mm/jump-to-maildir))
|
(define-key menumap [jump] '("Jump to maildir" . mm/jump-to-maildir))
|
||||||
(define-key menumap [sepa3] '("--"))
|
(define-key menumap [sepa3] '("--"))
|
||||||
|
|
||||||
(define-key menumap [view] '("View" . mm/view-message))
|
(define-key menumap [view] '("View" . mm/view-message))
|
||||||
(define-key menumap [next] '("Next" . mm/next-header))
|
(define-key menumap [next] '("Next" . mm/next-header))
|
||||||
(define-key menumap [previous] '("Previous" . mm/prev-header))
|
(define-key menumap [previous] '("Previous" . mm/prev-header))
|
||||||
(define-key menumap [sepa4] '("--")))
|
(define-key menumap [sepa4] '("--")))
|
||||||
|
|
||||||
;;(define-key menumap [draft] '("Edit draft" . mm/compose-new))
|
;;(define-key menumap [draft] '("Edit draft" . mm/compose-new))
|
||||||
map)))
|
map)))
|
||||||
|
|
||||||
@ -268,6 +284,7 @@ if provided, or at the end of the buffer otherwise."
|
|||||||
(setq mm/proc-error-func 'mm/hdrs-error-handler)
|
(setq mm/proc-error-func 'mm/hdrs-error-handler)
|
||||||
(setq mm/proc-update-func 'mm/hdrs-update-handler)
|
(setq mm/proc-update-func 'mm/hdrs-update-handler)
|
||||||
(setq mm/proc-header-func 'mm/hdrs-header-handler)
|
(setq mm/proc-header-func 'mm/hdrs-header-handler)
|
||||||
|
(setq mm/proc-found-func 'mm/hdrs-found-handler)
|
||||||
(setq mm/proc-view-func 'mm/hdrs-view-handler)
|
(setq mm/proc-view-func 'mm/hdrs-view-handler)
|
||||||
(setq mm/proc-remove-func 'mm/hdrs-remove-handler)
|
(setq mm/proc-remove-func 'mm/hdrs-remove-handler)
|
||||||
;; this last one is defined in mm-send.el
|
;; this last one is defined in mm-send.el
|
||||||
|
|||||||
@ -61,6 +61,12 @@ format.")
|
|||||||
server process; the function is passed a msg plist as argument. See
|
server process; the function is passed a msg plist as argument. See
|
||||||
`mm/proc-filter' for the format.")
|
`mm/proc-filter' for the format.")
|
||||||
|
|
||||||
|
(defvar mm/proc-found-func nil
|
||||||
|
"*internal* A function called for when we received a :found sexp
|
||||||
|
after the headers have returns, to report on the number of
|
||||||
|
matches. See `mm/proc-filter' for the format.")
|
||||||
|
|
||||||
|
|
||||||
(defvar mm/proc-compose-func nil
|
(defvar mm/proc-compose-func nil
|
||||||
"*internal* A function called for each message returned from the
|
"*internal* A function called for each message returned from the
|
||||||
server process that is used as basis for composing a new
|
server process that is used as basis for composing a new
|
||||||
@ -178,7 +184,7 @@ updated as well, with all processed sexp data removed."
|
|||||||
;; eox
|
;; eox
|
||||||
=> this will be passed to `mm/proc-error-func'.
|
=> this will be passed to `mm/proc-error-func'.
|
||||||
|
|
||||||
2. a message sexp looks something like:
|
2a. a message sexp looks something like:
|
||||||
\(
|
\(
|
||||||
:docid 1585
|
:docid 1585
|
||||||
:from ((\"Donald Duck\" . \"donald@example.com\"))
|
:from ((\"Donald Duck\" . \"donald@example.com\"))
|
||||||
@ -199,6 +205,11 @@ updated as well, with all processed sexp data removed."
|
|||||||
;; eox
|
;; eox
|
||||||
=> this will be passed to `mm/proc-header-func'.
|
=> this will be passed to `mm/proc-header-func'.
|
||||||
|
|
||||||
|
2b. After the list of message sexps has been returned (see 2a.),
|
||||||
|
we'll receive a sexp that looks like
|
||||||
|
(:found <n>) with n the number of messages found. The <n> will be
|
||||||
|
passed to `mm/proc-found-func'.
|
||||||
|
|
||||||
3. a view looks like:
|
3. a view looks like:
|
||||||
(:view <msg-sexp>)
|
(:view <msg-sexp>)
|
||||||
=> the <msg-sexp> (see 2.) will be passed to `mm/proc-view-func'.
|
=> the <msg-sexp> (see 2.) will be passed to `mm/proc-view-func'.
|
||||||
@ -227,6 +238,12 @@ updated as well, with all processed sexp data removed."
|
|||||||
;; a header plist can be recognized by the existence of a :date field
|
;; a header plist can be recognized by the existence of a :date field
|
||||||
((plist-get sexp :date)
|
((plist-get sexp :date)
|
||||||
(funcall mm/proc-header-func sexp))
|
(funcall mm/proc-header-func sexp))
|
||||||
|
|
||||||
|
;; the found sexp, we receive after gett all the headers
|
||||||
|
((plist-get sexp :found)
|
||||||
|
(funcall mm/proc-found-func (plist-get sexp :found)))
|
||||||
|
|
||||||
|
;; viewin a specific message
|
||||||
((plist-get sexp :view)
|
((plist-get sexp :view)
|
||||||
(funcall mm/proc-view-func (plist-get sexp :view)))
|
(funcall mm/proc-view-func (plist-get sexp :view)))
|
||||||
|
|
||||||
|
|||||||
@ -254,6 +254,13 @@ flag set)."
|
|||||||
:group 'mm/faces)
|
:group 'mm/faces)
|
||||||
|
|
||||||
|
|
||||||
|
(defface mm/system-face
|
||||||
|
'((t :inherit font-lock-comment-face :slant italic))
|
||||||
|
"Face for system message (such as the footers for message
|
||||||
|
headers)."
|
||||||
|
:group 'mm/faces)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; internal variables / constant
|
;; internal variables / constant
|
||||||
|
|||||||
Reference in New Issue
Block a user