diff options
author | Roland Winkler <winkler@gnu.org> | 2020-12-02 09:47:14 -0600 |
---|---|---|
committer | Roland Winkler <winkler@gnu.org> | 2020-12-02 09:47:14 -0600 |
commit | eff6f0c7f123a79d376f5b06c3a946efb797bb03 (patch) | |
tree | dabae0e0ac00c51acde23917c7ef3c43c26c43e6 /lisp/textmodes/bibtex.el | |
parent | 9f462496ae06dae5e97ec5c68254c88365b850c0 (diff) | |
download | emacs-eff6f0c7f123a79d376f5b06c3a946efb797bb03.tar.gz |
Allow bibtex-unify-case-function as file-local variable
* lisp/textmodes/bibtex.el (bibtex-unify-case-function):
Renamed from bibtex-unify-case-convert. Add :safe attribute.
* etc/NEWS: Update accordingly.
Diffstat (limited to 'lisp/textmodes/bibtex.el')
-rw-r--r-- | lisp/textmodes/bibtex.el | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index c9e21e58f62..001941f96c1 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -88,16 +88,6 @@ If this is a function, call it to generate the initial field text." (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 @@ last-comma Add or delete comma on end of last field in entry, 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 @@ Space characters in REGEXP will be replaced by \"[ \\t\\n]+\"." (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 @@ Formats current entry according to variable `bibtex-entry-format'." ;; 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 @@ Formats current entry according to variable `bibtex-entry-format'." (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 |