changeset 42017:50851bbcf637

(set-auto-mode): Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Fri, 14 Dec 2001 03:21:24 +0000
parents 3900be0515b0
children 4a21b17d2e25
files lisp/files.el
diffstat 1 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Fri Dec 14 03:08:47 2001 +0000
+++ b/lisp/files.el	Fri Dec 14 03:21:24 2001 +0000
@@ -1576,32 +1576,31 @@
 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