unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: 66816@debbugs.gnu.org
Subject: bug#66816: [PATCH] Delete redundant lambdas around unary functions
Date: Sun, 29 Oct 2023 06:02:38 -0700	[thread overview]
Message-ID: <CADwFkmmvSJuoJrnAPnLWhr-LRmGHk9=XjpqNi-mD=00iEQs=sA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

Severity: wishlist

Please see the attached patch.

I've been able to measure around 10% better performance in the few cases
I looked into.  Here's an example:

    (benchmark-run 1000
      (seq-filter (lambda (n) (bufferp n))
                  (number-sequence 0 100000)))
    => (69.007736 333 47.018879999999996)

    (benchmark-run 1000
      (seq-filter #'bufferp
                  (number-sequence 0 100000)))
    => (61.541616 333 47.673137)

[-- Attachment #2: 0001-Delete-redundant-lambdas-around-unary-functions.patch --]
[-- Type: text/x-patch, Size: 24458 bytes --]

From a48df8cb9b701160aa4d844eade2c9a580a6b359 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sun, 29 Oct 2023 11:35:19 +0100
Subject: [PATCH] Delete redundant lambdas around unary functions

This is not just stylistic, but also slightly faster.  These are all
regular defuns, of course, as this won't work with macros and defsubsts.

* lisp/calc/calc-nlfit.el (math-nlfit-fit-curve)
(calc-fit-hubbert-linear-curve):
* lisp/calendar/cal-tex.el (cal-tex-latexify-list):
* lisp/calendar/todo-mode.el (todo-sort):
* lisp/cedet/semantic/ctxt.el (semantic-ctxt-end-of-symbol-default)
(semantic-ctxt-current-symbol-default):
* lisp/cedet/semantic/symref.el (semantic-symref-result-get-files):
* lisp/cedet/semantic/texi.el (semantic-texi-command-completion-list):
* lisp/descr-text.el (describe-char):
* lisp/emacs-lisp/eieio-datadebug.el
(data-debug-add-specialized-thing):
* lisp/emacs-lisp/rmc.el (read-multiple-choice--short-answers):
* lisp/eshell/em-pred.el (eshell-modifier-alist):
* lisp/gnus/gnus-cache.el (gnus-cache-articles-in-group):
* lisp/gnus/gnus-dired.el (gnus-dired-attach):
* lisp/help-mode.el (help-package-def):
* lisp/ibuf-ext.el (ibuffer-mark-modified-buffers):
* lisp/image/image-dired.el:
* lisp/international/quail.el (quail-keyseq-translate)
(quail-get-translations):
* lisp/isearch.el (isearch-pre-command-hook)
(search-within-boundaries):
* lisp/mail/supercite.el (sc-ask):
* lisp/mh-e/mh-e.el (mh-variant-set):
* lisp/net/rcirc.el (rcirc-nick-channels, rcirc-channel-nicks):
(rcirc-browse-url):
* lisp/obsolete/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/org/org-agenda.el (org-agenda-filter-completion-function):
* lisp/org/org-table.el (org-table-eval-formula):
* lisp/org/org.el (org-set-regexps-and-options):
* lisp/org/ox.el (org-export--get-inbuffer-options):
* lisp/ses.el (ses-range):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-begin-tex-skip-regexp):
* lisp/vc/vc-cvs.el (vc-cvs-stay-local-p):
* lisp/window.el (window--state-get-1):
* test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-all-groups-work):
Delete redundant lambdas around unary functions.
---
 lisp/calc/calc-nlfit.el                | 4 ++--
 lisp/calendar/cal-tex.el               | 2 +-
 lisp/calendar/todo-mode.el             | 2 +-
 lisp/cedet/semantic/ctxt.el            | 4 ++--
 lisp/cedet/semantic/sort.el            | 3 ++-
 lisp/cedet/semantic/symref.el          | 2 +-
 lisp/cedet/semantic/texi.el            | 2 +-
 lisp/descr-text.el                     | 3 +--
 lisp/emacs-lisp/eieio-datadebug.el     | 2 +-
 lisp/emacs-lisp/rmc.el                 | 2 +-
 lisp/eshell/em-pred.el                 | 2 +-
 lisp/gnus/gnus-cache.el                | 2 +-
 lisp/gnus/gnus-dired.el                | 6 ++----
 lisp/help-mode.el                      | 2 +-
 lisp/ibuf-ext.el                       | 3 +--
 lisp/image/image-dired.el              | 2 +-
 lisp/international/quail.el            | 7 ++-----
 lisp/isearch.el                        | 5 ++---
 lisp/mail/supercite.el                 | 2 +-
 lisp/mh-e/mh-e.el                      | 2 +-
 lisp/net/rcirc.el                      | 9 ++++-----
 lisp/obsolete/thumbs.el                | 2 +-
 lisp/org/org-agenda.el                 | 2 +-
 lisp/org/org-table.el                  | 3 +--
 lisp/org/org.el                        | 2 +-
 lisp/org/ox.el                         | 2 +-
 lisp/ses.el                            | 2 +-
 lisp/textmodes/emacs-news-mode.el      | 2 +-
 lisp/textmodes/ispell.el               | 4 +---
 lisp/vc/vc-cvs.el                      | 2 +-
 lisp/window.el                         | 3 +--
 test/lisp/emacs-lisp/shortdoc-tests.el | 2 +-
 32 files changed, 41 insertions(+), 53 deletions(-)

diff --git a/lisp/calc/calc-nlfit.el b/lisp/calc/calc-nlfit.el
index 72b906ff69b..445034005f5 100644
--- a/lisp/calc/calc-nlfit.el
+++ b/lisp/calc/calc-nlfit.el
@@ -678,7 +678,7 @@ math-nlfit-fit-curve
           (sdata (if (math-contains-sdev-p ydata)
                      (mapcar (lambda (x) (math-get-sdev x t)) ydata)
                    nil))
-          (ydata (mapcar (lambda (x) (math-get-value x)) ydata))
+          (ydata (mapcar #'math-get-value ydata))
           (calc-curve-varnames nil)
           (calc-curve-coefnames nil)
           (calc-curve-nvars 1)
@@ -757,7 +757,7 @@ calc-fit-hubbert-linear-curve
           (sdata (if (math-contains-sdev-p pdata)
                      (mapcar (lambda (x) (math-get-sdev x t)) pdata)
                    nil))
-          (pdata (mapcar (lambda (x) (math-get-value x)) pdata))
+          (pdata (mapcar #'math-get-value pdata))
           (poverqdata (math-map-binop 'math-div pdata qdata))
           (parmvals (math-nlfit-least-squares qdata poverqdata sdata sdevv))
           (finalparms (list (nth 0 parmvals)
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index 8399d77b4c4..70655d3dd08 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -1600,7 +1600,7 @@ cal-tex-latexify-list
   (or separator (setq separator "\\\\"))
   (let (result)
     (setq result
-          (mapconcat (lambda (x) (cal-tex-LaTeXify-string x))
+          (mapconcat #'cal-tex-LaTeXify-string
                      (dolist (d date-list (reverse result))
                        (and (car d)
                             (calendar-date-equal date (car d))
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 093ea0e22b6..964fdfbc961 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -3718,7 +3718,7 @@ todo-sort
   "Return a copy of LIST, possibly sorted according to KEY."
   (let* ((l (copy-sequence list))
 	 (fn (if (eq key 'alpha)
-		   (lambda (x) (upcase x)) ; Alphabetize case insensitively.
+                   #'upcase ; Alphabetize case insensitively.
 		 (lambda (x) (todo-get-count key x))))
 	 ;; Keep track of whether the last sort by key was descending or
 	 ;; ascending.
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el
index 84e6c6ebecb..051a6813320 100644
--- a/lisp/cedet/semantic/ctxt.el
+++ b/lisp/cedet/semantic/ctxt.el
@@ -362,7 +362,7 @@ semantic-ctxt-end-of-symbol-default
 Depends on `semantic-type-relation-separator-character', and will
 work on C like languages."
   (if point (goto-char point))
-  (let* ((fieldsep1 (mapconcat (lambda (a) (regexp-quote a))
+  (let* ((fieldsep1 (mapconcat #'regexp-quote
 			       semantic-type-relation-separator-character
 			       "\\|"))
 	 ;; NOTE: The [ \n] expression below should used \\s-, but that
@@ -446,7 +446,7 @@ semantic-ctxt-current-symbol-default
 Depends on `semantic-type-relation-separator-character'."
   (save-excursion
     (if point (goto-char point))
-    (let* ((fieldsep1 (mapconcat (lambda (a) (regexp-quote a))
+    (let* ((fieldsep1 (mapconcat #'regexp-quote
 				 semantic-type-relation-separator-character
 				 "\\|"))
 	   ;; NOTE: The [ \n] expression below should used \\s-, but that
diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el
index aebd50a649b..051cc7a8b02 100644
--- a/lisp/cedet/semantic/sort.el
+++ b/lisp/cedet/semantic/sort.el
@@ -243,7 +243,7 @@ semantic-flatten-tags-table
 ;; table, and reorganize them into buckets based on class.
 ;;
 (defvar semantic-bucketize-tag-class
-  ;; Must use lambda because `semantic-tag-class' is a macro.
+  ;; Must use lambda because `semantic-tag-class' is a defsubst.
   (lambda (tok) (semantic-tag-class tok))
   "Function used to get a symbol describing the class of a tag.
 This function must take one argument of a semantic tag.
@@ -401,6 +401,7 @@ semantic-adopt-external-members
 		      ;; get embedded types to scan and make copies
 		      ;; of them.
 		      (mapcar
+                       ;; Must use lambda because `semantic-tag-clone' is a defsubst.
 		       (lambda (tok) (semantic-tag-clone tok))
 		       (semantic-find-tags-by-class 'type
 			(semantic-tag-type-members (car decent-list)))))
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 1ebd7ea154b..8ef1baf3643 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -398,7 +398,7 @@ semantic-symref-result-get-files
   (if (slot-boundp result 'hit-files)
       (oref result hit-files)
     (let* ((lines  (oref result hit-lines))
-	   (files (mapcar (lambda (a) (cdr a)) lines))
+           (files (mapcar #'cdr lines))
 	   (ans nil))
       (setq ans (list (car files))
 	    files (cdr files))
diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el
index 45e03cb9102..1bb1a1cd475 100644
--- a/lisp/cedet/semantic/texi.el
+++ b/lisp/cedet/semantic/texi.el
@@ -385,7 +385,7 @@ semantic-analyze-current-context
     ))
 
 (defvar semantic-texi-command-completion-list
-  (append (mapcar (lambda (a) (car a)) texinfo-section-list)
+  (append (mapcar #'car texinfo-section-list)
 	  texinfo-environments
 	  ;; Is there a better list somewhere?  Here are few
 	  ;; of the top of my head.
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 4834c2eb7ba..5c9d25b48a8 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -425,8 +425,7 @@ describe-char
            (composition-string nil)
            (disp-vector (and display-table (aref display-table char)))
            (multibyte-p enable-multibyte-characters)
-           (overlays (mapcar (lambda (o) (overlay-properties o))
-                             (overlays-at pos)))
+           (overlays (mapcar #'overlay-properties (overlays-at pos)))
            (char-description (if (< char 128)
                                  (single-key-description char)
                                (string (if (not multibyte-p)
diff --git a/lisp/emacs-lisp/eieio-datadebug.el b/lisp/emacs-lisp/eieio-datadebug.el
index a80d1ae2720..a1d1e60db09 100644
--- a/lisp/emacs-lisp/eieio-datadebug.el
+++ b/lisp/emacs-lisp/eieio-datadebug.el
@@ -111,7 +111,7 @@ data-debug/eieio-insert-slots
               )))))))
 
 ;;; Augment the Data debug thing display list.
-(data-debug-add-specialized-thing (lambda (thing) (eieio-object-p thing))
+(data-debug-add-specialized-thing #'eieio-object-p
 				  #'data-debug-insert-object-button)
 
 ;;; DEBUG METHODS
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 45e2bbf3831..d41561bd3ff 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -188,7 +188,7 @@ read-multiple-choice--short-answers
           (format
            "%s (%s): "
            prompt
-           (mapconcat (lambda (e) (cdr e)) altered-names ", ")))
+           (mapconcat #'cdr altered-names ", ")))
          tchar buf wrong-char answer)
     (save-window-excursion
       (save-excursion
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index ae7d0c43bc4..c8fad99ae2b 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -122,7 +122,7 @@ eshell-modifier-alist
     (?e . (lambda (lst) (mapcar #'file-name-extension lst)))
     (?t . (lambda (lst) (mapcar #'file-name-nondirectory lst)))
     (?q . (lambda (lst) (mapcar #'eshell-escape-arg lst)))
-    (?u . (lambda (lst) (seq-uniq lst)))
+    (?u . #'seq-uniq)
     (?o . (lambda (lst) (sort lst #'string-lessp)))
     (?O . (lambda (lst) (sort lst #'string-greaterp)))
     (?j . (eshell-join-members))
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 13be21630ec..0ec07a55508 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -516,7 +516,7 @@ gnus-cache-articles-in-group
 	(file-name-coding-system nnmail-pathname-coding-system))
     (when (file-exists-p dir)
       (setq articles
-	    (sort (mapcar (lambda (name) (string-to-number name))
+            (sort (mapcar #'string-to-number
 			  (directory-files dir nil "\\`[0-9]+\\'" t))
 		  #'<))
       ;; Update the cache active file, just to synch more.
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index b146b51430a..42da6a57cbb 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -130,10 +130,8 @@ gnus-dired-attach
     ;; warn if user tries to attach without any files marked
     (if (null files-to-attach)
 	(error "No files to attach")
-      (setq files-str
-	    (mapconcat
-	     (lambda (f) (file-name-nondirectory f))
-	     files-to-attach ", "))
+      (setq files-str (mapconcat #'file-name-nondirectory
+                                 files-to-attach ", "))
       (setq bufs (gnus-dired-mail-buffers))
 
       ;; set up destination mail composition buffer
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index b51276d5e06..a31e87cad00 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -359,7 +359,7 @@ 'help-package
 
 (define-button-type 'help-package-def
   :supertype 'help-xref
-  'help-function (lambda (file) (dired file))
+  'help-function #'dired
   'help-echo (purecopy "mouse-2, RET: visit package directory"))
 
 (define-button-type 'help-theme-def
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 37065f5d41a..e42e7b2699b 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1875,8 +1875,7 @@ ibuffer-mark-by-mode
 (defun ibuffer-mark-modified-buffers ()
   "Mark all modified buffers."
   (interactive)
-  (ibuffer-mark-on-buffer
-   (lambda (buf) (buffer-modified-p buf))))
+  (ibuffer-mark-on-buffer #'buffer-modified-p))
 
 ;;;###autoload
 (defun ibuffer-mark-unsaved-buffers ()
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 83f228b2d59..8e083fcd6d5 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -2048,7 +2048,7 @@ 'image-dired-display-previous-thumbnail-original
 ;;            ;; Sort function.  Compare time between two files.
 ;;            (lambda (l1 l2)
 ;;               (time-less-p (car l1) (car l2)))))
-;;          (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files))))
+;;          (dirsize (apply '+ (mapcar #'cadr files))))
 ;;     (while (> dirsize image-dired-dir-max-size)
 ;;       (y-or-n-p
 ;;        (format "Size of thumbnail directory: %d, delete old file %s? "
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 894378bda8b..ff7df7750b3 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -772,8 +772,7 @@ quail-keyboard-translate
 
 (defun quail-keyseq-translate (keyseq)
   (apply 'string
-         (mapcar (lambda (x) (quail-keyboard-translate x))
-		 keyseq)))
+         (mapcar #'quail-keyboard-translate keyseq)))
 
 (defun quail-insert-kbd-layout (kbd-layout)
   "Insert the visual keyboard layout table according to KBD-LAYOUT.
@@ -2139,9 +2138,7 @@ quail-get-translations
 	  (setq str
 		(format "%s[%s]"
 			str
-                        (concat (sort (mapcar (lambda (x) (car x))
-					      (cdr map))
-				      '<)))))
+                        (concat (sort (mapcar #'car (cdr map)) #'<)))))
       ;; Show list of translations.
       (if (and quail-current-translations
 	       (not (quail-deterministic)))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 4d231fba469..f049832b648 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3226,7 +3226,7 @@ isearch-pre-command-hook
       (setq isearch-pre-move-point (point)))
      ;; Append control characters to the search string
      ((eq search-exit-option 'append)
-      (unless (memq nil (mapcar (lambda (k) (characterp k)) key))
+      (unless (memq nil (mapcar #'characterp key))
         (isearch-process-search-string key key))
       (setq this-command 'ignore))
      ;; Other characters terminate the search and are then executed normally.
@@ -4641,8 +4641,7 @@ search-within-boundaries
                                          (match-data)))))
             (when found (goto-char found))
             (when match-data (set-match-data
-                              (mapcar (lambda (m) (copy-marker m))
-                                      match-data))))
+                              (mapcar #'copy-marker match-data))))
         (setq found (funcall
                      (or search-fun (isearch-search-fun-default))
                      string (if bound (if isearch-forward
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index 8d9cb5511ed..dfae123d7a1 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -596,7 +596,7 @@ sc-ask
 Note that WORD is a string and LETTER is a character.  All LETTERs in
 the list should be unique."
   (let* ((prompt (concat
-		  (mapconcat (lambda (elt) (car elt)) alist ", ")
+                  (mapconcat #'car alist ", ")
 		  "? ("
 		  (mapconcat
 		   (lambda (elt) (char-to-string (cdr elt))) alist "/")
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 34c809a5ecd..a21ee3e0ccf 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -878,7 +878,7 @@ mh-variant-set
     (sit-for 5)
     (setq variant (concat "gnu-mh" (substring variant (match-end 0)))))
 
-  (let ((valid-list (mapcar (lambda (x) (car x)) (mh-variants))))
+  (let ((valid-list (mapcar #'car (mh-variants))))
     (cond
      ((eq variant 'none))
      ((eq variant 'autodetect)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index ecfeb9f8f84..8728e761ac8 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2268,8 +2268,7 @@ rcirc-nick-channels
   "Return list of channels for NICK.
 PROCESS is the process object for the current connection."
   (with-rcirc-process-buffer process
-    (mapcar (lambda (x) (car x))
-            (gethash nick rcirc-nick-table))))
+    (mapcar #'car (gethash nick rcirc-nick-table))))
 
 (defun rcirc-put-nick-channel (process nick channel &optional line)
   "Add CHANNEL to list associated with NICK.
@@ -2323,7 +2322,7 @@ rcirc-channel-nicks
                    (if record
                        (setq nicks (cons (cons k (cdr record)) nicks)))))
                rcirc-nick-table)
-              (mapcar (lambda (x) (car x))
+              (mapcar #'car
                       (sort (nconc pseudo-nicks nicks)
                             (lambda (x y)
                               (let ((lx (or (cdr x) 0))
@@ -2983,8 +2982,8 @@ rcirc-browse-url
          (filtered (seq-filter
                     (lambda (x) (>= point (cdr x)))
                     rcirc-urls))
-         (completions (mapcar (lambda (x) (car x)) filtered))
-         (defaults (mapcar (lambda (x) (car x)) filtered)))
+         (completions (mapcar #'car filtered))
+         (defaults (mapcar #'car filtered)))
     (browse-url (completing-read "Rcirc browse-url: "
                                  completions nil nil (car defaults) nil defaults)
                 arg)))
diff --git a/lisp/obsolete/thumbs.el b/lisp/obsolete/thumbs.el
index ddf734f22ea..c0c78079a8d 100644
--- a/lisp/obsolete/thumbs.el
+++ b/lisp/obsolete/thumbs.el
@@ -204,7 +204,7 @@ thumbs-cleanup-thumbsdir
 		    ,f)))
 	      (directory-files (thumbs-thumbsdir) t (image-file-name-regexp)))
 	     (lambda (l1 l2) (time-less-p (car l1) (car l2)))))
-           (dirsize (apply #'+ (mapcar (lambda (x) (cadr x)) files-list))))
+           (dirsize (apply #'+ (mapcar #'cadr files-list))))
       (while (> dirsize thumbs-thumbsdir-max-size)
         (progn
 	  (message "Deleting file %s" (cadr (cdar files-list))))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 38e81d9d713..1a6e7974480 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -8448,7 +8448,7 @@ org-agenda-filter-completion-function
 function is passed as a collection function to `completing-read',
 which see."
   (let ((completion-ignore-case t)	;tags are case-sensitive
-	(confirm (lambda (x) (stringp x)))
+        (confirm #'stringp)
 	(prefix "")
 	(operator "")
 	table)
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index aa819aa7d2f..c196aafa6ae 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -2519,8 +2519,7 @@ org-table-eval-formula
 	;; replace fields with duration values if relevant
 	(if duration
 	    (setq fields
-		  (mapcar (lambda (x) (org-table-time-string-to-seconds x))
-			  fields)))
+                  (mapcar #'org-table-time-string-to-seconds fields)))
 	(if (eq numbers t)
 	    (setq fields (mapcar
 			  (lambda (x)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 8b02721a859..db8f052f80a 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4171,7 +4171,7 @@ org-set-regexps-and-options
 		  '("ARCHIVE" "CATEGORY" "COLUMNS" "PRIORITIES"))))
       ;; Startup options.  Get this early since it does change
       ;; behavior for other options (e.g., tags).
-      (let ((startup (cl-mapcan (lambda (value) (split-string value))
+      (let ((startup (cl-mapcan #'split-string
 				(cdr (assoc "STARTUP" alist)))))
 	(dolist (option startup)
 	  (pcase (assoc-string option org-startup-options t)
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 94cc5a22881..94c3f068e3b 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -1536,7 +1536,7 @@ org-export--get-inbuffer-options
 		      (newline
 		       (mapconcat #'identity values "\n"))
 		      (split
-		       (cl-mapcan (lambda (v) (split-string v)) values))
+                       (cl-mapcan #'split-string values))
 		      ((t)
 		       (org-last values))
 		      (otherwise
diff --git a/lisp/ses.el b/lisp/ses.el
index 30bf33e47bf..d0b0bdd04e6 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -3998,7 +3998,7 @@ ses-range
     (unless reorient-x
       (setq result (mapcar #'nreverse result)))
     (when transpose
-      (let ((ret (mapcar (lambda (x) (list x)) (pop result))) iter)
+      (let ((ret (mapcar #'list (pop result))) iter)
 	(while result
 	  (setq iter ret)
 	  (dolist (elt (pop result))
diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el
index 773b07764aa..fec03565ae1 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -246,7 +246,7 @@ emacs-news--buttonize
         (while (re-search-forward "\"\\(([a-z0-9-]+)[ \n][^\"]\\{1,80\\}\\)\""
                                   nil t)
           (buttonize-region (match-beginning 1) (match-end 1)
-                            (lambda (node) (info node))
+                            #'info
                             (match-string 1)))))))
 
 (defun emacs-news--sections (regexp)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 9bd1135c5be..3fa30ebf133 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -3282,9 +3282,7 @@ ispell-begin-tex-skip-regexp
 Generated from `ispell-tex-skip-alists'."
   (concat
    ;; raw tex keys
-   (mapconcat (lambda (lst) (car lst))
-	      (car ispell-tex-skip-alists)
-	      "\\|")
+   (mapconcat #'car (car ispell-tex-skip-alists) "\\|")
    "\\|"
    ;; keys wrapped in begin{}
    (mapconcat (lambda (lst)
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 145697d1b06..423c598037d 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -790,7 +790,7 @@ vc-cvs-stay-local-p
 If FILE is a list of files, return non-nil if any of them
 individually should stay local."
   (if (listp file)
-      (delq nil (mapcar (lambda (arg) (vc-cvs-stay-local-p arg)) file))
+      (delq nil (mapcar #'vc-cvs-stay-local-p file))
     (let ((stay-local vc-cvs-stay-local))
       (if (symbolp stay-local) stay-local
        (let ((dirname (if (file-directory-p file)
diff --git a/lisp/window.el b/lisp/window.el
index 06d5cfc0077..78f41058659 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6099,8 +6099,7 @@ window--state-get-1
             ,@(when next-buffers
                 `((next-buffers
                    . ,(if writable
-                          (mapcar (lambda (buffer) (buffer-name buffer))
-                                  next-buffers)
+                          (mapcar #'buffer-name next-buffers)
                         next-buffers))))
             ,@(when prev-buffers
                 `((prev-buffers
diff --git a/test/lisp/emacs-lisp/shortdoc-tests.el b/test/lisp/emacs-lisp/shortdoc-tests.el
index 596b47d2543..5706e23e046 100644
--- a/test/lisp/emacs-lisp/shortdoc-tests.el
+++ b/test/lisp/emacs-lisp/shortdoc-tests.el
@@ -56,7 +56,7 @@ shortdoc-all-functions-fboundp
 
 (ert-deftest shortdoc-all-groups-work ()
   "Test that all defined shortdoc groups display correctly."
-  (dolist (group (mapcar (lambda (x) (car x)) shortdoc--groups))
+  (dolist (group (mapcar #'car shortdoc--groups))
     (let ((buf-name (format "*Shortdoc %s*" group)) buf)
       (unwind-protect
           (progn
-- 
2.42.0


             reply	other threads:[~2023-10-29 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 13:02 Stefan Kangas [this message]
2023-10-29 19:03 ` bug#66816: [PATCH] Delete redundant lambdas around unary functions Mattias Engdegård
2023-10-29 21:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-30  8:56     ` Mattias Engdegård
2023-10-30 15:00       ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmmvSJuoJrnAPnLWhr-LRmGHk9=XjpqNi-mD=00iEQs=sA@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=66816@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).