mirror of https://github.com/djcb/mu.git
* mu4e: improve the address autocompletion and its documentation
This commit is contained in:
parent
ef17c2f731
commit
b1449376b4
|
@ -446,15 +446,15 @@ mean:
|
||||||
response."
|
response."
|
||||||
(mu4e~proc-send-command "ping"))
|
(mu4e~proc-send-command "ping"))
|
||||||
|
|
||||||
(defun mu4e~proc-contacts (only-personal newer-than)
|
(defun mu4e~proc-contacts (personal after)
|
||||||
"Sends the contacts command to the mu server, expecting
|
"Sends the contacts command to the mu server, expecting
|
||||||
a (:contacts (<list>)) in response. If ONLY-PERSONAL is non-nil,
|
a (:contacts (<list>)) in response. If PERSONAL is non-nil, only
|
||||||
only get personal contacts, if newer-than is non-nil, get only
|
get personal contacts, if AFTER is non-nil, get only contacts
|
||||||
contacts seen after NEWER-THAN (the time_t value)."
|
seen AFTER (the time_t value)."
|
||||||
(mu4e~proc-send-command
|
(mu4e~proc-send-command
|
||||||
"contacts only-personal:%s newer-than:%d"
|
"contacts personal:%s after:%d"
|
||||||
(if only-personal "true" "false")
|
(if personal "true" "false")
|
||||||
(if newer-than newer-than 0)))
|
(or after 0)))
|
||||||
|
|
||||||
(defun mu4e~proc-view (docid-or-msgid &optional images)
|
(defun mu4e~proc-view (docid-or-msgid &optional images)
|
||||||
"Get one particular message based on its DOCID-OR-MSGID (keyword
|
"Get one particular message based on its DOCID-OR-MSGID (keyword
|
||||||
|
|
|
@ -554,13 +554,16 @@ This is used by the completion function in mu4e-compose."
|
||||||
(mail (plist-get contact :mail)))
|
(mail (plist-get contact :mail)))
|
||||||
;;(message "N:%S M:%S" name mail)
|
;;(message "N:%S M:%S" name mail)
|
||||||
(when mail
|
(when mail
|
||||||
|
(unless ;; ignore some address ('noreply' etc.)
|
||||||
|
(and mu4e-compose-complete-ignore-address-regexp
|
||||||
|
(string-match mu4e-compose-complete-ignore-address-regexp mail))
|
||||||
(add-to-list 'lst
|
(add-to-list 'lst
|
||||||
(if name
|
(if name
|
||||||
(format "%s <%s>" name mail)
|
(format "%s <%s>" name mail)
|
||||||
mail)))))
|
mail)))))
|
||||||
(setq mu4e~contacts-for-completion lst)
|
(setq mu4e~contacts-for-completion lst)
|
||||||
(mu4e-message "Contacts received: %d"
|
(mu4e-message "Contacts received: %d"
|
||||||
(length mu4e~contacts-for-completion))))
|
(length mu4e~contacts-for-completion)))))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~check-requirements ()
|
(defun mu4e~check-requirements ()
|
||||||
|
@ -625,10 +628,11 @@ FUNC (if non-nil) afterwards."
|
||||||
(when mu4e-compose-complete-addresses
|
(when mu4e-compose-complete-addresses
|
||||||
(setq mu4e-contacts-func 'mu4e~fill-contacts)
|
(setq mu4e-contacts-func 'mu4e~fill-contacts)
|
||||||
(mu4e~proc-contacts
|
(mu4e~proc-contacts
|
||||||
mu4e-compose-complete-only-newer-than
|
mu4e-compose-complete-only-personal
|
||||||
;; calculate time_t value -- now minus so-many days
|
(when mu4e-compose-complete-only-after
|
||||||
(floor (- (float-time (current-time))
|
(floor (float-time
|
||||||
(* 3600 24 mu4e-compose-complete-only-newer-than)))))))
|
(apply 'encode-time
|
||||||
|
(org-parse-time-string mu4e-compose-complete-only-after)))))))))
|
||||||
|
|
||||||
(defun mu4e~stop ()
|
(defun mu4e~stop ()
|
||||||
"Stop the mu4e session."
|
"Stop the mu4e session."
|
||||||
|
@ -726,6 +730,8 @@ either 'to-server, 'from-server or 'misc. This function is meant for debugging."
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(delete-region (point-min) (point)))))))))
|
(delete-region (point-min) (point)))))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-toggle-logging ()
|
(defun mu4e-toggle-logging ()
|
||||||
"Toggle between enabling/disabling debug-mode (in debug-mode,
|
"Toggle between enabling/disabling debug-mode (in debug-mode,
|
||||||
mu4e logs some of its internal workings to a log-buffer. See
|
mu4e logs some of its internal workings to a log-buffer. See
|
||||||
|
@ -737,6 +743,8 @@ mu4e logs some of its internal workings to a log-buffer. See
|
||||||
(if mu4e-debug "enabled" "disabled"))
|
(if mu4e-debug "enabled" "disabled"))
|
||||||
(mu4e-log 'misc "logging enabled"))
|
(mu4e-log 'misc "logging enabled"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-show-log ()
|
(defun mu4e-show-log ()
|
||||||
"Visit the mu4e debug log."
|
"Visit the mu4e debug log."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -746,7 +754,6 @@ mu4e logs some of its internal workings to a log-buffer. See
|
||||||
(switch-to-buffer buf)))
|
(switch-to-buffer buf)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-split-ranges-to-numbers (str n)
|
(defun mu4e-split-ranges-to-numbers (str n)
|
||||||
"Convert STR containing attachment numbers into a list of numbers.
|
"Convert STR containing attachment numbers into a list of numbers.
|
||||||
STR is a string; N is the highest possible number in the list.
|
STR is a string; N is the highest possible number in the list.
|
||||||
|
@ -830,8 +837,6 @@ displaying it). Do _not_ bury the current buffer, though."
|
||||||
`parse-time-string'."
|
`parse-time-string'."
|
||||||
(let ((timestr (read-string (mu4e-format "%s" prompt))))
|
(let ((timestr (read-string (mu4e-format "%s" prompt))))
|
||||||
(apply 'encode-time (org-parse-time-string timestr))))
|
(apply 'encode-time (org-parse-time-string timestr))))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defconst mu4e~main-about-buffer-name "*mu4e-about*"
|
(defconst mu4e~main-about-buffer-name "*mu4e-about*"
|
||||||
|
@ -853,6 +858,5 @@ displaying it). Do _not_ bury the current buffer, though."
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'mu4e-utils)
|
(provide 'mu4e-utils)
|
||||||
;;; End of mu4e-utils.el
|
;;; End of mu4e-utils.el
|
||||||
|
|
|
@ -142,13 +142,21 @@ the address fields (this excludes mailing list messages)."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
(defcustom mu4e-compose-complete-only-newer-than 500
|
(defcustom mu4e-compose-complete-only-after "2010-01-01"
|
||||||
"Consider only contacts last seen less than so many *days*. This
|
"Consider only contacts last seen after this date. Date must be a
|
||||||
excludes really old contacts. Set to nil to not have any time-based
|
string, in a format parseable by `org-parse-time-string'. This
|
||||||
restriction."
|
excludes really old contacts. Set to nil to not have any
|
||||||
:type 'integer
|
time-based restriction."
|
||||||
|
:type 'string
|
||||||
:group 'mu4e-compose)
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
|
(defcustom mu4e-compose-complete-ignore-address-regexp "noreply"
|
||||||
|
"Ignore any e-mail addresses for completion if they match this
|
||||||
|
regexp."
|
||||||
|
:type 'string
|
||||||
|
:group 'mu4e-compose)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Folders
|
;; Folders
|
||||||
(defgroup mu4e-folders nil
|
(defgroup mu4e-folders nil
|
||||||
|
|
Loading…
Reference in New Issue