all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roland Winkler <winkler@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
	Glenn Morris <rgm@gnu.org>, Francesco Potort=AC <pot@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: master 45a1653: ; Fix last change to bibtex.el
Date: Sat, 28 Nov 2020 16:32:00 -0600	[thread overview]
Message-ID: <87czzx3yfz.fsf@gnu.org> (raw)
In-Reply-To: <39049.45143.465640.24501@gargle.gargle.HOWL> (Roland Winkler's message of "Wed, 18 Nov 2020 15:56:25 -0600")

On Wed, Nov 18 2020, Roland Winkler wrote:
> On Wed Nov 18 2020 Stefan Monnier wrote:
>> And indeed with the :safe keyword you can specify a number of
>> value that can be assumed to be safe, while any other value will
>> be raise alarms.
>
> Thanks, I am always happy to learn new things.  I'll try it out and
> send a patch.

Unless anyone complains I'll apply the following patch.


diff --git a/etc/NEWS b/etc/NEWS
index 2fb33e3..7b4c767 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1349,7 +1349,7 @@ completions with more information in completion prefix and suffix.
 *** User option 'completions-format' supports a new value 'one-column'.
 
 ---
-*** New user option 'bibtex-unify-case-convert'.
+*** New user option 'bibtex-unify-case-function'.
 This new option allows the user to customize how case is converted
 when unifying entries.
 
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index c9e21e5..001941f 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -88,16 +88,6 @@ bibtex-include-OPTkey
                  (const :tag "Default" t))
   :risky t)
 
-(defcustom bibtex-unify-case-convert #'identity
-  "Function called when unifying case on entry and field names.
-It is called with one argument, the entry or field name."
-  :version "28.1"
-  :type '(choice (const :tag "Same case as in `bibtex-field-alist'" identity)
-		 (const :tag "Downcase" downcase)
-		 (const :tag "Capitalize" capitalize)
-		 (const :tag "Upcase" upcase)
-                 (function :tag "Conversion function")))
-
 (defcustom bibtex-user-optional-fields
   '(("annote" "Personal annotation (ignored)"))
   "List of optional fields the user wants to have always present.
@@ -133,7 +123,7 @@ bibtex-entry-format
 delimiters          Change delimiters according to variables
                       `bibtex-field-delimiters' and `bibtex-entry-delimiters'.
 unify-case          Change case of entry and field names according to
-                      `bibtex-unify-case-convert'.
+                      `bibtex-unify-case-function'.
 braces              Enclose parts of field entries by braces according to
                       `bibtex-field-braces-alist'.
 strings             Replace parts of field entries by string constants
@@ -193,6 +183,17 @@ bibtex-field-strings-alist
                        (regexp :tag "From regexp")
                        (regexp :tag "To string constant"))))
 
+(defcustom bibtex-unify-case-function #'identity
+  "Function for unifying case of entry and field names.
+It is called with one argument, the entry or field name."
+  :version "28.1"
+  :type '(choice (const :tag "Same case as in `bibtex-field-alist'" identity)
+		 (const :tag "Downcase" downcase)
+		 (const :tag "Capitalize" capitalize)
+		 (const :tag "Upcase" upcase)
+                 (function :tag "Conversion function"))
+  :safe (lambda (x) (memq x '(upcase downcase capitalize identity))))
+
 (defcustom bibtex-clean-entry-hook nil
   "List of functions to call when entry has been cleaned.
 Functions are called with point inside the cleaned entry, and the buffer
@@ -2357,7 +2358,7 @@ bibtex-format-entry
                 ;; unify case of entry type
                 (when (memq 'unify-case format)
                   (delete-region beg-type end-type)
-                  (insert (funcall bibtex-unify-case-convert (car entry-list))))
+                  (insert (funcall bibtex-unify-case-function (car entry-list))))
 
                 ;; update left entry delimiter
                 (when (memq 'delimiters format)
@@ -2566,7 +2567,7 @@ bibtex-format-entry
 			    (curname (buffer-substring beg-name end-name)))
 			(delete-region beg-name end-name)
 			(goto-char beg-name)
-			(insert (funcall bibtex-unify-case-convert
+			(insert (funcall bibtex-unify-case-function
 					 (or fname curname)))))
 
                     ;; update point



  reply	other threads:[~2020-11-28 22:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201116233108.21940.22514@vcs0.savannah.gnu.org>
     [not found] ` <20201116233110.4E83E209DE@vcs0.savannah.gnu.org>
2020-11-18  1:42   ` master 45a1653: ; Fix last change to bibtex.el Glenn Morris
2020-11-18  4:19     ` Roland Winkler
2020-11-18 12:30       ` Basil L. Contovounesios
2020-11-18 14:13         ` Roland Winkler
2020-11-18 14:36           ` Roland Winkler
2020-11-18 16:35           ` Basil L. Contovounesios
2020-11-18 17:11             ` Roland Winkler
2020-11-18 21:31               ` Stefan Monnier
2020-11-18 21:56                 ` Roland Winkler
2020-11-28 22:32                   ` Roland Winkler [this message]
2020-11-19  5:23               ` Richard Stallman
2020-11-19  8:25                 ` Roland Winkler
2020-11-18 11:47     ` Basil L. Contovounesios
2020-11-18 16:18       ` Basil L. Contovounesios
2020-11-24  6:31         ` Lars Ingebrigtsen
2020-11-24 15:35           ` Eli Zaretskii
2020-11-24 19:26             ` Basil L. Contovounesios
2020-11-24 19:58               ` Eli Zaretskii
2020-11-24 20:25                 ` Eli Zaretskii
2020-11-24 21:01                   ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=87czzx3yfz.fsf@gnu.org \
    --to=winkler@gnu.org \
    --cc=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=pot@gnu.org \
    --cc=rgm@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.