From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stephen Leake <stephen_leake@stephe-leake.org>
Cc: 21764@debbugs.gnu.org, "Grégoire Jadi" <gregoire.jadi@univ-nantes.fr>
Subject: bug#21764: 25.0.50; bibtex-set-dialect not called for bibtex buffers
Date: Wed, 12 Aug 2020 14:34:14 +0200 [thread overview]
Message-ID: <87lfikm4ah.fsf@gnus.org> (raw)
In-Reply-To: <8637wbdq4m.fsf@stephe-leake.org> (Stephen Leake's message of "Thu, 12 Nov 2015 12:33:29 -0600")
Stephen Leake <stephen_leake@stephe-leake.org> writes:
> Grégoire Jadi <gregoire.jadi@univ-nantes.fr> writes:
>
>> Below a patch that fixes this bug and with regression tests.
>
> Thanks for writing the test.
>
> This needs a comment on why bibtex-set-dialect is being called, when it
> is also being added to the hook. Better would be to check if there is a
> file associated with the current buffer.
>
> This sets the global value of bibtex-* variables; is that appropriate?
I've re-spun the patch (included below) -- some paths have changed.
Stephen, I'm not sure I understand your questions about this patch -- as
far as I can see, bibtex-set-dialect isn't being added to any hooks?
But I may be misreading the code (I'm not very familiar with it).
You also say that it says the global bibtex variables, but it calls the
function with LOCAL set to t, which the documentation says sets the
local value...
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 0018b89d85..910bd7dbb9 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -3445,6 +3445,7 @@ bibtex-mode
(set (make-local-variable 'syntax-propertize-function)
(syntax-propertize-via-font-lock
bibtex-font-lock-syntactic-keywords))
+ (bibtex-set-dialect nil t)
;; Allow `bibtex-dialect' as a file-local variable.
(add-hook 'hack-local-variables-hook #'bibtex-set-dialect nil t))
diff --git a/test/lisp/textmodes/bibtex-tests.el b/test/lisp/textmodes/bibtex-tests.el
new file mode 100644
index 0000000000..b3858de9e6
--- /dev/null
+++ b/test/lisp/textmodes/bibtex-tests.el
@@ -0,0 +1,57 @@
+;;; bibtex-tests.el --- Test suite for bibtex.
+
+;; Copyright (C) 2013-2020 Free Software Foundation, Inc.
+
+;; Keywords: bibtex
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'bibtex)
+
+(ert-deftest bibtex-test-set-dialect ()
+ "Tests if `bibtex-set-dialect' is executed."
+ (with-temp-buffer
+ (insert "@article{someID,
+ author = {some author},
+ title = {some title},
+}")
+ (bibtex-mode)
+ (should-not (null bibtex-dialect))
+ (should-not (null bibtex-entry-type))
+ (should-not (null bibtex-entry-head))
+ (should-not (null bibtex-reference-key))
+ (should-not (null bibtex-entry-head))
+ (should-not (null bibtex-entry-maybe-empty-head))
+ (should-not (null bibtex-any-valid-entry-type))))
+
+(ert-deftest bibtex-test-parse-buffers-stealthily ()
+ "Tests if `bibtex-parse-buffers-stealthily' can be executed."
+ (with-temp-buffer
+ (insert "@article{someID,
+ author = {some author},
+ title = {some title},
+}")
+ (bibtex-mode)
+ (should (progn (bibtex-parse-buffers-stealthily) t))))
+
+(provide 'bibtex-tests)
+
+;;; bibtex-tests.el ends here
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-08-12 12:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 15:49 bug#21764: 25.0.50; bibtex-set-dialect not called for bibtex buffers Grégoire Jadi
2015-11-12 14:39 ` Grégoire Jadi
2015-11-12 18:33 ` Stephen Leake
2020-08-12 12:34 ` Lars Ingebrigtsen [this message]
2020-08-19 13:36 ` Lars Ingebrigtsen
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=87lfikm4ah.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=21764@debbugs.gnu.org \
--cc=gregoire.jadi@univ-nantes.fr \
--cc=stephen_leake@stephe-leake.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.