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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 14 Nov 2020 17:20:34 +0100

Francesco Potortì <[email-masked]> 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