emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/files.el,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el,v
Date: Tue, 19 Dec 2006 09:04:30 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  06/12/19 09:04:30

Index: files.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.869
retrieving revision 1.870
diff -u -b -r1.869 -r1.870
--- files.el    17 Dec 2006 18:03:09 -0000      1.869
+++ files.el    19 Dec 2006 09:04:30 -0000      1.870
@@ -2115,7 +2115,8 @@
 associated with that interpreter in `interpreter-mode-alist'.")
 
 (defvar magic-mode-alist
-  `(;; The < comes before the groups (but the first) to reduce backtracking.
+  `((image-type-from-buffer . image-mode)
+    ;; The < comes before the groups (but the first) to reduce backtracking.
     ;; TODO: UTF-16 <?xml may be preceded by a BOM 0xff 0xfe or 0xfe 0xff.
     ;; We use [ \t\n] instead of `\\s ' to make regex overflow less likely.
     (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
@@ -2134,10 +2135,11 @@
     ("%![^V]" . ps-mode)
     ("# xmcd " . conf-unix-mode))
   "Alist of buffer beginnings vs. corresponding major mode functions.
-Each element looks like (REGEXP . FUNCTION).  After visiting a file,
-if REGEXP matches the text at the beginning of the buffer,
-`normal-mode' will call FUNCTION rather than allowing `auto-mode-alist'
-to decide the buffer's major mode.
+Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION).
+After visiting a file, if REGEXP matches the text at the beginning of the
+buffer, or calling MATCH-FUNCTION returns non-nil, `normal-mode' will
+call FUNCTION rather than allowing `auto-mode-alist' to decide the buffer's
+major mode.
 
 If FUNCTION is nil, then it is not called.  (That is a way of saying
 \"allow `auto-mode-alist' to decide for these files.\")")
@@ -2225,7 +2227,9 @@
                                                (+ (point-min) 
magic-mode-regexp-match-limit)))
                         (assoc-default nil magic-mode-alist
                                        (lambda (re dummy)
-                                         (looking-at re))))))
+                                         (if (functionp re)
+                                             (funcall re)
+                                           (looking-at re)))))))
          (set-auto-mode-0 done keep-mode-if-same)
        ;; Compare the filename against the entries in auto-mode-alist.
        (if buffer-file-name




reply via email to

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