[Top][All Lists]

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

bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-

From: Juri Linkov
Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)
Date: Wed, 25 Mar 2020 22:39:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> (defun conf-guess-mode ()
>>   (funcall (conf--guess-mode)))
> That shouldn't be needed!
> [ I.e. the right fix should arrange for that not to be necessary.
>   I'm looking into it, thanks.  ]

BTW, I noticed another problem related to diff-syntax-fontify:
when diff-font-lock-syntax is customized to 'hunk-also',
and a patch displayed by Gnus contains a truncated
local variables list, e.g. only the first line

 ;; Local Variables:

is presented in diff context without the terminating
"End:" then opening such attachment patch raises the error:

   "Local variables list is not properly terminated"

Not sure if this is the right way to fix this, but it works:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 8171a58515..96baea8526 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2724,7 +2724,7 @@ diff-syntax-fontify-props
           (buffer-file-name file))
       ;; Don't run hooks that might assume buffer-file-name
       ;; really associates buffer with a file (bug#39190).
-      (delay-mode-hooks (set-auto-mode))
+      (delay-mode-hooks (ignore-errors (set-auto-mode)))
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
                  (memq #'generic-mode-find-file-hook

reply via email to

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