all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: 44647@debbugs.gnu.org
Subject: bug#44647: 27.1.50; `bibtex-contline-indentation' doesn't work as file local variable
Date: Sat, 14 Nov 2020 23:18:16 +0200	[thread overview]
Message-ID: <87d00fmycn.fsf@iki.fi> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 393 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Make-bibtex-contline-indentation-work-as-file-local-.patch --]
[-- Type: text/x-diff, Size: 2057 bytes --]

From a776cae4fcd34987e30b6eab3df45bd2ae66fbd9 Mon Sep 17 00:00:00 2001
From: Teemu Likonen <tlikonen@iki.fi>
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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

             reply	other threads:[~2020-11-14 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 21:18 Teemu Likonen [this message]
2020-11-14 21:27 ` bug#44647: 27.1.50; `bibtex-contline-indentation' doesn't work as file local variable Teemu Likonen
2020-11-15  9:39   ` Teemu Likonen
2020-11-16  4:09   ` Roland Winkler
2020-11-16 14:05     ` Teemu Likonen
2020-11-16 16:36       ` Roland Winkler
2020-11-16 22:58   ` 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=87d00fmycn.fsf@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=44647@debbugs.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.