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."
|
||||
(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
|
||||
a (:contacts (<list>)) in response. If ONLY-PERSONAL is non-nil,
|
||||
only get personal contacts, if newer-than is non-nil, get only
|
||||
contacts seen after NEWER-THAN (the time_t value)."
|
||||
a (:contacts (<list>)) in response. If PERSONAL is non-nil, only
|
||||
get personal contacts, if AFTER is non-nil, get only contacts
|
||||
seen AFTER (the time_t value)."
|
||||
(mu4e~proc-send-command
|
||||
"contacts only-personal:%s newer-than:%d"
|
||||
(if only-personal "true" "false")
|
||||
(if newer-than newer-than 0)))
|
||||
"contacts personal:%s after:%d"
|
||||
(if personal "true" "false")
|
||||
(or after 0)))
|
||||
|
||||
(defun mu4e~proc-view (docid-or-msgid &optional images)
|
||||
"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)))
|
||||
;;(message "N:%S M:%S" name 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
|
||||
(if name
|
||||
(format "%s <%s>" name mail)
|
||||
mail)))))
|
||||
(setq mu4e~contacts-for-completion lst)
|
||||
(mu4e-message "Contacts received: %d"
|
||||
(length mu4e~contacts-for-completion))))
|
||||
(length mu4e~contacts-for-completion)))))
|
||||
|
||||
|
||||
(defun mu4e~check-requirements ()
|
||||
|
@ -625,10 +628,11 @@ FUNC (if non-nil) afterwards."
|
|||
(when mu4e-compose-complete-addresses
|
||||
(setq mu4e-contacts-func 'mu4e~fill-contacts)
|
||||
(mu4e~proc-contacts
|
||||
mu4e-compose-complete-only-newer-than
|
||||
;; calculate time_t value -- now minus so-many days
|
||||
(floor (- (float-time (current-time))
|
||||
(* 3600 24 mu4e-compose-complete-only-newer-than)))))))
|
||||
mu4e-compose-complete-only-personal
|
||||
(when mu4e-compose-complete-only-after
|
||||
(floor (float-time
|
||||
(apply 'encode-time
|
||||
(org-parse-time-string mu4e-compose-complete-only-after)))))))))
|
||||
|
||||
(defun mu4e~stop ()
|
||||
"Stop the mu4e session."
|
||||
|
@ -726,6 +730,8 @@ either 'to-server, 'from-server or 'misc. This function is meant for debugging."
|
|||
(beginning-of-line)
|
||||
(delete-region (point-min) (point)))))))))
|
||||
|
||||
|
||||
|
||||
(defun mu4e-toggle-logging ()
|
||||
"Toggle between enabling/disabling debug-mode (in debug-mode,
|
||||
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"))
|
||||
(mu4e-log 'misc "logging enabled"))
|
||||
|
||||
|
||||
|
||||
(defun mu4e-show-log ()
|
||||
"Visit the mu4e debug log."
|
||||
(interactive)
|
||||
|
@ -746,7 +754,6 @@ mu4e logs some of its internal workings to a log-buffer. See
|
|||
(switch-to-buffer buf)))
|
||||
|
||||
|
||||
|
||||
(defun mu4e-split-ranges-to-numbers (str n)
|
||||
"Convert STR containing attachment numbers into a list of numbers.
|
||||
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'."
|
||||
(let ((timestr (read-string (mu4e-format "%s" prompt))))
|
||||
(apply 'encode-time (org-parse-time-string timestr))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defconst mu4e~main-about-buffer-name "*mu4e-about*"
|
||||
|
@ -853,6 +858,5 @@ displaying it). Do _not_ bury the current buffer, though."
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
(provide 'mu4e-utils)
|
||||
;;; End of mu4e-utils.el
|
||||
|
|
|
@ -142,13 +142,21 @@ the address fields (this excludes mailing list messages)."
|
|||
:type 'boolean
|
||||
:group 'mu4e-compose)
|
||||
|
||||
(defcustom mu4e-compose-complete-only-newer-than 500
|
||||
"Consider only contacts last seen less than so many *days*. This
|
||||
excludes really old contacts. Set to nil to not have any time-based
|
||||
restriction."
|
||||
:type 'integer
|
||||
(defcustom mu4e-compose-complete-only-after "2010-01-01"
|
||||
"Consider only contacts last seen after this date. Date must be a
|
||||
string, in a format parseable by `org-parse-time-string'. This
|
||||
excludes really old contacts. Set to nil to not have any
|
||||
time-based restriction."
|
||||
:type 'string
|
||||
: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
|
||||
(defgroup mu4e-folders nil
|
||||
|
|
Loading…
Reference in New Issue