mirror of https://github.com/djcb/mu.git
mu4e: Replace cl with cl-lib
This commit is contained in:
parent
53c1b0a069
commit
2674ca5583
|
@ -26,8 +26,7 @@
|
|||
;; manual)
|
||||
|
||||
;;; Code:
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
(require 'cl-lib)
|
||||
(require 'ido)
|
||||
|
||||
(require 'mu4e-utils)
|
||||
|
@ -78,7 +77,7 @@ return the filename."
|
|||
(let* ((html (mu4e-message-field msg :body-html))
|
||||
(txt (mu4e-message-field msg :body-txt))
|
||||
(tmpfile (mu4e-make-temp-file "html"))
|
||||
(attachments (remove-if (lambda (part)
|
||||
(attachments (cl-remove-if (lambda (part)
|
||||
(or (null (plist-get part :attachment))
|
||||
(null (plist-get part :cid))))
|
||||
(mu4e-message-field msg :parts))))
|
||||
|
|
|
@ -67,10 +67,8 @@
|
|||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
(require 'message)
|
||||
(require 'mail-parse)
|
||||
(require 'smtpmail)
|
||||
|
@ -259,7 +257,7 @@ If needed, set the Fcc header, and register the handler function."
|
|||
(funcall mu4e-sent-messages-behavior)
|
||||
mu4e-sent-messages-behavior)))
|
||||
(mdir
|
||||
(case sent-behavior
|
||||
(cl-case sent-behavior
|
||||
(delete nil)
|
||||
(trash (mu4e-get-trash-folder mu4e-compose-parent-message))
|
||||
(sent (mu4e-get-sent-folder mu4e-compose-parent-message))
|
||||
|
@ -536,7 +534,7 @@ buffers; lets remap its faces so it uses the ones for mu4e."
|
|||
(let* ((subj (message-field-value "subject"))
|
||||
(subj (unless (and subj (string-match "^[:blank:]*$" subj)) subj))
|
||||
(str (or subj
|
||||
(case compose-type
|
||||
(cl-case compose-type
|
||||
(reply "*reply*")
|
||||
(forward "*forward*")
|
||||
(otherwise "*draft*")))))
|
||||
|
@ -552,19 +550,20 @@ automatically encrypt that reply. When the message is unencrypted,
|
|||
we can decide what we want to do."
|
||||
(if (and (eq compose-type 'reply)
|
||||
(and parent (member 'encrypted (mu4e-message-field parent :flags))))
|
||||
(case mu4e-compose-crypto-reply-encrypted-policy
|
||||
(cl-case mu4e-compose-crypto-reply-encrypted-policy
|
||||
(sign (mml-secure-message-sign))
|
||||
(encrypt (mml-secure-message-encrypt))
|
||||
(sign-and-encrypt (mml-secure-message-sign-encrypt))
|
||||
(message "Do nothing"))
|
||||
(case mu4e-compose-crypto-reply-plain-policy
|
||||
(cl-case mu4e-compose-crypto-reply-plain-policy
|
||||
(sign (mml-secure-message-sign))
|
||||
(encrypt (mml-secure-message-encrypt))
|
||||
(sign-and-encrypt (mml-secure-message-sign-encrypt))
|
||||
(message "Do nothing")))
|
||||
)
|
||||
|
||||
(defun* mu4e~compose-handler (compose-type &optional original-msg includes)
|
||||
|
||||
(cl-defun mu4e~compose-handler (compose-type &optional original-msg includes)
|
||||
"Create a new draft message, or open an existing one.
|
||||
|
||||
COMPOSE-TYPE determines the kind of message to compose and is a
|
||||
|
@ -601,7 +600,7 @@ tempfile)."
|
|||
(mu4e-draft-open compose-type original-msg)
|
||||
(quit (set-window-configuration winconf)
|
||||
(mu4e-message "Operation aborted")
|
||||
(return-from mu4e~compose-handler))))
|
||||
(cl-return-from mu4e~compose-handler))))
|
||||
;; insert mail-header-separator, which is needed by message mode to separate
|
||||
;; headers and body. will be removed before saving to disk
|
||||
(mu4e~draft-insert-mail-header-separator)
|
||||
|
@ -624,7 +623,7 @@ tempfile)."
|
|||
(if (member compose-type '(new forward))
|
||||
(message-goto-to)
|
||||
;; otherwise, it depends...
|
||||
(case message-cite-reply-position
|
||||
(cl-case message-cite-reply-position
|
||||
((above traditional)
|
||||
(message-goto-body))
|
||||
(t
|
||||
|
|
|
@ -24,10 +24,7 @@
|
|||
|
||||
;; A mu4e 'context' is a a set of variable-settings and functions, which can be
|
||||
;; used e.g. to switch between accounts.
|
||||
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-utils)
|
||||
|
||||
(defvar mu4e-contexts nil "The list of `mu4e-context' objects
|
||||
|
@ -61,7 +58,7 @@ none."
|
|||
(mu4e-context-name (mu4e-context-current)))
|
||||
'face 'mu4e-context-face) "]") ""))
|
||||
|
||||
(defstruct mu4e-context
|
||||
(cl-defstruct mu4e-context
|
||||
"A mu4e context object with the following members:
|
||||
- `name': the name of the context, eg. \"Work\" or \"Private\".
|
||||
- `enter-func': a parameterless function invoked when entering
|
||||
|
@ -83,7 +80,7 @@ none."
|
|||
(defun mu4e~context-ask-user (prompt)
|
||||
"Let user choose some context based on its name."
|
||||
(when mu4e-contexts
|
||||
(let* ((names (map 'list (lambda (context)
|
||||
(let* ((names (cl-map 'list (lambda (context)
|
||||
(cons (mu4e-context-name context) context))
|
||||
mu4e-contexts))
|
||||
(context (mu4e-read-option prompt names)))
|
||||
|
@ -99,7 +96,7 @@ non-nil."
|
|||
(interactive "P")
|
||||
(unless mu4e-contexts
|
||||
(mu4e-error "No contexts defined"))
|
||||
(let* ((names (map 'list (lambda (context)
|
||||
(let* ((names (cl-map 'list (lambda (context)
|
||||
(cons (mu4e-context-name context) context))
|
||||
mu4e-contexts))
|
||||
(context
|
||||
|
@ -156,12 +153,12 @@ match, POLICY determines what to do:
|
|||
(if (eq policy 'always-ask)
|
||||
(mu4e~context-ask-user "Select context: ")
|
||||
(or ;; is there a matching one?
|
||||
(find-if (lambda (context)
|
||||
(cl-find-if (lambda (context)
|
||||
(when (mu4e-context-match-func context)
|
||||
(funcall (mu4e-context-match-func context) msg)))
|
||||
mu4e-contexts)
|
||||
;; no context found yet; consult policy
|
||||
(case policy
|
||||
(cl-case policy
|
||||
(pick-first (car mu4e-contexts))
|
||||
(ask (mu4e~context-ask-user "Select context: "))
|
||||
(ask-if-none (or (mu4e-context-current)
|
||||
|
|
|
@ -25,10 +25,7 @@
|
|||
;; In this file, various functions to create draft messages
|
||||
|
||||
;; Code
|
||||
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-vars)
|
||||
(require 'mu4e-utils)
|
||||
(require 'mu4e-message)
|
||||
|
@ -134,7 +131,7 @@ References. If both are empty, return nil."
|
|||
(refs (if (and msgid (not (string= msgid "")))
|
||||
(append refs (list msgid)) refs))
|
||||
;; no doubles
|
||||
(refs (delete-duplicates refs :test #'equal))
|
||||
(refs (cl-delete-duplicates refs :test #'equal))
|
||||
(refnum (length refs))
|
||||
(cut 2))
|
||||
;; remove some refs when there are too many
|
||||
|
@ -179,11 +176,11 @@ Special case: if we were the sender of the original, we simple copy
|
|||
the list form the original."
|
||||
(let ((reply-to
|
||||
(or (plist-get origmsg :reply-to) (plist-get origmsg :from))))
|
||||
(delete-duplicates reply-to :test #'mu4e~draft-address-cell-equal)
|
||||
(cl-delete-duplicates reply-to :test #'mu4e~draft-address-cell-equal)
|
||||
(if mu4e-compose-dont-reply-to-self
|
||||
(delete-if
|
||||
(cl-delete-if
|
||||
(lambda (to-cell)
|
||||
(member-if
|
||||
(cl-member-if
|
||||
(lambda (addr)
|
||||
(string= (downcase addr) (downcase (cdr to-cell))))
|
||||
mu4e-user-mail-address-list))
|
||||
|
@ -198,7 +195,7 @@ the list form the original."
|
|||
((null mu4e-compose-reply-ignore-address)
|
||||
addrs)
|
||||
((functionp mu4e-compose-reply-ignore-address)
|
||||
(remove-if
|
||||
(cl-remove-if
|
||||
(lambda (elt)
|
||||
(funcall mu4e-compose-reply-ignore-address (cdr elt)))
|
||||
addrs))
|
||||
|
@ -209,7 +206,7 @@ the list form the original."
|
|||
(mapconcat (lambda (elt) (concat "\\(" elt "\\)"))
|
||||
regexp "\\|")
|
||||
regexp)))
|
||||
(remove-if
|
||||
(cl-remove-if
|
||||
(lambda (elt)
|
||||
(string-match regexp (cdr elt)))
|
||||
addrs)))))
|
||||
|
@ -220,7 +217,7 @@ the list form the original."
|
|||
the original message ORIGMSG, and whether it's a reply-all."
|
||||
(when reply-all
|
||||
(let* ((cc-lst ;; get the cc-field from the original, remove dups
|
||||
(delete-duplicates
|
||||
(cl-delete-duplicates
|
||||
(append
|
||||
(plist-get origmsg :to)
|
||||
(plist-get origmsg :cc))
|
||||
|
@ -228,9 +225,9 @@ the original message ORIGMSG, and whether it's a reply-all."
|
|||
;; now we have the basic list, but we must remove
|
||||
;; addresses also in the to list
|
||||
(cc-lst
|
||||
(delete-if
|
||||
(cl-delete-if
|
||||
(lambda (cc-cell)
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (to-cell)
|
||||
(mu4e~draft-address-cell-equal cc-cell to-cell))
|
||||
(mu4e~draft-create-to-lst origmsg)))
|
||||
|
@ -242,9 +239,9 @@ the original message ORIGMSG, and whether it's a reply-all."
|
|||
(cc-lst
|
||||
(if (or mu4e-compose-keep-self-cc (null user-mail-address))
|
||||
cc-lst
|
||||
(delete-if
|
||||
(cl-delete-if
|
||||
(lambda (cc-cell)
|
||||
(member-if
|
||||
(cl-member-if
|
||||
(lambda (addr)
|
||||
(string= (downcase addr) (downcase (cdr cc-cell))))
|
||||
mu4e-user-mail-address-list))
|
||||
|
@ -257,7 +254,7 @@ symbol, :to or :cc), based on the original message ORIGMSG,
|
|||
and (optionally) REPLY-ALL which indicates this is a reply-to-all
|
||||
message. Return nil if there are no recipients for the particular field."
|
||||
(mu4e~draft-recipients-list-to-string
|
||||
(case field
|
||||
(cl-case field
|
||||
(:to
|
||||
(mu4e~draft-create-to-lst origmsg))
|
||||
(:cc
|
||||
|
@ -479,7 +476,7 @@ will be created from either `mu4e~draft-reply-construct', or
|
|||
`mu4e~draft-forward-construct' or `mu4e~draft-newmsg-construct'."
|
||||
(unless mu4e-maildir (mu4e-error "mu4e-maildir not set"))
|
||||
(let ((draft-dir nil))
|
||||
(case compose-type
|
||||
(cl-case compose-type
|
||||
|
||||
(edit
|
||||
;; case-1: re-editing a draft messages. in this case, we do know the
|
||||
|
@ -502,7 +499,7 @@ will be created from either `mu4e~draft-reply-construct', or
|
|||
(setq draft-dir (mu4e-get-drafts-folder msg))
|
||||
(let ((draft-path (mu4e~draft-determine-path draft-dir))
|
||||
(initial-contents
|
||||
(case compose-type
|
||||
(cl-case compose-type
|
||||
(reply (mu4e~draft-reply-construct msg))
|
||||
(forward (mu4e~draft-forward-construct msg))
|
||||
(new (mu4e~draft-newmsg-construct)))))
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
;; headers like 'To:' or 'Subject:')
|
||||
|
||||
;; Code:
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'fringe)
|
||||
(require 'hl-line)
|
||||
|
||||
|
@ -435,7 +433,7 @@ into a string."
|
|||
(let ((get-prefix
|
||||
(lambda (cell)
|
||||
(if mu4e-use-fancy-chars (cdr cell) (car cell)))))
|
||||
(case type
|
||||
(cl-case type
|
||||
('child (funcall get-prefix mu4e-headers-thread-child-prefix))
|
||||
('last-child (funcall get-prefix mu4e-headers-thread-last-child-prefix))
|
||||
('connection (funcall get-prefix mu4e-headers-thread-connection-prefix))
|
||||
|
@ -473,7 +471,7 @@ into a string."
|
|||
;; because the current level has always an connection
|
||||
;; and it used a special formatting.
|
||||
(setq mu4e~headers-thread-state
|
||||
(subseq (append mu4e~headers-thread-state padding)
|
||||
(cl-subseq (append mu4e~headers-thread-state padding)
|
||||
0 (- level 1)))
|
||||
;; Prepare the thread prefix.
|
||||
(setq prefix
|
||||
|
@ -517,7 +515,7 @@ while our display may be different)."
|
|||
(when (member flag flags)
|
||||
(setq str
|
||||
(concat str
|
||||
(case flag
|
||||
(cl-case flag
|
||||
('draft (funcall get-prefix mu4e-headers-draft-mark))
|
||||
('flagged (funcall get-prefix mu4e-headers-flagged-mark))
|
||||
('new (funcall get-prefix mu4e-headers-new-mark))
|
||||
|
@ -597,7 +595,7 @@ found."
|
|||
(funcall func msg)))
|
||||
|
||||
(defun mu4e~headers-field-apply-basic-properties (msg field val width)
|
||||
(case field
|
||||
(cl-case field
|
||||
(:subject
|
||||
(concat ;; prefix subject with a thread indicator
|
||||
(mu4e~headers-thread-prefix (mu4e-message-field msg :thread))
|
||||
|
@ -1346,7 +1344,7 @@ matching messages with that mark."
|
|||
(let* ((do-mark) (value (mu4e-msg-field msg field)))
|
||||
(setq do-mark
|
||||
(if (member field '(:to :from :cc :bcc :reply-to))
|
||||
(find-if (lambda (contact)
|
||||
(cl-find-if (lambda (contact)
|
||||
(let ((name (car contact)) (email (cdr contact)))
|
||||
(or (and name (string-match pattern name))
|
||||
(and email (string-match pattern email))))) value)
|
||||
|
@ -1367,7 +1365,7 @@ matching messages with that mark."
|
|||
(mu4e-error "No thread info found")))
|
||||
(path (or (plist-get thread :path)
|
||||
(mu4e-error "No threadpath found"))))
|
||||
(case what
|
||||
(cl-case what
|
||||
(path path)
|
||||
(thread-id
|
||||
(save-match-data
|
||||
|
@ -1445,7 +1443,7 @@ WHERE is a symbol telling us where to push; it's a symbol, either
|
|||
'future or 'past. Functional also removes duplicats, limits the
|
||||
stack size."
|
||||
(let ((stack
|
||||
(case where
|
||||
(cl-case where
|
||||
(past mu4e~headers-query-past)
|
||||
(future mu4e~headers-query-future))))
|
||||
;; only add if not the same item
|
||||
|
@ -1453,11 +1451,11 @@ stack size."
|
|||
(push query stack)
|
||||
;; limit the stack to `mu4e~headers-query-stack-size' elements
|
||||
(when (> (length stack) mu4e~headers-query-stack-size)
|
||||
(setq stack (subseq stack 0 mu4e~headers-query-stack-size)))
|
||||
(setq stack (cl-subseq stack 0 mu4e~headers-query-stack-size)))
|
||||
;; remove all duplicates of the new element
|
||||
(remove-if (lambda (elm) (string= elm (car stack))) (cdr stack))
|
||||
(cl-remove-if (lambda (elm) (string= elm (car stack))) (cdr stack))
|
||||
;; update the stacks
|
||||
(case where
|
||||
(cl-case where
|
||||
(past (setq mu4e~headers-query-past stack))
|
||||
(future (setq mu4e~headers-query-future stack))))))
|
||||
|
||||
|
@ -1465,7 +1463,7 @@ stack size."
|
|||
"Pop a query from the stack.
|
||||
WHENCE is a symbol telling us where to get it from, either `future'
|
||||
or `past'."
|
||||
(case whence
|
||||
(cl-case whence
|
||||
(past
|
||||
(unless mu4e~headers-query-past
|
||||
(mu4e-warn "No more previous queries"))
|
||||
|
@ -1570,7 +1568,7 @@ sortfield, change the sort-order) or nil (ask the user)."
|
|||
(mu4e-error "Not a sortable field")))
|
||||
(sortfield (if (booleanp sortable) field sortable))
|
||||
(dir
|
||||
(case dir
|
||||
(cl-case dir
|
||||
((ascending descending) dir)
|
||||
;; change the sort order if field = curfield
|
||||
(t
|
||||
|
@ -1800,7 +1798,7 @@ do nothing."
|
|||
(hwin (get-buffer-window (mu4e-get-headers-buffer))))
|
||||
(when (and (buffer-live-p (mu4e-get-view-buffer)) (window-live-p hwin))
|
||||
(let ((n (or n 1)))
|
||||
(case mu4e-split-view
|
||||
(cl-case mu4e-split-view
|
||||
;; emacs has weird ideas about what horizontal, vertical means...
|
||||
(horizontal
|
||||
(window-resize hwin n nil)
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
(require 'mu4e-utils) ;; utility functions
|
||||
(require 'mu4e-context) ;; the context
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
|
||||
(defconst mu4e~main-buffer-name " *mu4e-main*"
|
||||
"*internal* Name of the mu4e main view buffer.")
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
;; currently in the headers buffer.
|
||||
|
||||
;; Code:
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-proc)
|
||||
(require 'mu4e-utils)
|
||||
(require 'mu4e-message)
|
||||
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
|
||||
;; keep byte-compiler happy
|
||||
(declare-function mu4e~headers-mark "mu4e-headers")
|
||||
(declare-function mu4e~headers-goto-docid "mu4e-headers")
|
||||
|
@ -96,7 +95,7 @@ where
|
|||
|
||||
(defun mu4e~mark-find-headers-buffer ()
|
||||
"Find the headers buffer, if any."
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (b)
|
||||
(with-current-buffer b
|
||||
(eq major-mode 'mu4e-headers-mode)))
|
||||
|
@ -346,7 +345,7 @@ as well."
|
|||
mu4e-marks))
|
||||
(marks
|
||||
(if allow-something
|
||||
marks (remove-if (lambda (m) (eq 'something (cdr m))) marks)))
|
||||
marks (cl-remove-if (lambda (m) (eq 'something (cdr m))) marks)))
|
||||
(mark (mu4e-read-option prompt marks))
|
||||
(target (mu4e~mark-ask-target mark)))
|
||||
(cons mark target)))
|
||||
|
|
|
@ -25,12 +25,9 @@
|
|||
;; Functions to get data from mu4e-message plist structure
|
||||
|
||||
;;; Code:
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-vars)
|
||||
(require 'mu4e-utils)
|
||||
|
||||
(require 'cl)
|
||||
(require 'flow-fill)
|
||||
|
||||
|
||||
|
@ -268,11 +265,11 @@ expressions, in which case any of those are tried for a match."
|
|||
(when cfield
|
||||
(if (listp rx)
|
||||
;; if rx is a list, try each one of them for a match
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (a-rx) (mu4e-message-contact-field-matches msg cfield a-rx))
|
||||
rx)
|
||||
;; not a list, check the rx
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (ct)
|
||||
(let ((name (car ct)) (email (cdr ct)))
|
||||
(or
|
||||
|
@ -287,9 +284,9 @@ CFIELD (either :to, :from, :cc or :bcc) of msg MSG matches *me*,
|
|||
that is, any of the e-mail address in
|
||||
`mu4e-user-mail-address-list'. Returns the contact cell that
|
||||
matched, or nil."
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (cc-cell)
|
||||
(member-if
|
||||
(cl-member-if
|
||||
(lambda (addr)
|
||||
(string= (downcase addr) (downcase (cdr cc-cell))))
|
||||
mu4e-user-mail-address-list))
|
||||
|
|
|
@ -471,7 +471,7 @@ mean:
|
|||
(:temp <path> :what <what> :param <param>)."
|
||||
(let ((cmd
|
||||
(concat "cmd:extract "
|
||||
(case action
|
||||
(cl-case action
|
||||
(save
|
||||
(format "action:save docid:%d index:%d path:%s extract-encrypted:%s use-agent:true"
|
||||
docid partidx (mu4e~escape path) (if decrypt "true" "false")))
|
||||
|
|
|
@ -26,11 +26,10 @@
|
|||
;; Utility functions used in the mu4e
|
||||
|
||||
;;; Code:
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(eval-when-compile (require 'org nil 'noerror))
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl)
|
||||
(require 'org nil 'noerror))
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-vars)
|
||||
(require 'mu4e-meta)
|
||||
(require 'mu4e-lists)
|
||||
|
@ -88,7 +87,7 @@ NODEFAULT, hour and minute fields will be nil if not given."
|
|||
User's addresses are set in `mu4e-user-mail-address-list'. Case
|
||||
insensitive comparison is used."
|
||||
(when (and addr mu4e-user-mail-address-list
|
||||
(find addr mu4e-user-mail-address-list
|
||||
(cl-find addr mu4e-user-mail-address-list
|
||||
:test (lambda (s1 s2)
|
||||
(eq t (compare-strings s1 nil nil s2 nil nil t)))))
|
||||
t))
|
||||
|
@ -306,9 +305,9 @@ Function will return the cdr of the list element."
|
|||
" [" (propertize "C-g" 'face 'mu4e-highlight-face)
|
||||
" to cancel]")
|
||||
;; the allowable chars
|
||||
(map 'list (lambda(elm) (string-to-char (car elm))) options)))
|
||||
(cl-map 'list (lambda(elm) (string-to-char (car elm))) options)))
|
||||
(chosen
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (option) (eq response (string-to-char (car option))))
|
||||
options)))
|
||||
(if chosen
|
||||
|
@ -384,7 +383,7 @@ maildirs under `mu4e-maildir'."
|
|||
(funcall mu4e-completing-read-function prompt
|
||||
(mu4e-get-maildirs) nil nil "/")
|
||||
(or (car-safe
|
||||
(find-if (lambda (item) (= kar (cdr item)))
|
||||
(cl-find-if (lambda (item) (= kar (cdr item)))
|
||||
mu4e-maildir-shortcuts))
|
||||
(mu4e-warn "Unknown shortcut '%c'" kar)))))))
|
||||
|
||||
|
@ -401,7 +400,7 @@ and offer to create it if it does not exist yet."
|
|||
mdir))
|
||||
|
||||
|
||||
(defstruct mu4e-bookmark
|
||||
(cl-defstruct mu4e-bookmark
|
||||
"A mu4e bookmarl object with the following members:
|
||||
- `name': the user-visible name of the bookmark
|
||||
- `key': a single key to search for this bookmark
|
||||
|
@ -415,7 +414,7 @@ and offer to create it if it does not exist yet."
|
|||
(defun mu4e-bookmarks ()
|
||||
"Get `mu4e-bookmarks' in the (new) format, converting from the old
|
||||
format if needed."
|
||||
(map 'list
|
||||
(cl-map 'list
|
||||
(lambda (item)
|
||||
(if (mu4e-bookmark-p item)
|
||||
item ;; already in the right format
|
||||
|
@ -448,7 +447,7 @@ format if needed."
|
|||
"Get the corresponding bookmarked query for shortcut character
|
||||
KAR, or raise an error if none is found."
|
||||
(let* ((chosen-bm
|
||||
(or (find-if
|
||||
(or (cl-find-if
|
||||
(lambda (bm)
|
||||
(= kar (mu4e-bookmark-key bm)))
|
||||
(mu4e-bookmarks))
|
||||
|
@ -467,15 +466,15 @@ KAR, or raise an error if none is found."
|
|||
shortcut-character KEY in the list of `mu4e-bookmarks'. This
|
||||
replaces any existing bookmark with KEY."
|
||||
(setq mu4e-bookmarks
|
||||
(remove-if
|
||||
(lambda (bm)
|
||||
(= (mu4e-bookmark-key bm) key))
|
||||
(mu4e-bookmarks)))
|
||||
(cl-remove-if
|
||||
(lambda (bm)
|
||||
(= (mu4e-bookmark-key bm) key))
|
||||
(mu4e-bookmarks)))
|
||||
(add-to-list 'mu4e-bookmarks
|
||||
(make-mu4e-bookmark
|
||||
:name name
|
||||
:query query
|
||||
:key key) t))
|
||||
(make-mu4e-bookmark
|
||||
:name name
|
||||
:query query
|
||||
:key key) t))
|
||||
|
||||
|
||||
;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -488,7 +487,7 @@ than the ones listed here are ignored.
|
|||
Also see `mu4e-flags-to-string'.
|
||||
\[1\]: http://cr.yp.to/proto/maildir.html"
|
||||
(when flags
|
||||
(let ((kar (case (car flags)
|
||||
(let ((kar (cl-case (car flags)
|
||||
('draft ?D)
|
||||
('flagged ?F)
|
||||
('new ?N)
|
||||
|
@ -506,7 +505,7 @@ Also see `mu4e-flags-to-string'.
|
|||
(defun mu4e-flags-to-string (flags)
|
||||
"Remove duplicates and sort the output of `mu4e~flags-to-string-raw'."
|
||||
(concat
|
||||
(sort (remove-duplicates
|
||||
(sort (cl-remove-duplicates
|
||||
(append (mu4e~flags-to-string-raw flags) nil)) '>)))
|
||||
|
||||
(defun mu4e~string-to-flags-1 (str)
|
||||
|
@ -519,7 +518,7 @@ Also see `mu4e-flags-to-string'.
|
|||
\[1\]: http://cr.yp.to/proto/maildir.html."
|
||||
(when (/= 0 (length str))
|
||||
(let ((flag
|
||||
(case (string-to-char str)
|
||||
(cl-case (string-to-char str)
|
||||
(?D 'draft)
|
||||
(?F 'flagged)
|
||||
(?P 'passed)
|
||||
|
@ -538,7 +537,7 @@ letters than the ones listed here are ignored. Also see
|
|||
`mu4e-flags-to-string'. \[1\]:
|
||||
http://cr.yp.to/proto/maildir.html "
|
||||
;; "Remove duplicates from the output of `mu4e~string-to-flags-1'"
|
||||
(remove-duplicates (mu4e~string-to-flags-1 str)))
|
||||
(cl-remove-duplicates (mu4e~string-to-flags-1 str)))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
@ -556,7 +555,7 @@ http://cr.yp.to/proto/maildir.html "
|
|||
"Display the mu4e manual page for the current mode.
|
||||
Or go to the top level if there is none."
|
||||
(interactive)
|
||||
(info (case major-mode
|
||||
(info (cl-case major-mode
|
||||
('mu4e-main-mode "(mu4e)Main view")
|
||||
('mu4e-headers-mode "(mu4e)Headers view")
|
||||
('mu4e-view-mode "(mu4e)Message view")
|
||||
|
@ -676,7 +675,7 @@ process."
|
|||
(defun mu4e-error-handler (errcode errmsg)
|
||||
"Handler function for showing an error."
|
||||
;; don't use mu4e-error here; it's running in the process filter context
|
||||
(case errcode
|
||||
(cl-case errcode
|
||||
(4 (user-error "No matches for this search query."))
|
||||
(t (error "Error %d: %s" errcode errmsg))))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -741,7 +740,7 @@ or (rfc822-string . CONTACT) otherwise."
|
|||
'mostly likely contact'.t See the code for the detail"
|
||||
(let* ((now (+ (float-time) 3600)) ;; allow for clock diffs
|
||||
(recent (- (float-time) (* 15 24 3600))))
|
||||
(sort* contacts
|
||||
(cl-sort contacts
|
||||
(lambda (c1 c2)
|
||||
(let* ( (c1 (cdr c1)) (c2 (cdr c2))
|
||||
(personal1 (plist-get c1 :personal))
|
||||
|
@ -765,7 +764,7 @@ or (rfc822-string . CONTACT) otherwise."
|
|||
(defun mu4e~sort-contacts-for-completion (contacts)
|
||||
"Takes CONTACTS, which is a list of RFC-822 addresses, and sort them based
|
||||
on the ranking in `mu4e~contacts.'"
|
||||
(sort* contacts
|
||||
(cl-sort contacts
|
||||
(lambda (c1 c2)
|
||||
(let ((rank1 (gethash c1 mu4e~contacts))
|
||||
(rank2 (gethash c2 mu4e~contacts)))
|
||||
|
@ -1099,7 +1098,7 @@ either 'to-server, 'from-server or 'misc. This function is meant for debugging."
|
|||
(current-time))
|
||||
'face 'font-lock-string-face))
|
||||
(msg-face
|
||||
(case type
|
||||
(cl-case type
|
||||
(from-server 'font-lock-type-face)
|
||||
(to-server 'font-lock-function-name-face)
|
||||
(misc 'font-lock-variable-name-face)
|
||||
|
@ -1108,7 +1107,7 @@ either 'to-server, 'from-server or 'misc. This function is meant for debugging."
|
|||
(msg (propertize (apply 'format frm args) 'face msg-face)))
|
||||
(goto-char (point-max))
|
||||
(insert tstamp
|
||||
(case type
|
||||
(cl-case type
|
||||
(from-server " <- ")
|
||||
(to-server " -> ")
|
||||
(error " !! ")
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
;; viewing e-mail messages
|
||||
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
(require 'cl-lib)
|
||||
(require 'mu4e-utils) ;; utility functions
|
||||
(require 'mu4e-vars)
|
||||
(require 'mu4e-mark)
|
||||
|
@ -43,9 +46,6 @@
|
|||
(require 'thingatpt)
|
||||
(require 'calendar)
|
||||
|
||||
(eval-when-compile (byte-compile-disable-warning 'cl-functions))
|
||||
(require 'cl)
|
||||
|
||||
(declare-function mu4e-view-mode "mu4e-view")
|
||||
|
||||
;; the message view
|
||||
|
@ -232,7 +232,7 @@ found."
|
|||
(mapconcat
|
||||
(lambda (field)
|
||||
(let ((fieldval (mu4e-message-field msg field)))
|
||||
(case field
|
||||
(cl-case field
|
||||
(:subject (mu4e~view-construct-header field fieldval))
|
||||
(:path (mu4e~view-construct-header field fieldval))
|
||||
(:maildir (mu4e~view-construct-header field fieldval))
|
||||
|
@ -506,12 +506,12 @@ add text-properties to VAL."
|
|||
"Construct a Signature: header, if there are any signed parts."
|
||||
(let* ((parts (mu4e-message-field msg :parts))
|
||||
(verdicts
|
||||
(remove-if 'null
|
||||
(cl-remove-if 'null
|
||||
(mapcar (lambda (part) (mu4e-message-part-field part :signature))
|
||||
parts)))
|
||||
(signers
|
||||
(mapconcat 'identity
|
||||
(remove-if 'null
|
||||
(cl-remove-if 'null
|
||||
(mapcar (lambda (part) (mu4e-message-part-field part :signers))
|
||||
parts)) ", "))
|
||||
(val (when verdicts
|
||||
|
@ -535,12 +535,12 @@ add text-properties to VAL."
|
|||
"Construct a Decryption: header, if there are any encrypted parts."
|
||||
(let* ((parts (mu4e-message-field msg :parts))
|
||||
(verdicts
|
||||
(remove-if 'null
|
||||
(cl-remove-if 'null
|
||||
(mapcar (lambda (part)
|
||||
(mu4e-message-part-field part :decryption))
|
||||
parts)))
|
||||
(succeeded (remove-if (lambda (v) (eq v 'failed)) verdicts))
|
||||
(failed (remove-if (lambda (v) (eq v 'succeeded)) verdicts))
|
||||
(succeeded (cl-remove-if (lambda (v) (eq v 'failed)) verdicts))
|
||||
(failed (cl-remove-if (lambda (v) (eq v 'succeeded)) verdicts))
|
||||
(succ (when succeeded
|
||||
(propertize
|
||||
(concat (number-to-string (length succeeded))
|
||||
|
@ -585,7 +585,7 @@ add text-properties to VAL."
|
|||
;; we only list parts that look like attachments, ie. that have a
|
||||
;; non-nil :attachment property; we record a mapping between
|
||||
;; user-visible numbers and the part indices
|
||||
(remove-if-not
|
||||
(cl-remove-if-not
|
||||
(lambda (part)
|
||||
(let* ((mtype (or (mu4e-message-part-field part :mime-type)
|
||||
"application/octet-stream"))
|
||||
|
@ -1198,7 +1198,7 @@ return the corresponding string."
|
|||
number ATTNUM."
|
||||
(let* ((partid (gethash attnum mu4e~view-attach-map))
|
||||
(attach
|
||||
(find-if
|
||||
(cl-find-if
|
||||
(lambda (part)
|
||||
(eq (mu4e-message-part-field part :index) partid))
|
||||
(mu4e-message-field msg :parts))))
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(require 'mu4e-meta) ;; autogenerated file with metadata (version etc.)
|
||||
(require 'mu4e-headers) ;; headers view
|
||||
(require 'mu4e-view) ;; message view
|
||||
|
|
|
@ -30,11 +30,7 @@
|
|||
|
||||
|
||||
;; The expect version here is org 8.x
|
||||
|
||||
|
||||
;; the 'noerror is just to make sure bytecompilations does not break...
|
||||
(require 'org)
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defgroup org-mu4e nil
|
||||
"Settings for the org-mode related functionality in mu4e."
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
(require 'org nil 'noerror)
|
||||
(require 'org-exp nil 'noerror)
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'mu4e)
|
||||
|
||||
(defgroup org-mu4e nil
|
||||
|
|
Loading…
Reference in New Issue