summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2007-12-26 17:29:34 +0000
committerRichard M. Stallman <rms@gnu.org>2007-12-26 17:29:34 +0000
commit73936494a34bc8c474eb7b315ad30ef653df5463 (patch)
treea7c308ce5acd0bbde4e00b192bae4715ab805ce3
parenta5af675edc7348b16262932edaf4385ef0d45479 (diff)
downloademacs-73936494a34bc8c474eb7b315ad30ef653df5463.tar.gz
emacs-73936494a34bc8c474eb7b315ad30ef653df5463.tar.bz2
emacs-73936494a34bc8c474eb7b315ad30ef653df5463.zip
(conf-mode-maybe): New function.
(auto-mode-alist): Use conf-mode-maybe for .conf etc.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el12
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f24d7c79182..7eb76ce1539 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-26 Richard Stallman <rms@gnu.org>
+
+ * files.el (conf-mode-maybe): New function.
+ (auto-mode-alist): Use conf-mode-maybe for .conf etc.
+
2007-12-26 Martin Rudalics <rudalics@gmx.at>
* textmodes/fill.el (fill-find-break-point): Fix doc-string typo.
diff --git a/lisp/files.el b/lisp/files.el
index d4b15324f94..ecfcc963e65 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2029,7 +2029,7 @@ since only a single case-insensitive search through the alist is made."
("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 @@ See also `interpreter-mode-alist', which detects executable script modes
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 \\|<!-- \\|<!DOCTYPE ")))
+ (xml-mode)
+ (conf-mode)))
+
(defvar interpreter-mode-alist
;; Note: The entries for the modes defined in cc-mode.el (awk-mode
;; and pike-mode) are added through autoload directives in that