From: Roland Winkler Date: Fri, 15 Nov 2024 05:26:23 +0000 (-0600) Subject: New user option bibtex-entry-ask-for-key X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bd39f65eb407c58f5ca345df41f8694add7547fe;p=emacs.git New user option bibtex-entry-ask-for-key (cherry picked from commit cc9188b1900079f87d76cc8b7493d64a9ccd9d36) --- diff --git a/etc/NEWS b/etc/NEWS index 84f92677887..f19ddedacea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -535,6 +535,12 @@ functionality of the standard 'xref' commands in TeX buffers. You can restore the standard 'etags' backend with the 'M-x xref-etags-mode' toggle. +** BibTeX mode + +--- +*** New user option 'bibtex-entry-ask-for-key'. +When enabled, 'bibtex-entry' asks for a key. + ** Midnight mode --- diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index cbcea8af012..99a97c9bb8d 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -1377,6 +1377,12 @@ and must return a string (the key to use)." :version "28.1" :type 'function) +(defcustom bibtex-entry-ask-for-key t + "If non-nil, `bibtex-entry' asks for a key." + :group 'bibtex + :version "31.1" + :type 'boolean) + (defcustom bibtex-entry-offset 0 "Offset for BibTeX entries. Added to the value of all other variables which determine columns." @@ -3852,7 +3858,8 @@ is non-nil." (let ((completion-ignore-case t)) (list (completing-read "Entry Type: " bibtex-entry-alist nil t nil 'bibtex-entry-type-history)))) - (let ((key (if bibtex-maintain-sorted-entries + (let ((key (if (and bibtex-maintain-sorted-entries + bibtex-entry-ask-for-key) (bibtex-read-key (format "%s key: " entry-type)))) (field-list (bibtex-field-list entry-type))) (unless (bibtex-prepare-new-entry (list key nil entry-type))