# HG changeset patch # User Richard M. Stallman # Date 1198690143 0 # Node ID c3bd185be82037d093fabe96d0128ba8a0c96409 # Parent c0c66569068af046b0ecf7a6694ad1f8f520a1ba (conf-mode-maybe): New function. (auto-mode-alist): Use conf-mode-maybe for .conf etc. diff -r c0c66569068a -r c3bd185be820 lisp/files.el --- a/lisp/files.el Wed Dec 26 09:08:59 2007 +0000 +++ b/lisp/files.el Wed Dec 26 17:29:03 2007 +0000 @@ -2029,7 +2029,7 @@ ("java.+\\.conf\\'" . conf-javaprop-mode) ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode) ;; *.cf, *.cfg, *.conf, *.config[.local|.de_DE.UTF8|...], */config - ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode) + ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode-maybe) ("\\`/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) ;; ChangeLog.old etc. Other change-log-mode entries are above; @@ -2076,6 +2076,16 @@ based on the interpreters they specify to run, and `magic-mode-alist', which determines modes based on file contents.") +(defun conf-mode-maybe () + "Select Conf mode or XML mode according to start of file." + (if (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (looking-at "<\\?xml \\|