bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66317: Project mode-line


From: Dmitry Gutov
Subject: bug#66317: Project mode-line
Date: Wed, 25 Oct 2023 02:48:22 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 23/10/2023 20:23, Juri Linkov wrote:
I'm not sure what to recommend, but some print-debugging could
help. E.g. just add a (backtrace) call inside project-mode-line-format.

But that's a lot of output to sort through, so there's definitely room for
improvement in this recipe.
Ok, here is 100% reproducible minimal test case:

0. emacs-30 -Q
1. eval:

(progn
   (require 'project)
   (setq project-mode-line t)
   (setq set-message-functions '(set-multi-message)))

2. in a temporary directory: M-! git init RET
3. C-x C-f .dir-locals.el RET
4. insert: ((fundamental-mode . ((mode . flyspell))))
5. C-x C-s

At this point even buffer-file-coding-system of .dir-locals.el
is changed to 't' (raw-text-unix).  The same happens when saving
any file in that project.

The problem doesn't occur when flyspell-mode is enabled from
file-local variables, only from dir-locals.

I can repro. But it's as weird a bug as they come.

I guess it's a combination of using flyspell-mode and editing .dir-locals.el? Or have you seen other buffers' b-f-c-s changed this way too?

If not, it might have something to do with flyspell-mode's use of sit-for?.. But I'm only saying that because it's the only feature of this mode that I'm regularly reminded of.

I tried using a variable watcher:

  (add-variable-watcher
   'buffer-file-coding-system
   (lambda (_sym value op where)
    (message "%s %s %s" value op where)
    (if (eq 'raw-text-unix value) (backtrace))
   ))

but it just prints

prefer-utf-8-unix set  *temp*-925453 [2 times]
raw-text-unix set .dir-locals.el
  backtrace()
  (if (eq 'raw-text-unix value) (backtrace))
(closure (t) (_sym value op where) (message "%s %s %s" value op where) (if (eq 'raw-text-unix value) (backtrace)))(buffer-file-coding-system raw-text-unix set #<buffer .dir-locals.el>)
  basic-save-buffer(t)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)

OTOH, the bug is very reliable to reproduce: add the aforementioned line to dir-locals and save -> the coding system changes to raw-text. Delete the line and save -> and it's prefer-utf-8 again.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]