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


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Thu, 11 Nov 2004 17:03:05 -0500

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.725 emacs/lisp/files.el:1.726
*** emacs/lisp/files.el:1.725   Thu Nov 11 04:52:27 2004
--- emacs/lisp/files.el Thu Nov 11 21:42:32 2004
***************
*** 1876,1882 ****
                "[Hh][Tt][Mm][Ll]")) . html-mode)
      ;; These two must come after html, because they are more general:
      ("<\\?xml " . xml-mode)
!     ("\\s *<\\(?:!--\\(?:.\\|\n\\)*?-->\\s *<\\)*!DOCTYPE " . sgml-mode)
      ("%![^V]" . ps-mode)
      ("# xmcd " . conf-unix-mode))
    "Alist of buffer beginnings vs. corresponding major mode functions.
--- 1876,1884 ----
                "[Hh][Tt][Mm][Ll]")) . html-mode)
      ;; These two must come after html, because they are more general:
      ("<\\?xml " . xml-mode)
!     (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
!            (comment-re (concat "\\(?:!--" incomment-re "*-->\\s *<\\)")))
!       (concat "\\s *<" comment-re "*!DOCTYPE ")) . sgml-mode)
      ("%![^V]" . ps-mode)
      ("# xmcd " . conf-unix-mode))
    "Alist of buffer beginnings vs. corresponding major mode functions.
***************
*** 1888,1896 ****
  
  This checks for a -*- mode tag in the buffer's text, checks the
  interpreter that runs this file against `interpreter-mode-alist',
! compares the buffer beginning against `magic-mode-alist',
! or compares the filename against the entries in
! `auto-mode-alist'.
  
  It does not check for the `mode:' local variable in the
  Local Variables section of the file; for that, use `hack-local-variables'.
--- 1890,1897 ----
  
  This checks for a -*- mode tag in the buffer's text, checks the
  interpreter that runs this file against `interpreter-mode-alist',
! compares the buffer beginning against `magic-mode-alist', or
! compares the filename against the entries in `auto-mode-alist'.
  
  It does not check for the `mode:' local variable in the
  Local Variables section of the file; for that, use `hack-local-variables'.
***************
*** 1901,1913 ****
  If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
  only set the major mode, if that would change it."
    ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
!   (let (end done mode modes xml)
      ;; 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 \\|<!DOCTYPE"))
        (and enable-local-variables
           (setq end (set-auto-mode-1))
           (if (save-excursion (search-forward ":" end t))
--- 1902,1912 ----
  If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
  only set the major mode, if that would change it."
    ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
!   (let (end done mode modes)
      ;; Find a -*- mode tag
      (save-excursion
        (goto-char (point-min))
        (skip-chars-forward " \t\n")
        (and enable-local-variables
           (setq end (set-auto-mode-1))
           (if (save-excursion (search-forward ":" end t))
***************
*** 1951,1959 ****
            ;; same time.
            done (assoc (file-name-nondirectory mode)
                        interpreter-mode-alist))
        (if done
          (set-auto-mode-0 (cdr done) keep-mode-if-same)))
!     ;; If we found an interpreter mode to use, invoke it now.
      (unless done
        (if (setq done (save-excursion
                       (goto-char (point-min))
--- 1950,1959 ----
            ;; same time.
            done (assoc (file-name-nondirectory mode)
                        interpreter-mode-alist))
+       ;; If we found an interpreter mode to use, invoke it now.
        (if done
          (set-auto-mode-0 (cdr done) keep-mode-if-same)))
!     ;; If we didn't, match the buffer beginning against magic-mode-alist.
      (unless done
        (if (setq done (save-excursion
                       (goto-char (point-min))
***************
*** 1961,1966 ****
--- 1961,1967 ----
                                      (lambda (re dummy)
                                        (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
            (let ((name buffer-file-name))
              ;; Remove backup-suffixes from file name.
***************
*** 1970,1976 ****
                (let ((case-fold-search
                       (memq system-type '(vax-vms windows-nt cygwin))))
                  (if (and (setq mode (assoc-default name auto-mode-alist
!                                                'string-match))
                           (consp mode)
                           (cadr mode))
                      (setq mode (car mode)
--- 1971,1977 ----
                (let ((case-fold-search
                       (memq system-type '(vax-vms windows-nt cygwin))))
                  (if (and (setq mode (assoc-default name auto-mode-alist
!                                                    'string-match))
                           (consp mode)
                           (cadr mode))
                      (setq mode (car mode)
***************
*** 1979,1985 ****
                (when mode
                  (set-auto-mode-0 mode keep-mode-if-same)))))))))
  
- 
  ;; When `keep-mode-if-same' is set, we are working on behalf of
  ;; set-visited-file-name.  In that case, if the major mode specified is the
  ;; same one we already have, don't actually reset it.  We don't want to lose
--- 1980,1985 ----
***************
*** 1998,2004 ****
      (funcall mode)
      mode))
  
- 
  (defun set-auto-mode-1 ()
    "Find the -*- spec in the buffer.
  Call with point at the place to start searching from.
--- 1998,2003 ----




reply via email to

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