From 68e57e0046328aa47ffad721718749b0991f6591 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 17 Nov 2020 03:13:50 +0100 Subject: [PATCH] Remove redundant 'function's around lambdas in mh/*.el * lisp/mh-e/mh-alias.el (mh-alias-tstamp, mh-alias-filenames) (mh-alias-address-to-alias): * lisp/mh-e/mh-comp.el (mh-edit-again, mh-redistribute): * lisp/mh-e/mh-identity.el (mh-identity-make-menu): * lisp/mh-e/mh-utils.el (mh-help): Remove redundant 'function's around lambdas. --- lisp/mh-e/mh-alias.el | 31 +++++------ lisp/mh-e/mh-comp.el | 110 +++++++++++++++++++-------------------- lisp/mh-e/mh-identity.el | 7 ++- lisp/mh-e/mh-utils.el | 5 +- 4 files changed, 73 insertions(+), 80 deletions(-) diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index cc437c3c49b..d037bdce887 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -73,12 +73,11 @@ If ARG is non-nil, set timestamp with the current time." (setq mh-alias-tstamp (list (nth 0 time) (nth 1 time)))) (let ((stamp)) (car (memq t (mapcar - (function - (lambda (file) - (when (and file (file-exists-p file)) - (setq stamp (file-attribute-modification-time - (file-attributes file))) - (time-less-p mh-alias-tstamp stamp)))) + (lambda (file) + (when (and file (file-exists-p file)) + (setq stamp (file-attribute-modification-time + (file-attributes file))) + (time-less-p mh-alias-tstamp stamp))) (mh-alias-filenames t))))))) (defun mh-alias-filenames (arg) @@ -93,11 +92,10 @@ appended." (filelist (and filename (split-string filename "[ \t]+"))) (userlist (mapcar - (function - (lambda (file) - (if (and mh-user-path file - (file-exists-p (expand-file-name file mh-user-path))) - (expand-file-name file mh-user-path)))) + (lambda (file) + (if (and mh-user-path file + (file-exists-p (expand-file-name file mh-user-path))) + (expand-file-name file mh-user-path))) filelist))) (if arg (if (stringp mh-alias-system-aliases) @@ -466,12 +464,11 @@ set `mh-alias-insert-file' or the \"Aliasfile:\" profile component")) ;; Double-check that we have an individual alias. This means that the ;; alias doesn't expand into a list (of which this address is part). (car (delq nil (mapcar - (function - (lambda (alias) - (let ((recurse (mh-alias-ali alias nil))) - (if (string-match ".*,.*" recurse) - nil - alias)))) + (lambda (alias) + (let ((recurse (mh-alias-ali alias nil))) + (if (string-match ".*,.*" recurse) + nil + alias))) (split-string aliases ", +"))))))) ;;;###mh-autoload diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index 8a69adbb756..e766bca89d8 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -435,43 +435,42 @@ See also `mh-send'." (mh-insert-header-separator) ;; Merge in components (mh-mapc - (function - (lambda (header-field) - (let ((field (car header-field)) - (value (cdr header-field)) - (case-fold-search t)) - (cond - ;; Address field - ((string-match field "^To$\\|^Cc$\\|^From$") - (cond - ((not (mh-goto-header-field (concat field ":"))) - ;; Header field does not exist, add it - (mh-goto-header-end 0) - (insert field ": " value "\n")) - ((string-equal value "") - ;; Header field already exists and no value - ) - (t - ;; Header field exists and we have a value - (let (address mailbox (alias (mh-alias-expand value))) - (and alias - (setq address (ietf-drums-parse-address alias)) - (setq mailbox (car address))) - ;; XXX - Need to parse all addresses out of field - (if (and - (not (mh-regexp-in-field-p - (concat "\\b" (regexp-quote value) "\\b") field)) - mailbox - (not (mh-regexp-in-field-p - (concat "\\b" (regexp-quote mailbox) "\\b") field))) - (insert " " value ",")) - )))) - ((string-match field "^Fcc$") - ;; Folder reference - (mh-modify-header-field field value)) - ;; Text field, that's an easy case - (t - (mh-modify-header-field field value)))))) + (lambda (header-field) + (let ((field (car header-field)) + (value (cdr header-field)) + (case-fold-search t)) + (cond + ;; Address field + ((string-match field "^To$\\|^Cc$\\|^From$") + (cond + ((not (mh-goto-header-field (concat field ":"))) + ;; Header field does not exist, add it + (mh-goto-header-end 0) + (insert field ": " value "\n")) + ((string-equal value "") + ;; Header field already exists and no value + ) + (t + ;; Header field exists and we have a value + (let (address mailbox (alias (mh-alias-expand value))) + (and alias + (setq address (ietf-drums-parse-address alias)) + (setq mailbox (car address))) + ;; XXX - Need to parse all addresses out of field + (if (and + (not (mh-regexp-in-field-p + (concat "\\b" (regexp-quote value) "\\b") field)) + mailbox + (not (mh-regexp-in-field-p + (concat "\\b" (regexp-quote mailbox) "\\b") field))) + (insert " " value ",")) + )))) + ((string-match field "^Fcc$") + ;; Folder reference + (mh-modify-header-field field value)) + ;; Text field, that's an easy case + (t + (mh-modify-header-field field value))))) (mh-components-to-list components-file)) (delete-file components-file) (goto-char (point-min)) @@ -700,25 +699,24 @@ message and scan line." ;; trumping anything in the distcomps file. (let ((components-file (mh-bare-components mh-dist-formfile))) (mh-mapc - (function - (lambda (header-field) - (let ((field (car header-field)) - (value (cdr header-field)) - (case-fold-search t)) - (cond - ((string-match field "^Resent-Fcc$") - (setq comp-fcc value)) - ((string-match field "^Resent-From$") - (or from - (setq from value))) - ((string-match field "^Resent-To$") - (setq comp-to value)) - ((string-match field "^Resent-Cc$") - (setq comp-cc value)) - ((string-match field "^Resent-Bcc$") - (setq comp-bcc value)) - ((string-match field "^Resent-.*$") - (mh-insert-fields field value)))))) + (lambda (header-field) + (let ((field (car header-field)) + (value (cdr header-field)) + (case-fold-search t)) + (cond + ((string-match field "^Resent-Fcc$") + (setq comp-fcc value)) + ((string-match field "^Resent-From$") + (or from + (setq from value))) + ((string-match field "^Resent-To$") + (setq comp-to value)) + ((string-match field "^Resent-Cc$") + (setq comp-cc value)) + ((string-match field "^Resent-Bcc$") + (setq comp-bcc value)) + ((string-match field "^Resent-.*$") + (mh-insert-fields field value))))) (mh-components-to-list components-file)) (delete-file components-file)) (mh-insert-fields "Resent-To:" (mapconcat 'identity (list to comp-to) ", ") diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index ebc7d2a4fcb..ed239963391 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -71,10 +71,9 @@ See `mh-identity-add-menu'." (mh-insert-auto-fields) mh-auto-fields-list] "--") - (mapcar (function - (lambda (arg) - `[,arg (mh-insert-identity ,arg) :style radio - :selected (equal mh-identity-local ,arg)])) + (mapcar (lambda (arg) + `[,arg (mh-insert-identity ,arg) :style radio + :selected (equal mh-identity-local ,arg)]) (mapcar 'car mh-identity-list)) '(["None" (mh-insert-identity "None") :style radio diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 44b4ef48795..28d3c7614ce 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -270,9 +270,8 @@ and displayed in a help buffer." (cdr (assoc nil (assoc major-mode mh-help-messages))))) (text (substitute-command-keys (mapconcat 'identity help "")))) (with-electric-help - (function - (lambda () - (insert text))) + (lambda () + (insert text)) mh-help-buffer))) ;;;###mh-autoload -- 2.39.5