From 00f35a1e78f9af6faf6545ae98bc0145905313a1 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 20 Feb 2025 21:58:10 +0100 Subject: [PATCH] Use 'compf' in a few more places. --- lisp/cus-edit.el | 18 ++++++------------ lisp/format.el | 3 +-- lisp/net/secrets.el | 2 +- lisp/org/org-lint.el | 2 +- lisp/textmodes/table.el | 8 ++++---- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 48ea56ba84e..3d2b8092942 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1171,8 +1171,7 @@ for the MODE to customize." (customize-group (custom-group-of-mode mode))) (put 'customize-mode 'minibuffer-action - (cons (lambda (m) (save-selected-window (customize-mode (intern m)))) - "customize")) + (cons (compf save-selected-window customize-mode intern) "customize")) (defun customize-read-group () (let* ((sym (symbol-at-point)) @@ -1216,8 +1215,7 @@ If OTHER-WINDOW is non-nil, display in another window." (pop-to-buffer-same-window name))))) (put 'customize-group 'minibuffer-action - (cons (compf save-selected-window customize-group) - "customize")) + (cons (compf save-selected-window customize-group) "customize")) ;;;###autoload (defun customize-group-other-window (&optional group) @@ -1244,8 +1242,7 @@ If OTHER-WINDOW is non-nil, display in another window." (message "`%s' is an alias for `%s'" symbol basevar)))) (put 'customize-option 'minibuffer-action - (cons (lambda (v) (save-selected-window (customize-option (intern v)))) - "customize")) + (cons (compf save-selected-window customize-option intern) "customize")) (defface custom-boolean-option-on '((t :inherit success)) @@ -1508,8 +1505,7 @@ suggest to customize that face, if it's customizable." (custom-unlispify-tag-name face)))))) (put 'customize-face 'minibuffer-action - (cons (lambda (f) (save-selected-window (customize-face (intern f)))) - "customize")) + (cons (compf save-selected-window customize-face intern) "customize")) ;;;###autoload (defun customize-face-other-window (&optional face) @@ -1631,8 +1627,7 @@ If TYPE is `groups', include only groups." "*Customize Apropos*"))) (put 'customize-apropos 'minibuffer-action - (cons (compf save-selected-window customize-apropos) - "customize-apropos")) + (cons (compf save-selected-window customize-apropos) "customize-apropos")) ;;;###autoload (defun customize-apropos-options (regexp &optional _ignored) @@ -5863,8 +5858,7 @@ changes." (custom-unlispify-tag-name icon)))) (put 'customize-icon 'minibuffer-action - (cons (lambda (i) (save-selected-window (customize-icon (intern i)))) - "customize")) + (cons (compf save-selected-window customize-icon intern) "customize")) (defun custom-icon-state-set (widget &optional state) "Set the state of WIDGET to STATE." diff --git a/lisp/format.el b/lisp/format.el index 855d7a73f92..03d7be4a081 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -476,8 +476,7 @@ a list (ABSOLUTE-FILE-NAME SIZE)." "Read and return the name of a format. Return value is a list, like `buffer-file-format'; it may be nil. Formats are defined in `format-alist'. Optional arg is the PROMPT to use." - (let* ((table (mapcar (lambda (x) (list (symbol-name (car x)))) - format-alist)) + (let* ((table (mapcar (compf list symbol-name car) format-alist)) (ans (completing-read (or prompt "Format: ") table nil t))) (if (not (equal "" ans)) (list (intern ans))))) diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 049def1dc8d..27f332d7d6a 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -852,7 +852,7 @@ to their attributes." (1+ (length "password")) (mapcar ;; Attribute names have a leading ":", which will be suppressed. - (lambda (attribute) (length (symbol-name (car attribute)))) + (compf length symbol-name car) attributes))))) (cons ;; The password widget. diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index 5ed251944c5..a6e8cf5acbe 100644 --- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el @@ -517,7 +517,7 @@ instead" (let* ((deprecated-babel-properties ;; DIR is also used for attachments. (delete "dir" - (mapcar (lambda (arg) (downcase (symbol-name (car arg)))) + (mapcar (compf downcase symbol-name car) org-babel-common-header-args-w-values))) (deprecated-re (format "\\`%s[ \t]" (regexp-opt deprecated-babel-properties t)))) diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 938a4c8c46d..00362cb1e6c 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -3432,9 +3432,9 @@ consists from cells of same height." (let ((cell-list (table--horizontal-cell-list 'left-to-right))) (unless (and (table--uniform-list-p - (mapcar (lambda (cell) (cdr (table--get-coordinate (car cell)))) cell-list)) + (mapcar (compf cdr table--get-coordinate car) cell-list)) (table--uniform-list-p - (mapcar (lambda (cell) (cdr (table--get-coordinate (cdr cell)))) cell-list))) + (mapcar (compf cdr table--get-coordinate cdr) cell-list))) (error "Cells in this row are not in uniform height")) (unless lu-coord (setq lu-coord (table--get-coordinate (caar cell-list)))) @@ -3493,9 +3493,9 @@ column must consists from cells of same width." (let ((cell-list (table--vertical-cell-list 'top-to-bottom))) (unless (and (table--uniform-list-p - (mapcar (lambda (cell) (car (table--get-coordinate (car cell)))) cell-list)) + (mapcar (compf car table--get-coordinate car) cell-list)) (table--uniform-list-p - (mapcar (lambda (cell) (car (table--get-coordinate (cdr cell)))) cell-list))) + (mapcar (compf car table--get-coordinate cdr) cell-list))) (error "Cells in this column are not in uniform width")) (unless lu-coord (setq lu-coord (table--get-coordinate (caar cell-list)))) -- 2.39.5