[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/files.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/files.el |
Date: |
Sun, 02 Jan 2005 13:20:43 -0500 |
Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.739 emacs/lisp/files.el:1.740
*** emacs/lisp/files.el:1.739 Sun Jan 2 01:20:33 2005
--- emacs/lisp/files.el Sun Jan 2 18:08:12 2005
***************
*** 2202,2287 ****
(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))
! (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))
--- 2202,2287 ----
(save-excursion
(goto-char (point-max))
(search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
! (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)
! (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))