]> git.eshelyaron.com Git - emacs.git/commitdiff
(hack-local-variables): Fix last change.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 2 Jan 2005 18:08:12 +0000 (18:08 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 2 Jan 2005 18:08:12 +0000 (18:08 +0000)
lisp/ChangeLog
lisp/files.el

index b8502b35e3dd48ee26e4539778255dcbf96a6992..5411336e86f1445679b3361d516de80213ed826c 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-02  Stefan  <monnier@iro.umontreal.ca>
+
+       * files.el (hack-local-variables): Fix last change.
+
 2005-01-02  Jay Belanger  <belanger@truman.edu>
 
        * calc/calc-yank.el (calc-edit-top): New variable.
index cfee975066dfbf1ea3e527e76bc5175bfa1f6447..227bb78174422ecc54cf1ff36116e528e94a03ad 100644 (file)
@@ -2202,86 +2202,86 @@ is specified, returning t if it is specified."
     (save-excursion
       (goto-char (point-max))
       (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
-      (if (let ((case-fold-search t))
-           (and (search-forward "Local Variables:" nil t)
-                (or (eq enable-local-variables t)
-                    mode-only
-                    (and enable-local-variables
-                         (save-window-excursion
-                           (switch-to-buffer (current-buffer))
-                           (save-excursion
-                             (beginning-of-line)
-                             (set-window-start (selected-window) (point)))
-                           (y-or-n-p (format "Set local variables as specified at end of %s? "
-                                             (if buffer-file-name
-                                                 (file-name-nondirectory
-                                                  buffer-file-name)
-                                               (concat "buffer "
-                                                       (buffer-name))))))))))
-         (skip-chars-forward " \t")
-         (let ((enable-local-eval enable-local-eval)
-               ;; suffix is what comes after "local variables:" in its line.
-               (suffix
-                (concat
-                 (regexp-quote (buffer-substring (point) (line-end-position)))
-                 "$"))
-               ;; prefix is what comes before "local variables:" in its line.
-               (prefix
-                (concat "^" (regexp-quote
-                             (buffer-substring (line-beginning-position)
-                                               (match-beginning 0)))))
-               beg)
-
-           (forward-line 1)
-           (let ((startpos (point))
-                 endpos
-                 (thisbuf (current-buffer)))
-             (save-excursion
-               (if (not (re-search-forward
-                         (concat prefix "[ \t]*End:[ \t]*" suffix)
-                         nil t))
-                   (error "Local variables list is not properly terminated"))
-               (beginning-of-line)
-               (setq endpos (point)))
-
-             (with-temp-buffer
-               (insert-buffer-substring thisbuf startpos endpos)
-               (goto-char (point-min))
-               (subst-char-in-region (point) (point-max) ?\^m ?\n)
-               (while (not (eobp))
-                 ;; Discard the prefix.
-                 (if (looking-at prefix)
-                     (delete-region (point) (match-end 0))
-                   (error "Local variables entry is missing the prefix"))
-                 (end-of-line)
-                 ;; Discard the suffix.
-                 (if (looking-back suffix)
-                     (delete-region (match-beginning 0) (point))
-                   (error "Local variables entry is missing the suffix"))
-                 (forward-line 1))
-               (goto-char (point-min))
+      (when (let ((case-fold-search t))
+             (and (search-forward "Local Variables:" nil t)
+                  (or (eq enable-local-variables t)
+                      mode-only
+                      (and enable-local-variables
+                           (save-window-excursion
+                             (switch-to-buffer (current-buffer))
+                             (save-excursion
+                               (beginning-of-line)
+                               (set-window-start (selected-window) (point)))
+                             (y-or-n-p (format "Set local variables as specified at end of %s? "
+                                               (if buffer-file-name
+                                                   (file-name-nondirectory
+                                                    buffer-file-name)
+                                                 (concat "buffer "
+                                                         (buffer-name))))))))))
+       (skip-chars-forward " \t")
+       (let ((enable-local-eval enable-local-eval)
+             ;; suffix is what comes after "local variables:" in its line.
+             (suffix
+              (concat
+               (regexp-quote (buffer-substring (point) (line-end-position)))
+               "$"))
+             ;; prefix is what comes before "local variables:" in its line.
+             (prefix
+              (concat "^" (regexp-quote
+                           (buffer-substring (line-beginning-position)
+                                             (match-beginning 0)))))
+             beg)
 
-               (while (not (eobp))
-                 ;; Find the variable name; strip whitespace.
-                 (skip-chars-forward " \t")
-                 (setq beg (point))
-                 (skip-chars-forward "^:\n")
-                 (if (eolp) (error "Missing colon in local variables entry"))
-                 (skip-chars-backward " \t")
-                 (let* ((str (buffer-substring beg (point)))
-                        (var (read str))
-                        val)
-                   ;; Read the variable value.
-                   (skip-chars-forward "^:")
-                   (forward-char 1)
-                   (setq val (read (current-buffer)))
-                   (if mode-only
-                       (if (eq var 'mode)
-                           (setq mode-specified t))
-                     ;; Set the variable.  "Variables" mode and eval are funny.
-                     (with-current-buffer thisbuf
-                       (hack-one-local-variable var val))))
-                 (forward-line 1)))))))
+         (forward-line 1)
+         (let ((startpos (point))
+               endpos
+               (thisbuf (current-buffer)))
+           (save-excursion
+             (if (not (re-search-forward
+                       (concat prefix "[ \t]*End:[ \t]*" suffix)
+                       nil t))
+                 (error "Local variables list is not properly terminated"))
+             (beginning-of-line)
+             (setq endpos (point)))
+
+           (with-temp-buffer
+             (insert-buffer-substring thisbuf startpos endpos)
+             (goto-char (point-min))
+             (subst-char-in-region (point) (point-max) ?\^m ?\n)
+             (while (not (eobp))
+               ;; Discard the prefix.
+               (if (looking-at prefix)
+                   (delete-region (point) (match-end 0))
+                 (error "Local variables entry is missing the prefix"))
+               (end-of-line)
+               ;; Discard the suffix.
+               (if (looking-back suffix)
+                   (delete-region (match-beginning 0) (point))
+                 (error "Local variables entry is missing the suffix"))
+               (forward-line 1))
+             (goto-char (point-min))
+
+             (while (not (eobp))
+               ;; Find the variable name; strip whitespace.
+               (skip-chars-forward " \t")
+               (setq beg (point))
+               (skip-chars-forward "^:\n")
+               (if (eolp) (error "Missing colon in local variables entry"))
+               (skip-chars-backward " \t")
+               (let* ((str (buffer-substring beg (point)))
+                      (var (read str))
+                      val)
+                 ;; Read the variable value.
+                 (skip-chars-forward "^:")
+                 (forward-char 1)
+                 (setq val (read (current-buffer)))
+                 (if mode-only
+                     (if (eq var 'mode)
+                         (setq mode-specified t))
+                   ;; Set the variable.  "Variables" mode and eval are funny.
+                   (with-current-buffer thisbuf
+                     (hack-one-local-variable var val))))
+               (forward-line 1)))))))
     (unless mode-only
       (run-hooks 'hack-local-variables-hook))
     mode-specified))