]> git.eshelyaron.com Git - emacs.git/commitdiff
(set-auto-mode): Ignore unknown -*- mode -*- rather than
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 7 Oct 2000 03:05:14 +0000 (03:05 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 7 Oct 2000 03:05:14 +0000 (03:05 +0000)
raise an error.  This way it can still defaults to a sane value.

lisp/ChangeLog
lisp/files.el

index 5ef7457d88b04f36e93f8d8443803b579be660f8..72e2fb27d1503db443293c2a1f7fe26fbd445011 100644 (file)
@@ -1,5 +1,8 @@
 2000-10-06  Stefan Monnier  <monnier@cs.yale.edu>
 
+       * files.el (set-auto-mode): Ignore unknown -*- mode -*- rather than
+       raise an error.  This way it can still defaults to a sane value.
+
        * startup.el (fancy-splash-screens): Use local rather than global map.
        Don't use `update-menu-bindings' any more.
        Get rid of assumptions about keymap representation.
@@ -38,8 +41,8 @@
        (tex-font-lock-keywords-1): Remove.
        (font-lock-turn-on-thing-lock): Use jit-lock-register.
        (font-lock-turn-off-thing-lock): Use jit-lock-unregister.
-       (font-lock-default-fontify-region): Expand beg..end correctly
-       when just following a multiline region.
+       (font-lock-default-fontify-region):
+       Expand beg..end correctly when just following a multiline region.
        (font-lock-fontify-anchored-keywords):
        Include the anchor text as part of the multiline.
 
index 14a14c89cca72cd2c949beb2964ce90625b01216..6fc452545e5f4c33c3b5adfc41b26e5170253ef5 100644 (file)
@@ -472,7 +472,7 @@ patterns and to guarantee valid names."
 
 (defvar cd-path nil
   "Value of the CDPATH environment variable, as a list.
-Not actually set up until the first time you you use it.")
+Not actually set up until the first time you use it.")
 
 (defun parse-colon-path (cd-path)
   "Explode a colon-separated search path into a list of directory names.
@@ -1386,10 +1386,6 @@ in that case, this function acts as if `enable-local-variables' were t."
      ("\\.ms\\'" . nroff-mode)
      ("\\.man\\'" . nroff-mode)
      ("\\.\\(u?lpc\\|pike\\|pmod\\)\\'" . pike-mode)
-;;; The following should come after the ChangeLog pattern
-;;; for the sake of ChangeLog.1, etc.
-;;; and after the .scm.[0-9] pattern too.
-     ("\\.[12345678]\\'" . nroff-mode)
      ("\\.TeX\\'" . tex-mode)
      ("\\.sty\\'" . latex-mode)
      ("\\.cls\\'" . latex-mode)                ;LaTeX 2e class
@@ -1455,7 +1451,15 @@ in that case, this function acts as if `enable-local-variables' were t."
      ("configure\\.in\\'" . autoconf-mode)
      ("BROWSE\\'" . ebrowse-tree-mode)
      ("\\.ebrowse\\'" . ebrowse-tree-mode)
-     ("#\\*mail\\*" . mail-mode)))
+     ("#\\*mail\\*" . mail-mode)
+     ;; Get rid of any trailing .n.m and try again.
+     ;; This is for files saved by cvs-merge that look like .#<file>.<rev>
+     ;; or .#<file>.<rev>-<rev> or VC's <file>.~<rev>~
+     ("\\.~?[0-9]+\\.[0-9][-.0-9]*~?\\'" nil t)
+;;; The following should come after the ChangeLog pattern
+;;; for the sake of ChangeLog.1, etc.
+;;; and after the .scm.[0-9] and CVS' <file>.<rev> patterns too.
+     ("\\.[12345678]\\'" . nroff-mode)))
   "Alist of filename patterns vs corresponding major mode functions.
 Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
 \(NON-NIL stands for anything that is not nil; the value does not matter.)
@@ -1606,18 +1610,20 @@ and we don't even do that unless it would come from the file name."
                       (forward-char -1)
                     (goto-char end))
                   (skip-chars-backward " \t")
-                  (setq modes (cons (intern (concat (downcase (buffer-substring beg (point))) "-mode"))
-                                    modes)))
+                  (push (intern (concat (downcase (buffer-substring beg (point))) "-mode"))
+                        modes))
               ;; Simple -*-MODE-*- case.
-              (setq modes (cons (intern (concat (downcase (buffer-substring beg end))
-                                                "-mode"))
-                                modes))))))
+              (push (intern (concat (downcase (buffer-substring beg end))
+                                    "-mode"))
+                    modes)))))
     ;; If we found modes to use, invoke them now,
     ;; outside the save-excursion.
-    (when modes
-      (unless just-from-file-name
-       (mapc 'funcall (nreverse modes)))
-      (setq done t))
+    (unless just-from-file-name
+      (dolist (mode (nreverse modes))
+       (if (not (functionp mode))
+           (message "Ignoring unknown mode `%s'" mode)
+         (setq done t)
+         (funcall mode))))
     ;; If we didn't find a mode from a -*- line, try using the file name.
     (if (and (not done) buffer-file-name)
        (let ((name buffer-file-name)