emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9e9b711: Use map-y-or-n-p in bibtex.el


From: Eli Zaretskii
Subject: [Emacs-diffs] master 9e9b711: Use map-y-or-n-p in bibtex.el
Date: Sat, 20 Jan 2018 07:21:05 -0500 (EST)

branch: master
commit 9e9b71189adaa559a7a6b2780ef25578980d9751
Author: Basil L. Contovounesios <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Use map-y-or-n-p in bibtex.el
    
    * lisp/textmodes/bibtex.el (bibtex-reformat): Use map-y-or-n-p.
    (Bug#30065)
---
 lisp/textmodes/bibtex.el | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index f6cc982..15004ed 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -4925,23 +4925,26 @@ If mark is active reformat entries in region, if not in 
whole buffer."
           (cond (read-options
                  (if use-previous-options
                      bibtex-reformat-previous-options
-                   (setq bibtex-reformat-previous-options
-                         (delq nil
-                               (mapcar (lambda (option)
-                                         (if (y-or-n-p (car option)) (cdr 
option)))
-                                       `(("Realign entries (recommended)? " . 
realign)
-                                         ("Remove empty optional and 
alternative fields? " . opts-or-alts)
-                                         ("Remove delimiters around pure 
numerical fields? " . numerical-fields)
-                                         (,(concat (if 
bibtex-comma-after-last-field "Insert" "Remove")
-                                                   " comma at end of entry? ") 
. last-comma)
-                                         ("Replace double page dashes by 
single ones? " . page-dashes)
-                                         ("Delete whitespace at the beginning 
and end of fields? " . whitespace)
-                                         ("Inherit booktitle? " . 
inherit-booktitle)
-                                         ("Force delimiters? " . delimiters)
-                                         ("Unify case of entry types and field 
names? " . unify-case)
-                                         ("Enclose parts of field entries by 
braces? " . braces)
-                                         ("Replace parts of field entries by 
string constants? " . strings)
-                                         ("Sort fields? " . sort-fields)))))))
+                   (let (answers)
+                     (map-y-or-n-p
+                      #'car
+                      (lambda (option)
+                        (push (cdr option) answers))
+                      `(("Realign entries (recommended)? " . realign)
+                        ("Remove empty optional and alternative fields? " . 
opts-or-alts)
+                        ("Remove delimiters around pure numerical fields? " . 
numerical-fields)
+                        (,(concat (if bibtex-comma-after-last-field "Insert" 
"Remove")
+                                  " comma at end of entry? ") . last-comma)
+                        ("Replace double page dashes by single ones? " . 
page-dashes)
+                        ("Delete whitespace at the beginning and end of 
fields? " . whitespace)
+                        ("Inherit booktitle? " . inherit-booktitle)
+                        ("Force delimiters? " . delimiters)
+                        ("Unify case of entry types and field names? " . 
unify-case)
+                        ("Enclose parts of field entries by braces? " . braces)
+                        ("Replace parts of field entries by string constants? 
" . strings)
+                        ("Sort fields? " . sort-fields))
+                      '("formatting action" "formatting actions" "perform"))
+                     (setq bibtex-reformat-previous-options (nreverse 
answers)))))
                 ;; Do not include required-fields because `bibtex-reformat'
                 ;; cannot handle the error messages of `bibtex-format-entry'.
                 ;; Use `bibtex-validate' to check for required fields.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]