summaryrefslogtreecommitdiff
path: root/lisp/mh-e/mh-e.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-08-06 03:56:51 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-08-06 03:56:51 -0400
commit74b097b61c5201405ad7bc5bb76f1ca0e794184b (patch)
tree9e616fd95c5cb01c7dac507c6d84a34637f14411 /lisp/mh-e/mh-e.el
parentb06917a4912a60402025286d07d4a195749245c4 (diff)
downloademacs-74b097b61c5201405ad7bc5bb76f1ca0e794184b.tar.gz
* lisp/mh-e: Use cl-lib
Also, use underscore prefixes and defvar in preparation for lexical binding * lisp/mh-e/mh-acros.el: Require cl-lib instead of cl. Rename all cl.el uses by adding `cl-` prefix. (mh-require-cl): Remove. Not needed any more. Remove all calls. (mh-defstruct): Remove. Replace all uses with cl-defstruct. (mh-dlet*): New macro. * lisp/mh-e/mh-comp.el (mh-user-agent-compose): Fold all ignored optional args into the &rest arg. * lisp/mh-e/mh-e.el: Require cl-lib instead of using mh-require-cl. (mh-variants): Don't add-to-list on a local var. * lisp/mh-e/mh-folder.el (mh-restore-desktop-buffer): Use shorter arg names that don't collide with global vars. * lisp/mh-e/mh-mime.el (mh-insert-mime-button): (mh-insert-mime-security-button): Use mh-dlet*. * lisp/mh-e/mh-search.el (mh-swish-next-result, mh-grep-next-result) (mh-namazu-next-result): Use `or`. * lisp/mh-e/mh-thread.el (mh-thread-generate) (mh-thread-prune-containers): Use underscore rather than declare+ignore. * lisp/mh-e/mh-tool-bar.el (mh-tool-bar-define): Use mh-dlet*. (mh-tool-bar-define): Prefer the more precise \`...\' regexp ops. Prefer Elisp's `eval-and-compile` over `cl-eval-when`. * lisp/mh-e/mh-xface.el (mh-picon-get-image): Don't use mh-funcall-if-exists for ietf-drums-parse-address. Avoid the use of `cl-return` and hence use plain `defun`. Replace some `cl-loop` with `dolist`.
Diffstat (limited to 'lisp/mh-e/mh-e.el')
-rw-r--r--lisp/mh-e/mh-e.el103
1 files changed, 52 insertions, 51 deletions
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index c70e11e773a..7644f6e961c 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -91,7 +91,7 @@
;; for if it does it will introduce a require loop.
(require 'mh-loaddefs)
-(mh-require-cl)
+(require 'cl-lib)
(require 'mh-buffers)
(require 'mh-compat)
@@ -496,7 +496,7 @@ all the strings have been used."
(push (buffer-substring-no-properties (point)
(mh-line-end-position))
arg-list)
- (incf count)
+ (cl-incf count)
(forward-line))
(apply #'call-process cmd nil (list out nil) nil
(nreverse arg-list))))
@@ -509,8 +509,8 @@ all the strings have been used."
Adds double-quotes around entire string and quotes the characters
\\, `, and $ with a backslash."
(concat "\""
- (loop for x across string
- concat (format (if (memq x '(?\\ ?` ?$)) "\\%c" "%c") x))
+ (cl-loop for x across string
+ concat (format (if (memq x '(?\\ ?` ?$)) "\\%c" "%c") x))
"\""))
(defun mh-exec-cmd (command &rest args)
@@ -527,7 +527,7 @@ parsed by MH-E."
(save-excursion
(goto-char start)
(insert "Errors when executing: " command)
- (loop for arg in args do (insert " " arg))
+ (cl-loop for arg in args do (insert " " arg))
(insert "\n"))
(save-window-excursion
(switch-to-buffer-other-window mh-log-buffer)
@@ -583,7 +583,7 @@ ARGS are passed to COMMAND as command line arguments."
(push elem process-environment))
(apply #'mh-exec-cmd-daemon command filter args)))
-(defun mh-process-daemon (process output)
+(defun mh-process-daemon (_process output)
"PROCESS daemon that puts OUTPUT into a temporary buffer.
Any output from the process is displayed in an asynchronous
pop-up window."
@@ -683,11 +683,11 @@ ARGS is returned unchanged."
`(if (boundp 'customize-package-emacs-version-alist)
,args
(let (seen)
- (loop for keyword in ,args
- if (cond ((eq keyword ':package-version) (setq seen t) nil)
- (seen (setq seen nil) nil)
- (t t))
- collect keyword))))
+ (cl-loop for keyword in ,args
+ if (cond ((eq keyword ':package-version) (setq seen t) nil)
+ (seen (setq seen nil) nil)
+ (t t))
+ collect keyword))))
(defmacro defgroup-mh (symbol members doc &rest args)
"Declare SYMBOL as a customization group containing MEMBERS.
@@ -740,14 +740,14 @@ is described by the variable `mh-variants'."
(let ((list-unique))
;; Make a unique list of directories, keeping the given order.
;; We don't want the same MH variant to be listed multiple times.
- (loop for dir in (append mh-path mh-sys-path exec-path) do
- (setq dir (file-chase-links (directory-file-name dir)))
- (add-to-list 'list-unique dir))
- (loop for dir in (nreverse list-unique) do
- (when (and dir (file-accessible-directory-p dir))
- (let ((variant (mh-variant-info dir)))
- (if variant
- (add-to-list 'mh-variants variant)))))
+ (cl-loop for dir in (append mh-path mh-sys-path exec-path) do
+ (setq dir (file-chase-links (directory-file-name dir)))
+ (cl-pushnew dir list-unique :test #'equal))
+ (cl-loop for dir in (nreverse list-unique) do
+ (when (and dir (file-accessible-directory-p dir))
+ (let ((variant (mh-variant-info dir)))
+ (if variant
+ (add-to-list 'mh-variants variant)))))
mh-variants)))
(defun mh-variant-info (dir)
@@ -858,22 +858,22 @@ variant."
mh-progs progs
mh-variant-in-use variant))))
((symbolp variant) ;e.g. 'nmh (pick the first match)
- (loop for variant-list in (mh-variants)
- when (eq variant (cadr (assoc 'variant (cdr variant-list))))
- return (let* ((version (car variant-list))
- (alist (cdr variant-list))
- (lib-progs (cadr (assoc 'mh-lib-progs alist)))
- (lib (cadr (assoc 'mh-lib alist)))
- (progs (cadr (assoc 'mh-progs alist)))
- (flists (cadr (assoc 'flists alist))))
- ;;(set-default mh-variant flavor)
- (setq mh-x-mailer-string nil
- mh-flists-present-flag flists
- mh-lib-progs lib-progs
- mh-lib lib
- mh-progs progs
- mh-variant-in-use version)
- t)))))
+ (cl-loop for variant-list in (mh-variants)
+ when (eq variant (cadr (assoc 'variant (cdr variant-list))))
+ return (let* ((version (car variant-list))
+ (alist (cdr variant-list))
+ (lib-progs (cadr (assoc 'mh-lib-progs alist)))
+ (lib (cadr (assoc 'mh-lib alist)))
+ (progs (cadr (assoc 'mh-progs alist)))
+ (flists (cadr (assoc 'flists alist))))
+ ;;(set-default mh-variant flavor)
+ (setq mh-x-mailer-string nil
+ mh-flists-present-flag flists
+ mh-lib-progs lib-progs
+ mh-lib lib
+ mh-progs progs
+ mh-variant-in-use version)
+ t)))))
(defun mh-variant-p (&rest variants)
"Return t if variant is any of VARIANTS.
@@ -1706,9 +1706,9 @@ The function is always called with SYMBOL bound to
(set symbol value) ;XXX shouldn't this be set-default?
(setq mh-junk-choice
(or value
- (loop for element in mh-junk-function-alist
- until (executable-find (symbol-name (car element)))
- finally return (car element)))))
+ (cl-loop for element in mh-junk-function-alist
+ until (executable-find (symbol-name (car element)))
+ finally return (car element)))))
(defcustom-mh mh-junk-background nil
"If on, spam programs are run in background.
@@ -2885,9 +2885,9 @@ removed and entries from `mh-invisible-header-fields' are added."
(when mh-invisible-header-fields-default
;; Remove entries from `mh-invisible-header-fields-default'
(setq fields
- (loop for x in fields
- unless (member x mh-invisible-header-fields-default)
- collect x)))
+ (cl-loop for x in fields
+ unless (member x mh-invisible-header-fields-default)
+ collect x)))
(when (and (boundp 'mh-invisible-header-fields)
mh-invisible-header-fields)
(dolist (x mh-invisible-header-fields)
@@ -3605,16 +3605,17 @@ specified colors."
new-spec)
;; Remove entries with min-colors, or delete them if we have
;; fewer colors than they specify.
- (loop for entry in (reverse spec) do
- (let ((requirement (if (eq (car entry) t)
- nil
- (assq 'min-colors (car entry)))))
- (if requirement
- (when (>= cells (nth 1 requirement))
- (setq new-spec (cons (cons (delq requirement (car entry))
- (cdr entry))
- new-spec)))
- (setq new-spec (cons entry new-spec)))))
+ (cl-loop
+ for entry in (reverse spec) do
+ (let ((requirement (if (eq (car entry) t)
+ nil
+ (assq 'min-colors (car entry)))))
+ (if requirement
+ (when (>= cells (nth 1 requirement))
+ (setq new-spec (cons (cons (delq requirement (car entry))
+ (cdr entry))
+ new-spec)))
+ (setq new-spec (cons entry new-spec)))))
new-spec))))
(defface-mh mh-folder-address