unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30065: 27.0.50; Use map-y-or-n-p in bibtex-reformat
@ 2018-01-10 14:33 Basil L. Contovounesios
  2018-01-20 12:21 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Basil L. Contovounesios @ 2018-01-10 14:33 UTC (permalink / raw)
  To: 30065

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-lisp-textmodes-bibtex.el-bibtex-reformat-Use-map-y-o.patch --]
[-- Type: text/x-diff, Size: 3868 bytes --]

From 68a207bbe1b6a6096e5a9c0c1c333315c7aab181 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Wed, 10 Jan 2018 14:06:20 +0000
Subject: [PATCH] * lisp/textmodes/bibtex.el (bibtex-reformat): Use
 map-y-or-n-p.

---
 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 a30e146892..b9f1720518 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -4925,23 +4925,26 @@ bibtex-reformat
           (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.
-- 
2.15.1


[-- Attachment #2: Type: text/plain, Size: 606 bytes --]


I attach a patch for the function bibtex-reformat in
lisp/textmodes/bibtex.el to avail of the function and flexibility of
map-y-or-n-p instead of emulating it.

If bug reports are not the preferable channel for such minor
suggestions, please let me know what to do in the future.

Thanks,

-- 
Basil

In GNU Emacs 27.0.50 (build 13, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-01-03 built on thunk
Repository revision: f8b4e87d5d4f57954b50677add76ce5136211dc1
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description: Debian GNU/Linux testing (buster)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#30065: 27.0.50; Use map-y-or-n-p in bibtex-reformat
  2018-01-10 14:33 bug#30065: 27.0.50; Use map-y-or-n-p in bibtex-reformat Basil L. Contovounesios
@ 2018-01-20 12:21 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2018-01-20 12:21 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 30065-done

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Date: Wed, 10 Jan 2018 14:33:51 +0000
> 
> I attach a patch for the function bibtex-reformat in
> lisp/textmodes/bibtex.el to avail of the function and flexibility of
> map-y-or-n-p instead of emulating it.

Thanks, pushed to the master branch.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-20 12:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 14:33 bug#30065: 27.0.50; Use map-y-or-n-p in bibtex-reformat Basil L. Contovounesios
2018-01-20 12:21 ` Eli Zaretskii

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).