GNU bug report logs -
#44618
26.3; bibtex.el ignores file variable bibtex-contline-indentation
Previous Next
Reported by: Francesco Potortì <pot <at> gnu.org>
Date: Fri, 13 Nov 2020 12:47:01 UTC
Severity: minor
Merged with 44647
Found in versions 26.3, 27.1.50
Done: "Roland Winkler" <winkler <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44618 in the body.
You can then email your comments to 44618 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44618
; Package
emacs
.
(Fri, 13 Nov 2020 12:47:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Francesco Potortì <pot <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 13 Nov 2020 12:47:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2020-05-17, modified by Debian built on x86-csail-01
I set bibtex-contline-indentation as a file variable, yeet it is ignored
by bibtex-mode.
I am not sure how file variables and minor modes interact, but it looks
like when the minor mode is fired, the local variables have not been
set yet.
Whatever the reason, bibtex-mode sets fill-prefix as a local variable
irrespective of the file variable bibtex-contline-indentation.
The fix for my case is simple: avoid setting fill-prefix as a local
variable in the minor mode, and just set it inside the
bibtex-fill-field-bounds function. A patch follows.
However, I don't know if this is a hint of some more general problem on
how bibtex-mode trets file variables.
--- bibtex-2019.el 2020-11-13 11:54:34.000000000 +0100
+++ bibtex.el 2020-11-13 13:34:24.000000000 +0100
@@ -3399,8 +3409,6 @@
(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 ((?$ . "\"")
@@ -4830,7 +4838,9 @@
"Fill BibTeX field delimited by BOUNDS.
If JUSTIFY is non-nil justify as well.
If optional arg MOVE is non-nil move point to end of field."
- (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))))
(if (not justify)
(goto-char (bibtex-start-of-text-in-field bounds))
(goto-char (bibtex-start-of-field bounds))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44618
; Package
emacs
.
(Sat, 14 Nov 2020 16:21:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 44618 <at> debbugs.gnu.org (full text, mbox):
Francesco Potortì <pot <at> gnu.org> writes:
> Whatever the reason, bibtex-mode sets fill-prefix as a local variable
> irrespective of the file variable bibtex-contline-indentation.
>
> The fix for my case is simple: avoid setting fill-prefix as a local
> variable in the minor mode, and just set it inside the
> bibtex-fill-field-bounds function. A patch follows.
>
> However, I don't know if this is a hint of some more general problem on
> how bibtex-mode trets file variables.
[...]
> - (set (make-local-variable 'fill-prefix)
> - (make-string (+ bibtex-entry-offset bibtex-contline-indentation) ?\s))
[...]
> - (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.
Looking at hack-local-variables/normal-mode, file-local variables are
set after the mode has been set up, so you can't have your mode set up
variables based on file-local variables. (If I'm wrong here, please
somebody correct me.)
So you can't usefully set
bibtex-entry-offset/bibtex-contline-indentation as file-local variables
without also setting fill-prefix that way, I think?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Forcibly Merged 44618 44647.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 16 Nov 2020 22:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44618
; Package
emacs
.
(Mon, 16 Nov 2020 23:32:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 44618 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[bibtex.diff (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44618
; Package
emacs
.
(Mon, 16 Nov 2020 23:38:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 44618 <at> debbugs.gnu.org (full text, mbox):
"Roland Winkler" <winkler <at> gnu.org> writes:
> 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.
If I'm reading the patch correctly, it looks good to me -- it'll still
allow people to set fill-prefix from bibtex-mode-hook, and it fixes the
reported problem in these two bug reports. (I haven't tested the patch,
though, just read it.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Reply sent
to
"Roland Winkler" <winkler <at> gnu.org>
:
You have taken responsibility.
(Wed, 02 Dec 2020 18:39:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Francesco Potortì <pot <at> gnu.org>
:
bug acknowledged by developer.
(Wed, 02 Dec 2020 18:39:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 44618-done <at> debbugs.gnu.org (full text, mbox):
On Tue Nov 17 2020 Lars Ingebrigtsen wrote:
> If I'm reading the patch correctly, it looks good to me -- it'll still
> allow people to set fill-prefix from bibtex-mode-hook, and it fixes the
> reported problem in these two bug reports. (I haven't tested the patch,
> though, just read it.)
Installed as patch d9167d940ac9d0504cc38a044c7cba897c103eaf.
I am closing both bug#44618 and bug#44647.
Reply sent
to
"Roland Winkler" <winkler <at> gnu.org>
:
You have taken responsibility.
(Wed, 02 Dec 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Teemu Likonen <tlikonen <at> iki.fi>
:
bug acknowledged by developer.
(Wed, 02 Dec 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44618
; Package
emacs
.
(Thu, 03 Dec 2020 19:40:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 44618 <at> debbugs.gnu.org (full text, mbox):
>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
Sorry for the delay, I have now managed to test the latest version of
bibtex.el which includes your patch, and it works for me. I made
various tests and I saw no problems.
Thanks
--
fp
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Jan 2021 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 173 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.