Subject: bug#44647: closed (Re: bug#44618: 26.3; bibtex.el ignores file variable bibtex-contline-indentation)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Dec 2020 18:39:02 +0000

Your bug report

#44618: 27.1.50; `bibtex-contline-indentation' doesn't work as file local variable

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
44618: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44618
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#44618: 26.3; bibtex.el ignores file variable bibtex-contline-indentation
From: "Roland Winkler" <[email-masked]>
To: Lars Ingebrigtsen <[email-masked]>
Cc: [email-masked], Teemu Likonen <[email-masked]>, [email-masked], [email-masked]
Date: Wed, 2 Dec 2020 12:38:19 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

Subject: 27.1.50; `bibtex-contline-indentation' doesn't work as file local variable
From: Teemu Likonen <[email-masked]>
To: [email-masked]
Date: Sat, 14 Nov 2020 23:18:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Variable bibtex-contline-indentation does not work as file local
variable. The reason is that bibtex-mode command initializes variable
fill-prefix before the possible file local variable is available. It
gets always the global value of bibtex-contline-indentation.

This can be fixed by locally let-binding fill-prefix every time in the
relevant filling function. Patch for that is attached.

From a776cae4fcd34987e30b6eab3df45bd2ae66fbd9 Mon Sep 17 00:00:00 2001
From: Teemu Likonen <[email-masked]>
Date: Sat, 14 Nov 2020 22:53:18 +0200
Subject: [PATCH] Make `bibtex-contline-indentation' work as file local
 variable

* lisp/textmodes/bibtex.el (bibtex-mode): Don't make fill-prefix a
buffer local variable. It would use the global value, not possible
file local variable.
* lisp/textmodes/bibtex.el (bibtex-fill-field-bounds): Let-bind
fill-prefix variable locally (and dynamically) for use with filling
bibtex fields. The variable is initialized every time by using the
current value of bibtex-contline-indentation variable.
---
 lisp/textmodes/bibtex.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index fcf63ed5ec..151dca6fab 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -3442,8 +3442,6 @@ bibtex-mode
   (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 ((?$ . "\"")
@@ -4902,7 +4900,10 @@ bibtex-fill-field-bounds
   "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 ((end-field (copy-marker (bibtex-end-of-field bounds)))
+        (fill-prefix (make-string (+ bibtex-entry-offset
+                                     bibtex-contline-indentation)
+                                  ?\s)))
     (if (not justify)
         (goto-char (bibtex-start-of-text-in-field bounds))
       (goto-char (bibtex-start-of-field bounds))
-- 
2.20.1