]> git.eshelyaron.com Git - emacs.git/commitdiff
New user option bibtex-entry-ask-for-key
authorRoland Winkler <winkler@gnu.org>
Fri, 15 Nov 2024 05:26:23 +0000 (23:26 -0600)
committerEshel Yaron <me@eshelyaron.com>
Wed, 20 Nov 2024 16:11:40 +0000 (17:11 +0100)
(cherry picked from commit cc9188b1900079f87d76cc8b7493d64a9ccd9d36)

etc/NEWS
lisp/textmodes/bibtex.el

index 84f926778875f65295e9785dbfbdc2aeba64dea9..f19ddedacea88d17eb44ae0847578951c92d55e4 100644 (file)
--- 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
 
 ---
index cbcea8af012b27c68bcf30ed242865b25f7688cb..99a97c9bb8ddcef1eb6dd03b509b5ed6921f191d 100644 (file)
@@ -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))