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: Wed, 19 Feb 2020 02:49:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> That's kinda hard if you want to use define-derived-mode and we do: when
>> we call `conf-foo-mode` the first things it does is: bind
>> `delay-mode-hooks` and call the parent (`conf-mode`), so the only
>> difference between this call to the parent and a direct call to the
>> generic entry point is the binding of `delay-mode-hooks`.
>
> IOW, I think we should start with something like the patch below which
> makes `conf-guess-mode` available, after which we can start fixing the
> various callers to call `conf-guess-mode` instead.

I tested this with additional patch that replaces `conf-mode` calls with
`conf-guess-mode`, and see that syntax font-lock now is fixed in diff-mode
on some conf files (not tested on all possible conf submodes).

diff --git a/lisp/files.el b/lisp/files.el
index 683f4a8ce7..3e1cf5e526 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2813,7 +2813,7 @@ auto-mode-alist
      ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
      ("/\\.\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
      ;; Windows candidates may be opened case sensitively on Unix
-     
("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . 
conf-mode)
+     
("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . 
conf-guess-mode)
      ("\\.la\\'" . conf-unix-mode)
      ("\\.ppd\\'" . conf-ppd-mode)
      ("java.+\\.conf\\'" . conf-javaprop-mode)
@@ -2822,15 +2822,15 @@ auto-mode-alist
      ("\\.desktop\\'" . conf-desktop-mode)
      ("/\\.redshift.conf\\'" . conf-windows-mode)
      
("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'"
 . conf-space-mode)
-     
("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'"
 . conf-mode)
+     
("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'"
 . conf-guess-mode)
      ;; ChangeLog.old etc.  Other change-log-mode entries are above;
      ;; this has lower priority to avoid matching changelog.sgml etc.
      ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
      ;; either user's dot-files or under /etc or some such
-     
("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'"
 . conf-mode)
+     
("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'"
 . conf-guess-mode)
      ;; alas not all ~/.*rc files are like this
-     
("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'"
 . conf-mode)
-     
("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'"
 . conf-mode)
+     
("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'"
 . conf-guess-mode)
+     
("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'"
 . conf-guess-mode)
      ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
      ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
      ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
@@ -2920,7 +2920,7 @@ conf-mode-maybe
          (goto-char (point-min))
          (looking-at "<\\?xml \\|<!-- \\|<!DOCTYPE ")))
       (xml-mode)
-    (conf-mode)))
+    (conf-guess-mode)))
 
 (defvar interpreter-mode-alist
   ;; Note: The entries for the modes defined in cc-mode.el (awk-mode





reply via email to

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