From: "Roland Winkler" <winkler@gnu.org>
To: "Francesco Potort�=AC" <pot@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 44618@debbugs.gnu.org
Subject: bug#44618: 26.3; bibtex.el ignores file variable bibtex-contline-indentation
Date: Mon, 16 Nov 2020 17:31:10 -0600 [thread overview]
Message-ID: <3006.31876.328410.24499@gargle.gargle.HOWL> (raw)
In-Reply-To: <877dqnzz8t.fsf@gnus.org>
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 741 bytes --]
On Sat Nov 14 2020 Lars Ingebrigtsen wrote:
> > - (let ((end-field (copy-marker (bibtex-end-of-field bounds))))
> > + (let ((fill-prefix
> > + (make-string (+ bibtex-entry-offset bibtex-contline-indentation) ?\s))
> > + (end-field (copy-marker (bibtex-end-of-field bounds))))
>
> This patch would make it impossible for people to alter fill-prefix
> (from the mode hook, for instance), so I don't think this is the right
> solution.
Can you please try the attached patch using hack-local-variables-hook?
This was partly inspired by the related comment
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21764#15
which had somehow escaped my attention. The issues mentioned in
this comment should likewise be fixed by the attached patch.
[-- Attachment #2: bibtex.diff --]
[-- Type: application/octet-stream, Size: 3715 bytes --]
--- bibtex.el~ 2020-11-15 21:13:56.440216563 -0600
+++ bibtex.el 2020-11-15 21:28:47.313180062 -0600
@@ -890,7 +890,8 @@
(defcustom bibtex-comment-start "@Comment"
"String starting a BibTeX comment."
:group 'bibtex
- :type 'string)
+ :type 'string
+ :safe #'stringp)
(defcustom bibtex-add-entry-hook nil
"List of functions to call when BibTeX entry has been inserted."
@@ -1219,7 +1220,8 @@
"Offset for BibTeX entries.
Added to the value of all other variables which determine columns."
:group 'bibtex
- :type 'integer)
+ :type 'integer
+ :safe #'integerp)
(defcustom bibtex-field-indentation 2
"Starting column for the name part in BibTeX fields."
@@ -1232,13 +1234,15 @@
"Starting column for the text part in BibTeX fields.
Should be equal to the space needed for the longest name part."
:group 'bibtex
- :type 'integer)
+ :type 'integer
+ :safe #'integerp)
(defcustom bibtex-contline-indentation
(+ bibtex-text-indentation 1)
"Starting column for continuation lines of BibTeX fields."
:group 'bibtex
- :type 'integer)
+ :type 'integer
+ :safe #'integerp)
(defcustom bibtex-align-at-equal-sign nil
"If non-nil, align fields at equal sign instead of field text.
@@ -2941,7 +2945,7 @@
(1+ (match-beginning 3)) (1- (match-end 3)))))
(unless (assoc key crossref-keys)
(push (list key) crossref-keys))))
- ;; We have probably have a non-bibtex file.
+ ;; We probably have a non-bibtex file.
((not (match-beginning bibtex-type-in-head))
(throw 'userkey nil))
;; only keys of known entries
@@ -3435,15 +3439,10 @@
bibtex-parse-keys-timeout t
'bibtex-parse-buffers-stealthily)))
(set (make-local-variable 'paragraph-start) "[ \f\n\t]*$")
- (set (make-local-variable 'comment-start) bibtex-comment-start)
- (set (make-local-variable 'comment-start-skip)
- (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*"))
(set (make-local-variable 'comment-column) 0)
(set (make-local-variable 'defun-prompt-regexp) "^[ \t]*@[[:alnum:]]+[ \t]*")
(set (make-local-variable 'outline-regexp) "[ \t]*@")
(set (make-local-variable 'fill-paragraph-function) #'bibtex-fill-field)
- (set (make-local-variable 'fill-prefix)
- (make-string (+ bibtex-entry-offset bibtex-contline-indentation) ?\s))
(set (make-local-variable 'font-lock-defaults)
'(bibtex-font-lock-keywords
nil t ((?$ . "\"")
@@ -3462,9 +3461,18 @@
(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))
+ (let ((fun (lambda ()
+ (bibtex-set-dialect)
+ (set (make-local-variable 'comment-start) bibtex-comment-start)
+ (set (make-local-variable 'comment-start-skip)
+ (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*"))
+ (set (make-local-variable 'fill-prefix)
+ (make-string (+ bibtex-entry-offset
+ bibtex-contline-indentation)
+ ?\s)))))
+ (if buffer-file-name
+ (add-hook 'hack-local-variables-hook fun nil t)
+ (funcall fun))))
(defun bibtex-entry-alist (dialect)
"Return entry-alist for DIALECT."
next prev parent reply other threads:[~2020-11-16 23:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 12:45 bug#44618: 26.3; bibtex.el ignores file variable bibtex-contline-indentation Francesco Potortì
2020-11-14 16:20 ` Lars Ingebrigtsen
2020-11-16 23:31 ` Roland Winkler [this message]
2020-11-16 23:36 ` Lars Ingebrigtsen
2020-12-02 18:38 ` Roland Winkler
2020-12-03 19:39 ` Francesco Potortì
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=3006.31876.328410.24499@gargle.gargle.HOWL \
--to=winkler@gnu.org \
--cc=44618@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=pot@gnu.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.