emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Remove redundant 'function's around lambda
Date: Tue, 17 Nov 2020 08:55:11 -0800	[thread overview]
Message-ID: <CADwFkmkAUou5nT7fb1j2yj2cF4OdM=mLmZfKTJCBRCk0h7YZMA@mail.gmail.com> (raw)

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

I've been working on removing redundant `function' around `lambda' in
Emacs core, so here is a patch which does the same for Org-mode.  Note
that Info node `(elisp) Anonymous Functions' says that:

     The read syntax ‘#'’ is a short-hand for using ‘function’.  The
  following forms are all equivalent:

       (lambda (x) (* x x))
       (function (lambda (x) (* x x)))
       #'(lambda (x) (* x x))

IOW, we can safely remove the wrapped `function' form.

Please see the attached.  (My copyright assignment is on file.)

[-- Attachment #2: 0001-Remove-redundant-function-s-around-lambda.patch --]
[-- Type: text/x-diff, Size: 26882 bytes --]

From 7604ccc02a60334ef5c2135c5fb3abae4bed2468 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Tue, 17 Nov 2020 17:35:49 +0100
Subject: [PATCH] Remove redundant 'function's around lambda

* contrib/lisp/org-secretary.el (join):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-project-plan):
* lisp/org-clock.el (org-resolve-clocks):
* lisp/org-element.el (org-element--interpret-affiliated-keywords):
* lisp/org-list.el (org-list-struct, org-list-get-item-number)
(org-list-separating-blank-lines-number)
(org-list-struct-fix-bul, org-list-struct-apply-struct):
* lisp/org.el (org-agenda-files, org-toggle-heading):
* lisp/ox-ascii.el (org-ascii-table-row):
* lisp/ox-beamer.el (org-beamer--format-section)
(org-beamer-template):
* lisp/ox-odt.el (org-odt--image-size)
(org-odt--render-image/formula):
* testing/org-batch-test-init.el (load-path): Remove redundant
'function's around lambda.
---
 contrib/lisp/org-secretary.el  |   2 +-
 contrib/lisp/ox-taskjuggler.el |   5 +-
 lisp/org-clock.el              |  13 +-
 lisp/org-element.el            |  25 ++-
 lisp/org-list.el               | 326 ++++++++++++++++-----------------
 lisp/org.el                    |  22 +--
 lisp/ox-ascii.el               |  53 +++---
 lisp/ox-beamer.el              |  32 ++--
 lisp/ox-odt.el                 |  25 ++-
 testing/org-batch-test-init.el |   6 +-
 10 files changed, 246 insertions(+), 263 deletions(-)

diff --git a/contrib/lisp/org-secretary.el b/contrib/lisp/org-secretary.el
index babfb7539..654fcc1a0 100644
--- a/contrib/lisp/org-secretary.el
+++ b/contrib/lisp/org-secretary.el
@@ -177,7 +177,7 @@
 (global-set-key "\C-cj" 'org-sec-tag-entry)
 
 (defun join (lst sep &optional pre post)
-  (mapconcat (function (lambda (x) (concat pre x post))) lst sep))
+  (mapconcat (lambda (x) (concat pre x post)) lst sep))
 
 (defun org-sec-get-with ()
   (if org-sec-with
diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 8c43b0629..93088144c 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -720,9 +720,8 @@ Return complete project plan as a string in TaskJuggler syntax."
 	      (mapconcat
 	       'org-element-normalize-string
 	       (mapcar
-		(function
-		 (lambda (report)
-		   (replace-regexp-in-string "%title" report-title  report t t)))
+		(lambda (report)
+		  (replace-regexp-in-string "%title" report-title  report t t))
 		org-taskjuggler-default-reports) "")))))))))
 
 (defun org-taskjuggler--build-project (project info)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 9efd99be8..6c7a797ff 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1164,13 +1164,12 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
 		  (org-clock-resolve
 		   clock
 		   (or prompt-fn
-		       (function
-			(lambda (clock)
-			  (format
-			   "Dangling clock started %d mins ago"
-			   (floor (org-time-convert-to-integer
-                                   (org-time-since (cdr clock)))
-                                  60)))))
+		       (lambda (clock)
+			 (format
+			  "Dangling clock started %d mins ago"
+			  (floor (org-time-convert-to-integer
+				  (org-time-since (cdr clock)))
+				 60))))
 		   (or last-valid
 		       (cdr clock)))))))))))
 
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 2ad557d21..a2582b822 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4655,19 +4655,18 @@ to interpret.  Return Org syntax as a string."
   "Return ELEMENT's affiliated keywords as Org syntax.
 If there is no affiliated keyword, return the empty string."
   (let ((keyword-to-org
-	 (function
-	  (lambda (key value)
-	    (let (dual)
-	      (when (member key org-element-dual-keywords)
-		(setq dual (cdr value) value (car value)))
-	      (concat "#+" (downcase key)
-		      (and dual
-			   (format "[%s]" (org-element-interpret-data dual)))
-		      ": "
-		      (if (member key org-element-parsed-keywords)
-			  (org-element-interpret-data value)
-			value)
-		      "\n"))))))
+	 (lambda (key value)
+	   (let (dual)
+	     (when (member key org-element-dual-keywords)
+	       (setq dual (cdr value) value (car value)))
+	     (concat "#+" (downcase key)
+		     (and dual
+			  (format "[%s]" (org-element-interpret-data dual)))
+		     ": "
+		     (if (member key org-element-parsed-keywords)
+			 (org-element-interpret-data value)
+		       value)
+		     "\n")))))
     (mapconcat
      (lambda (prop)
        (let ((value (org-element-property prop element))
diff --git a/lisp/org-list.el b/lisp/org-list.el
index b8383283b..312f08a33 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -600,25 +600,23 @@ Assume point is at an item."
 	   (beg-cell (cons (point) (current-indentation)))
            itm-lst itm-lst-2 end-lst end-lst-2 struct
 	   (assoc-at-point
-	    (function
-	     ;; Return association at point.
-	     (lambda (ind)
-	       (looking-at org-list-full-item-re)
-	       (let ((bullet (match-string-no-properties 1)))
-		 (list (point)
-		       ind
-		       bullet
-		       (match-string-no-properties 2) ; counter
-		       (match-string-no-properties 3) ; checkbox
-		       ;; Description tag.
-		       (and (string-match-p "[-+*]" bullet)
-			    (match-string-no-properties 4)))))))
+	    ;; Return association at point.
+	    (lambda (ind)
+	      (looking-at org-list-full-item-re)
+	      (let ((bullet (match-string-no-properties 1)))
+		(list (point)
+		      ind
+		      bullet
+		      (match-string-no-properties 2) ; counter
+		      (match-string-no-properties 3) ; checkbox
+		      ;; Description tag.
+		      (and (string-match-p "[-+*]" bullet)
+			   (match-string-no-properties 4))))))
 	   (end-before-blank
-	    (function
-	     ;; Ensure list ends at the first blank line.
-	     (lambda ()
-	       (skip-chars-backward " \r\t\n")
-	       (min (1+ (point-at-eol)) lim-down)))))
+	    ;; Ensure list ends at the first blank line.
+	    (lambda ()
+	      (skip-chars-backward " \r\t\n")
+	      (min (1+ (point-at-eol)) lim-down))))
       ;; 1. Read list from starting item to its beginning, and save
       ;;    top item position and indentation in BEG-CELL.  Also store
       ;;    ending position of items in END-LST.
@@ -1003,23 +1001,22 @@ alist of ancestors, as returned by `org-list-parents-alist'.
 Return value is a list of integers.  Counters have an impact on
 that value."
   (let ((get-relative-number
-	 (function
-	  (lambda (item struct prevs)
-	    ;; Return relative sequence number of ITEM in the sub-list
-	    ;; it belongs.  STRUCT is the list structure.  PREVS is
-	    ;; the alist of previous items.
-	    (let ((seq 0) (pos item) counter)
-	      (while (and (not (setq counter (org-list-get-counter pos struct)))
-			  (setq pos (org-list-get-prev-item pos struct prevs)))
-		(cl-incf seq))
-	      (if (not counter) (1+ seq)
-		(cond
-		 ((string-match "[A-Za-z]" counter)
-		  (+ (- (string-to-char (upcase (match-string 0 counter))) 64)
-		     seq))
-		 ((string-match "[0-9]+" counter)
-		  (+ (string-to-number (match-string 0 counter)) seq))
-		 (t (1+ seq)))))))))
+	 (lambda (item struct prevs)
+	   ;; Return relative sequence number of ITEM in the sub-list
+	   ;; it belongs.  STRUCT is the list structure.  PREVS is
+	   ;; the alist of previous items.
+	   (let ((seq 0) (pos item) counter)
+	     (while (and (not (setq counter (org-list-get-counter pos struct)))
+			 (setq pos (org-list-get-prev-item pos struct prevs)))
+	       (cl-incf seq))
+	     (if (not counter) (1+ seq)
+	       (cond
+		((string-match "[A-Za-z]" counter)
+		 (+ (- (string-to-char (upcase (match-string 0 counter))) 64)
+		    seq))
+		((string-match "[0-9]+" counter)
+		 (+ (string-to-number (match-string 0 counter)) seq))
+		(t (1+ seq))))))))
     ;; Cons each parent relative number into return value (OUT).
     (let ((out (list (funcall get-relative-number item struct prevs)))
 	  (parent item))
@@ -1181,14 +1178,13 @@ some heuristics to guess the result."
 	   (cdr (assq 'plain-list-item org-blank-before-new-entry)))
 	  usr-blank
 	  (count-blanks
-	   (function
-	    (lambda ()
-	      ;; Count blank lines above beginning of line.
-	      (save-excursion
-		(count-lines (goto-char (point-at-bol))
-			     (progn (skip-chars-backward " \r\t\n")
-				    (forward-line)
-				    (point))))))))
+	   (lambda ()
+	     ;; Count blank lines above beginning of line.
+	     (save-excursion
+	       (count-lines (goto-char (point-at-bol))
+			    (progn (skip-chars-backward " \r\t\n")
+				   (forward-line)
+				   (point)))))))
       (cond
        ;; Trivial cases where there should be none.
        ((not insert-blank-p) 0)
@@ -1651,65 +1647,64 @@ PREVS is the alist of previous items, as returned by
 This function modifies STRUCT."
   (let ((case-fold-search nil)
 	(fix-bul
-	 (function
-	  ;; Set bullet of ITEM in STRUCT, depending on the type of
-	  ;; first item of the list, the previous bullet and counter
-	  ;; if any.
-	  (lambda (item)
-	    (let* ((prev (org-list-get-prev-item item struct prevs))
-		   (prev-bul (and prev (org-list-get-bullet prev struct)))
-		   (counter (org-list-get-counter item struct))
-		   (bullet (org-list-get-bullet item struct))
-		   (alphap (and (not prev)
-				(org-list-use-alpha-bul-p item struct prevs))))
-	      (org-list-set-bullet
-	       item struct
-	       (org-list-bullet-string
-		(cond
-		 ;; Alpha counter in alpha list: use counter.
-		 ((and prev counter
-		       (string-match "[a-zA-Z]" counter)
-		       (string-match "[a-zA-Z]" prev-bul))
-		  ;; Use cond to be sure `string-match' is used in
-		  ;; both cases.
-		  (let ((real-count
-			 (cond
-			  ((string-match "[a-z]" prev-bul) (downcase counter))
-			  ((string-match "[A-Z]" prev-bul) (upcase counter)))))
-		    (replace-match real-count nil nil prev-bul)))
-		 ;; Num counter in a num list: use counter.
-		 ((and prev counter
-		       (string-match "[0-9]+" counter)
-		       (string-match "[0-9]+" prev-bul))
-		  (replace-match counter nil nil prev-bul))
-		 ;; No counter: increase, if needed, previous bullet.
-		 (prev
-		  (org-list-inc-bullet-maybe (org-list-get-bullet prev struct)))
-		 ;; Alpha counter at first item: use counter.
-		 ((and counter (org-list-use-alpha-bul-p item struct prevs)
-		       (string-match "[A-Za-z]" counter)
-		       (string-match "[A-Za-z]" bullet))
-		  (let ((real-count
-			 (cond
-			  ((string-match "[a-z]" bullet) (downcase counter))
-			  ((string-match "[A-Z]" bullet) (upcase counter)))))
-		    (replace-match real-count nil nil bullet)))
-		 ;; Num counter at first item: use counter.
-		 ((and counter
-		       (string-match "[0-9]+" counter)
-		       (string-match "[0-9]+" bullet))
-		  (replace-match counter nil nil bullet))
-		 ;; First bullet is alpha uppercase: use "A".
-		 ((and alphap (string-match "[A-Z]" bullet))
-		  (replace-match "A" nil nil bullet))
-		 ;; First bullet is alpha lowercase: use "a".
-		 ((and alphap (string-match "[a-z]" bullet))
-		  (replace-match "a" nil nil bullet))
-		 ;; First bullet is num: use "1".
-		 ((string-match "\\([0-9]+\\|[A-Za-z]\\)" bullet)
-		  (replace-match "1" nil nil bullet))
-		 ;; Not an ordered list: keep bullet.
-		 (t bullet)))))))))
+	 ;; Set bullet of ITEM in STRUCT, depending on the type of
+	 ;; first item of the list, the previous bullet and counter
+	 ;; if any.
+	 (lambda (item)
+	   (let* ((prev (org-list-get-prev-item item struct prevs))
+		  (prev-bul (and prev (org-list-get-bullet prev struct)))
+		  (counter (org-list-get-counter item struct))
+		  (bullet (org-list-get-bullet item struct))
+		  (alphap (and (not prev)
+			       (org-list-use-alpha-bul-p item struct prevs))))
+	     (org-list-set-bullet
+	      item struct
+	      (org-list-bullet-string
+	       (cond
+		;; Alpha counter in alpha list: use counter.
+		((and prev counter
+		      (string-match "[a-zA-Z]" counter)
+		      (string-match "[a-zA-Z]" prev-bul))
+		 ;; Use cond to be sure `string-match' is used in
+		 ;; both cases.
+		 (let ((real-count
+			(cond
+			 ((string-match "[a-z]" prev-bul) (downcase counter))
+			 ((string-match "[A-Z]" prev-bul) (upcase counter)))))
+		   (replace-match real-count nil nil prev-bul)))
+		;; Num counter in a num list: use counter.
+		((and prev counter
+		      (string-match "[0-9]+" counter)
+		      (string-match "[0-9]+" prev-bul))
+		 (replace-match counter nil nil prev-bul))
+		;; No counter: increase, if needed, previous bullet.
+		(prev
+		 (org-list-inc-bullet-maybe (org-list-get-bullet prev struct)))
+		;; Alpha counter at first item: use counter.
+		((and counter (org-list-use-alpha-bul-p item struct prevs)
+		      (string-match "[A-Za-z]" counter)
+		      (string-match "[A-Za-z]" bullet))
+		 (let ((real-count
+			(cond
+			 ((string-match "[a-z]" bullet) (downcase counter))
+			 ((string-match "[A-Z]" bullet) (upcase counter)))))
+		   (replace-match real-count nil nil bullet)))
+		;; Num counter at first item: use counter.
+		((and counter
+		      (string-match "[0-9]+" counter)
+		      (string-match "[0-9]+" bullet))
+		 (replace-match counter nil nil bullet))
+		;; First bullet is alpha uppercase: use "A".
+		((and alphap (string-match "[A-Z]" bullet))
+		 (replace-match "A" nil nil bullet))
+		;; First bullet is alpha lowercase: use "a".
+		((and alphap (string-match "[a-z]" bullet))
+		 (replace-match "a" nil nil bullet))
+		;; First bullet is num: use "1".
+		((string-match "\\([0-9]+\\|[A-Za-z]\\)" bullet)
+		 (replace-match "1" nil nil bullet))
+		;; Not an ordered list: keep bullet.
+		(t bullet))))))))
     (mapc fix-bul (mapcar #'car struct))))
 
 (defun org-list-struct-fix-ind (struct parents &optional bullet-size)
@@ -1755,21 +1750,20 @@ all others cases, the return value will be nil.
 This function modifies STRUCT."
   (let ((all-items (mapcar #'car struct))
 	(set-parent-box
-	 (function
-	  (lambda (item)
-	    (let* ((box-list
-		    (mapcar (lambda (child)
-			      (org-list-get-checkbox child struct))
-			    (org-list-get-children item struct parents))))
-	      (org-list-set-checkbox
-	       item struct
-	       (cond
-		((and (member "[ ]" box-list) (member "[X]" box-list)) "[-]")
-		((member "[-]" box-list) "[-]")
-		((member "[X]" box-list) "[X]")
-		((member "[ ]" box-list) "[ ]")
-		;; Parent has no boxed child: leave box as-is.
-		(t (org-list-get-checkbox item struct))))))))
+	 (lambda (item)
+	   (let* ((box-list
+		   (mapcar (lambda (child)
+			     (org-list-get-checkbox child struct))
+			   (org-list-get-children item struct parents))))
+	     (org-list-set-checkbox
+	      item struct
+	      (cond
+	       ((and (member "[ ]" box-list) (member "[X]" box-list)) "[-]")
+	       ((member "[-]" box-list) "[-]")
+	       ((member "[X]" box-list) "[X]")
+	       ((member "[ ]" box-list) "[ ]")
+	       ;; Parent has no boxed child: leave box as-is.
+	       (t (org-list-get-checkbox item struct)))))))
 	parent-list)
     ;; 1. List all parents with a checkbox.
     (mapc
@@ -1840,56 +1834,54 @@ Initial position of cursor is restored after the changes."
 			     (org-inlinetask-outline-regexp)))
 	 (item-re (org-item-re))
 	 (shift-body-ind
-	  (function
-	   ;; Shift the indentation between END and BEG by DELTA.
-	   ;; Start from the line before END.
-	   (lambda (end beg delta)
-	     (goto-char end)
-	     (skip-chars-backward " \r\t\n")
-	     (beginning-of-line)
-	     (while (or (> (point) beg)
-			(and (= (point) beg)
-			     (not (looking-at item-re))))
-	       (cond
-		;; Skip inline tasks.
-		((and inlinetask-re (looking-at inlinetask-re))
-		 (org-inlinetask-goto-beginning))
-		;; Shift only non-empty lines.
-		((looking-at-p "^[ \t]*\\S-")
-		 (indent-line-to (+ (current-indentation) delta))))
-	       (forward-line -1)))))
-         (modify-item
-          (function
-	   ;; Replace ITEM first line elements with new elements from
-	   ;; STRUCT, if appropriate.
-	   (lambda (item)
-	     (goto-char item)
-	     (let* ((new-ind (org-list-get-ind item struct))
-		    (old-ind (current-indentation))
-		    (new-bul (org-list-bullet-string
-			      (org-list-get-bullet item struct)))
-		    (old-bul (org-list-get-bullet item old-struct))
-		    (new-box (org-list-get-checkbox item struct)))
-	       (looking-at org-list-full-item-re)
-	       ;; a.  Replace bullet
-	       (unless (equal old-bul new-bul)
-		 (replace-match new-bul nil nil nil 1))
-	       ;; b.  Replace checkbox.
-	       (cond
-		((equal (match-string 3) new-box))
-		((and (match-string 3) new-box)
-		 (replace-match new-box nil nil nil 3))
-		((match-string 3)
-		 (looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)")
-		 (replace-match "" nil nil nil 1))
-		(t (let ((counterp (match-end 2)))
-		     (goto-char (if counterp (1+ counterp) (match-end 1)))
-		     (insert (concat new-box (unless counterp " "))))))
-	       ;; c.  Indent item to appropriate column.
-	       (unless (= new-ind old-ind)
-		 (delete-region (goto-char (point-at-bol))
-				(progn (skip-chars-forward " \t") (point)))
-		 (indent-to new-ind)))))))
+	  ;; Shift the indentation between END and BEG by DELTA.
+	  ;; Start from the line before END.
+	  (lambda (end beg delta)
+	    (goto-char end)
+	    (skip-chars-backward " \r\t\n")
+	    (beginning-of-line)
+	    (while (or (> (point) beg)
+		       (and (= (point) beg)
+			    (not (looking-at item-re))))
+	      (cond
+	       ;; Skip inline tasks.
+	       ((and inlinetask-re (looking-at inlinetask-re))
+		(org-inlinetask-goto-beginning))
+	       ;; Shift only non-empty lines.
+	       ((looking-at-p "^[ \t]*\\S-")
+		(indent-line-to (+ (current-indentation) delta))))
+	      (forward-line -1))))
+	 (modify-item
+	  ;; Replace ITEM first line elements with new elements from
+	  ;; STRUCT, if appropriate.
+	  (lambda (item)
+	    (goto-char item)
+	    (let* ((new-ind (org-list-get-ind item struct))
+		   (old-ind (current-indentation))
+		   (new-bul (org-list-bullet-string
+			     (org-list-get-bullet item struct)))
+		   (old-bul (org-list-get-bullet item old-struct))
+		   (new-box (org-list-get-checkbox item struct)))
+	      (looking-at org-list-full-item-re)
+	      ;; a.  Replace bullet
+	      (unless (equal old-bul new-bul)
+		(replace-match new-bul nil nil nil 1))
+	      ;; b.  Replace checkbox.
+	      (cond
+	       ((equal (match-string 3) new-box))
+	       ((and (match-string 3) new-box)
+		(replace-match new-box nil nil nil 3))
+	       ((match-string 3)
+		(looking-at ".*?\\([ \t]*\\[[ X-]\\]\\)")
+		(replace-match "" nil nil nil 1))
+	       (t (let ((counterp (match-end 2)))
+		    (goto-char (if counterp (1+ counterp) (match-end 1)))
+		    (insert (concat new-box (unless counterp " "))))))
+	      ;; c.  Indent item to appropriate column.
+	      (unless (= new-ind old-ind)
+		(delete-region (goto-char (point-at-bol))
+			       (progn (skip-chars-forward " \t") (point)))
+		(indent-to new-ind))))))
     ;; 1. First get list of items and position endings.  We maintain
     ;;    two alists: ITM-SHIFT, determining indentation shift needed
     ;;    at item, and END-LIST, a pseudo-alist where key is ending
diff --git a/lisp/org.el b/lisp/org.el
index 2b50f94ee..54064ec8a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15322,9 +15322,8 @@ used by the agenda files.  If ARCHIVE is `ifmode', do this only if
 			       files)))
     (when org-agenda-skip-unavailable-files
       (setq files (delq nil
-			(mapcar (function
-				 (lambda (file)
-				   (and (file-readable-p file) file)))
+			(mapcar (lambda (file)
+				  (and (file-readable-p file) file))
 				files))))
     (when (or (eq archives t)
 	      (and (eq archives 'ifmode) (eq org-agenda-archives-mode t)))
@@ -17942,15 +17941,14 @@ when a numeric prefix argument is given, its value determines the
 number of stars to add."
   (interactive "P")
   (let ((skip-blanks
-	 (function
-	  ;; Return beginning of first non-blank line, starting from
-	  ;; line at POS.
-	  (lambda (pos)
-	    (save-excursion
-	      (goto-char pos)
-	      (while (org-at-comment-p) (forward-line))
-	      (skip-chars-forward " \r\t\n")
-	      (point-at-bol)))))
+	 ;; Return beginning of first non-blank line, starting from
+	 ;; line at POS.
+	 (lambda (pos)
+	   (save-excursion
+	     (goto-char pos)
+	     (while (org-at-comment-p) (forward-line))
+	     (skip-chars-forward " \r\t\n")
+	     (point-at-bol))))
 	beg end toggled)
     ;; Determine boundaries of changes.  If a universal prefix has
     ;; been given, put the list in a region.  If region ends at a bol,
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index e5240f5c8..a2a9a9c06 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -1940,33 +1940,32 @@ CONTENTS is the row contents.  INFO is a plist used as
 a communication channel."
   (when (eq (org-element-property :type table-row) 'standard)
     (let ((build-hline
-	   (function
-	    (lambda (lcorner horiz vert rcorner)
-	      (concat
-	       (apply
-		'concat
-		(org-element-map table-row 'table-cell
-		  (lambda (cell)
-		    (let ((width (org-ascii--table-cell-width cell info))
-			  (borders (org-export-table-cell-borders cell info)))
-		      (concat
-		       ;; In order to know if CELL starts the row, do
-		       ;; not compare it with the first cell in the
-		       ;; row as there might be a special column.
-		       ;; Instead, compare it with first exportable
-		       ;; cell, obtained with `org-element-map'.
-		       (when (and (memq 'left borders)
-				  (eq (org-element-map table-row 'table-cell
-					'identity info t)
-				      cell))
-			 lcorner)
-		       (make-string (+ 2 width) (string-to-char horiz))
-		       (cond
-			((not (memq 'right borders)) nil)
-			((eq (car (last (org-element-contents table-row))) cell)
-			 rcorner)
-			(t vert)))))
-		  info)) "\n"))))
+	   (lambda (lcorner horiz vert rcorner)
+	     (concat
+	      (apply
+	       'concat
+	       (org-element-map table-row 'table-cell
+		 (lambda (cell)
+		   (let ((width (org-ascii--table-cell-width cell info))
+			 (borders (org-export-table-cell-borders cell info)))
+		     (concat
+		      ;; In order to know if CELL starts the row, do
+		      ;; not compare it with the first cell in the
+		      ;; row as there might be a special column.
+		      ;; Instead, compare it with first exportable
+		      ;; cell, obtained with `org-element-map'.
+		      (when (and (memq 'left borders)
+				 (eq (org-element-map table-row 'table-cell
+				       'identity info t)
+				     cell))
+			lcorner)
+		      (make-string (+ 2 width) (string-to-char horiz))
+		      (cond
+		       ((not (memq 'right borders)) nil)
+		       ((eq (car (last (org-element-contents table-row))) cell)
+			rcorner)
+		       (t vert)))))
+		 info)) "\n")))
 	  (utf8p (eq (plist-get info :ascii-charset) 'utf-8))
 	  (borders (org-export-table-cell-borders
 		    (org-element-map table-row 'table-cell 'identity info t)
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 66589fac5..ebc13259a 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -379,12 +379,11 @@ used as a communication channel."
 	   :parent 'latex
 	   :transcoders
 	   (let ((protected-output
-		  (function
-		   (lambda (object contents info)
-		     (let ((code (org-export-with-backend
-				  'beamer object contents info)))
-		       (if (org-string-nw-p code) (concat "\\protect" code)
-			 code))))))
+		  (lambda (object contents info)
+		    (let ((code (org-export-with-backend
+				 'beamer object contents info)))
+		      (if (org-string-nw-p code) (concat "\\protect" code)
+			code)))))
 	     (mapcar #'(lambda (type) (cons type protected-output))
 		     '(bold footnote-reference italic strike-through timestamp
 			    underline))))
@@ -812,17 +811,16 @@ holding export options."
      (org-latex-make-preamble info)
      ;; Insert themes.
      (let ((format-theme
-	    (function
-	     (lambda (prop command)
-	       (let ((theme (plist-get info prop)))
-		 (when theme
-		   (concat command
-			   (if (not (string-match "\\[.*\\]" theme))
-			       (format "{%s}\n" theme)
-			     (format "%s{%s}\n"
-				     (match-string 0 theme)
-				     (org-trim
-				      (replace-match "" nil nil theme)))))))))))
+	    (lambda (prop command)
+	      (let ((theme (plist-get info prop)))
+		(when theme
+		  (concat command
+			  (if (not (string-match "\\[.*\\]" theme))
+			      (format "{%s}\n" theme)
+			    (format "%s{%s}\n"
+				    (match-string 0 theme)
+				    (org-trim
+				     (replace-match "" nil nil theme))))))))))
        (mapconcat (lambda (args) (apply format-theme args))
 		  '((:beamer-theme "\\usetheme")
 		    (:beamer-color-theme "\\usecolortheme")
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 4a0cca612..da351ef82 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2200,10 +2200,10 @@ SHORT-CAPTION are strings."
 (defun org-odt--image-size
   (file info &optional user-width user-height scale dpi embed-as)
   (let* ((--pixels-to-cms
-          (lambda (pixels dpi)
-            (let ((cms-per-inch 2.54)
-                  (inches (/ pixels dpi)))
-              (* cms-per-inch inches))))
+	  (lambda (pixels dpi)
+	    (let ((cms-per-inch 2.54)
+		  (inches (/ pixels dpi)))
+	      (* cms-per-inch inches))))
 	 (--size-in-cms
 	  (lambda (size-in-pixels dpi)
 	    (and size-in-pixels
@@ -2467,15 +2467,14 @@ used as a communication channel."
 	 (outer (nth 2 frame-cfg))
 	 ;; User-specified frame params (from #+ATTR_ODT spec)
 	 (user user-frame-params)
-	 (--merge-frame-params (function
-				(lambda (default user)
-				  "Merge default and user frame params."
-				  (if (not user) default
-				    (cl-assert (= (length default) 3))
-				    (cl-assert (= (length user) 3))
-				    (cl-loop for u in user
-					     for d in default
-					     collect (or u d)))))))
+	 (--merge-frame-params (lambda (default user)
+				 "Merge default and user frame params."
+				 (if (not user) default
+				   (cl-assert (= (length default) 3))
+				   (cl-assert (= (length user) 3))
+				   (cl-loop for u in user
+					    for d in default
+					    collect (or u d))))))
     (cond
      ;; Case 1: Image/Formula has no caption.
      ;;         There is only one frame, one that surrounds the image
diff --git a/testing/org-batch-test-init.el b/testing/org-batch-test-init.el
index 863875617..87216cffd 100644
--- a/testing/org-batch-test-init.el
+++ b/testing/org-batch-test-init.el
@@ -5,9 +5,9 @@
 ;; clean load-path
 (setq load-path
       (delq nil (mapcar
-		 (function (lambda (p)
-			     (unless (string-match "lisp\\(/packages\\)?/org$" p)
-			       p)))
+		 (lambda (p)
+		   (unless (string-match "lisp\\(/packages\\)?/org$" p)
+		     p))
 		 load-path)))
 ;; remove property list to defeat cus-load and remove autoloads
 (mapatoms (function  (lambda (s)
-- 
2.29.2


             reply	other threads:[~2020-11-17 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 16:55 Stefan Kangas [this message]
2020-11-19  3:07 ` [PATCH] Remove redundant 'function's around lambda Kyle Meyer
2020-11-19  3:44   ` Stefan Kangas
2020-12-14  6:49   ` Bastien
2020-12-23  5:11     ` Kyle Meyer
2020-11-19 10:44 ` Neil Jerram
2020-11-19 14:51   ` Stefan Kangas
2020-11-19 15:16     ` Neil Jerram

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.orgmode.org/

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

  git send-email \
    --in-reply-to='CADwFkmkAUou5nT7fb1j2yj2cF4OdM=mLmZfKTJCBRCk0h7YZMA@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=emacs-orgmode@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/org-mode.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).