GNU bug report logs - #39190
28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)

Previous Next

Package: emacs;

Reported by: Felician Nemeth <felician.nemeth <at> gmail.com>

Date: Sun, 19 Jan 2020 11:15:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth <at> gmail.com>
Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)
Date: Fri, 31 Jan 2020 00:50:37 +0200
> And now that I think about it, maybe
>
>     (or buffer-file-name-for-mode buffer-file-name)

I encountered more problems with buffer-file-name-for-mode
because there are more unexpected places that expect buffer-file-name:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  find-file-name-handler(nil file-name-sans-versions)
  file-name-sans-versions(nil)
  generic-mode-find-file-hook()
  diff-syntax-fontify-props(#("/dev/null" 0 9 (face (diff-file-header diff-header) fontified t)) "" (0 0) t)
  diff-syntax-fontify-hunk(1686 3081 t)
  diff-syntax-fontify(1686 3081)

because it relies on non-nil buffer-file-name:

(defun generic-mode-find-file-hook ()
  ...
  (when (and (eq major-mode 'fundamental-mode)
             (or (null generic-ignore-files-regexp)
                 (not (string-match-p
                       generic-ignore-files-regexp
                       (file-name-sans-versions buffer-file-name)))))
                                                ================

It would be hard to find all occurrences of buffer-file-name
where to add buffer-file-name-for-mode.

Maybe safer would be to use just (delay-mode-hooks (set-auto-mode))




This bug report was last modified 5 years and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.