(set-auto-mode): Fix previous change.
authorRichard M. Stallman <rms@gnu.org>
Fri, 14 Dec 2001 03:21:49 +0000 (03:21 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 14 Dec 2001 03:21:49 +0000 (03:21 +0000)
lisp/ChangeLog
lisp/files.el

index 26087a6..34018fc 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-13  Richard M. Stallman  <rms@gnu.org>
+
+       * files.el (set-auto-mode): Fix previous change.
+
 2001-12-13  Stefan Monnier  <monnier@cs.yale.edu>
 
        * emacs-lisp/easymenu.el (easy-menu-intern): New fun.
index c7426d0..054dd03 100644 (file)
@@ -1576,32 +1576,31 @@ If the optional argument JUST-FROM-FILE-NAME 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 (beg end done modes)
+  (let (end done modes)
     (save-excursion
       (goto-char (point-min))
       (skip-chars-forward " \t\n")
       (and enable-local-variables
           (setq end (set-auto-mode-1))
-          (progn
-            (if (save-excursion (search-forward ":" end t))
-                ;; Find all specifications for the `mode:' variable
-                ;; and execute them left to right.
-                (while (let ((case-fold-search t))
-                         (or (and (looking-at "mode:")
-                                  (goto-char (match-end 0)))
-                             (re-search-forward "[ \t;]mode:" end t)))
-                  (skip-chars-forward " \t")
-                  (setq beg (point))
+          (if (save-excursion (search-forward ":" end t))
+              ;; Find all specifications for the `mode:' variable
+              ;; and execute them left to right.
+              (while (let ((case-fold-search t))
+                       (or (and (looking-at "mode:")
+                                (goto-char (match-end 0)))
+                           (re-search-forward "[ \t;]mode:" end t)))
+                (skip-chars-forward " \t")
+                (let ((beg (point)))
                   (if (search-forward ";" end t)
                       (forward-char -1)
                     (goto-char end))
                   (skip-chars-backward " \t")
                   (push (intern (concat (downcase (buffer-substring beg (point))) "-mode"))
-                        modes))
-              ;; Simple -*-MODE-*- case.
-              (push (intern (concat (downcase (buffer-substring beg end))
-                                    "-mode"))
-                    modes)))))
+                        modes)))
+            ;; Simple -*-MODE-*- case.
+            (push (intern (concat (downcase (buffer-substring (point) end))
+                                  "-mode"))
+                  modes))))
     ;; If we found modes to use, invoke them now,
     ;; outside the save-excursion.
     (unless just-from-file-name