From: Daniel Pfeiffer Date: Wed, 27 Oct 2004 21:44:35 +0000 (+0000) Subject: Tack language suffix onto html, and make C-x C-w find the mode in the same way as... X-Git-Tag: ttn-vms-21-2-B4~4347 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9e6f54198a18f3ac8838d7ada4fe6eef55e880bc;p=emacs.git Tack language suffix onto html, and make C-x C-w find the mode in the same way as C-x C-f. --- diff --git a/lisp/files.el b/lisp/files.el index dd36f449208..09e7c76107a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1645,7 +1645,9 @@ in that case, this function acts as if `enable-local-variables' were t." (mapc (lambda (elt) (cons (purecopy (car elt)) (cdr elt))) - '(("\\.te?xt\\'" . text-mode) + '(;; do this first, so that .html.pl is Polish html, not Perl + ("\\.s?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode) + ("\\.te?xt\\'" . text-mode) ("\\.[tT]e[xX]\\'" . tex-mode) ("\\.ins\\'" . tex-mode) ;Installation files for TeX packages. ("\\.ltx\\'" . latex-mode) @@ -1661,7 +1663,6 @@ in that case, this function acts as if `enable-local-variables' were t." ("\\.ad[abs]\\'" . ada-mode) ("\\.ad[bs].dg\\'" . ada-mode) ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode) - ("\\.s?html?\\'" . html-mode) ("\\.mk\\'" . makefile-mode) ("\\([Mm]\\|GNUm\\)akep*file\\'" . makefile-mode) ("\\.am\\'" . makefile-mode) ;For Automake. @@ -1689,7 +1690,8 @@ in that case, this function acts as if `enable-local-variables' were t." ("\\.bib\\'" . bibtex-mode) ("\\.sql\\'" . sql-mode) ("\\.m[4c]\\'" . m4-mode) - ("\\.m[fp]\\'" . metapost-mode) + ("\\.mf\\'" . metafont-mode) + ("\\.mp\\'" . metapost-mode) ("\\.vhdl?\\'" . vhdl-mode) ("\\.article\\'" . text-mode) ("\\.letter\\'" . text-mode) @@ -1841,7 +1843,7 @@ buffer will be in some XML mode. If `auto-mode-alist' associates the file with one of the modes in this list, that mode will be used. Else `xml-mode' or `sgml-mode' is used.") -(defun set-auto-mode (&optional just-from-file-name) +(defun set-auto-mode (&optional keep-mode-if-same) "Select major mode appropriate for current buffer. This checks for a -*- mode tag in the buffer's text, checks the interpreter that runs this file against `interpreter-mode-alist', @@ -1855,60 +1857,62 @@ Local Variables section of the file; for that, use `hack-local-variables'. If `enable-local-variables' is nil, this function does not check for a -*- mode tag. -If the optional argument JUST-FROM-FILE-NAME is non-nil, +If the optional argument KEEP-MODE-IF-SAME is non-nil, then we do not set anything but the major mode, and we don't even do that unless it would come from the file name." ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- (let (end done mode modes xml) - (unless just-from-file-name - ;; Find a -*- mode tag - (save-excursion - (goto-char (point-min)) - (skip-chars-forward " \t\n") - ;; While we're at this point, check xml for later. - (setq xml (looking-at "<\\?xml \\|