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

[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: Stefan Monnier
Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)
Date: Wed, 25 Mar 2020 17:13:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> is presented in diff context without the terminating
> "End:" then opening such attachment patch raises the error:
>
>    "Local variables list is not properly terminated"

Really?  AFAICT the code does:

                  (unless (let ((case-fold-search t))
                            (re-search-forward
                             (concat prefix "[ \t]*End:[ \t]*" suffix)
                             nil t))
                    ;; This used to be an error, but really all it means is
                    ;; that this may simply not be a local-variables section,
                    ;; so just ignore it.
                    (message "Local variables list is not properly terminated"))

so it shouldn't signal an error but just emit a message.

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

I think we should try and arrange for errors to really be "not normal",
and then use `with-demoted-errors`, yes.

But w.r.t file-local variables and diff-hunk, I think obeying "file-local
variables" doesn't make much sense when we only have a hunk to go on
since it's more common for the hunk not to include the actual file-local
vars, so if we find something it's likely to be a false-positive.


        Stefan


> 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]