From d62df5a257c6a9c02936e88ecb5f6fd95613ebe3 Mon Sep 17 00:00:00 2001 From: Gautier Ponsinet Date: Fri, 8 Nov 2024 15:07:15 +0200 Subject: [PATCH] Add the user option bibtex-entry-ask-for-key * lisp/textmodes/bibtex.el (bibtex-entry-ask-for-key): add the user option. (bibtex-entry): Ask the user for a key if the variable bibtex-entry-ask-for-key is non-nil. --- lisp/textmodes/bibtex.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index cbcea8af012..d26b67dca7b 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -1377,6 +1377,11 @@ ;;; Code: :version "28.1" :type 'function) +(defcustom bibtex-entry-ask-for-key nil + "If non-nil, `bibtex-entry' asks for a key." + :group 'bibtex + :type 'boolean) + (defcustom bibtex-entry-offset 0 "Offset for BibTeX entries. Added to the value of all other variables which determine columns." @@ -3852,7 +3857,7 @@ ;;;###autoload (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 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)) -- 2.47.0