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: Juri Linkov
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

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





reply via email to

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