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 [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el [emacs-unicode-2]
Date: Tue, 21 Sep 2004 06:13:40 -0400

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.666.2.6 emacs/lisp/files.el:1.666.2.7
*** emacs/lisp/files.el:1.666.2.6       Wed Sep 15 08:59:55 2004
--- emacs/lisp/files.el Tue Sep 21 09:34:09 2004
***************
*** 439,448 ****
    "*Control processing of the \"variable\" `eval' in a file's local variables.
  The value can be t, nil or something else.
  A value of t means obey `eval' variables;
! nil means ignore them; anything else means query.
! 
! The command \\[normal-mode] always obeys local-variables lists
! and ignores this variable."
    :type '(choice (const :tag "Obey" t)
                 (const :tag "Ignore" nil)
                 (other :tag "Query" other))
--- 439,445 ----
    "*Control processing of the \"variable\" `eval' in a file's local variables.
  The value can be t, nil or something else.
  A value of t means obey `eval' variables;
! nil means ignore them; anything else means query."
    :type '(choice (const :tag "Obey" t)
                 (const :tag "Ignore" nil)
                 (other :tag "Query" other))
***************
*** 2110,2118 ****
                                                   buffer-file-name)
                                                (concat "buffer "
                                                        (buffer-name))))))))))
!         (let ((continue t)
!               prefix prefixlen suffix beg
!               mode-specified
                (enable-local-eval enable-local-eval))
            ;; The prefix is what comes before "local variables:" in its line.
            ;; The suffix is what comes after "local variables:" in its line.
--- 2107,2113 ----
                                                   buffer-file-name)
                                                (concat "buffer "
                                                        (buffer-name))))))))))
!         (let (prefix prefixlen suffix beg
                (enable-local-eval enable-local-eval))
            ;; The prefix is what comes before "local variables:" in its line.
            ;; The suffix is what comes after "local variables:" in its line.
***************
*** 2129,2174 ****
            (if prefix (setq prefixlen (length prefix)
                             prefix (regexp-quote prefix)))
            (if suffix (setq suffix (concat (regexp-quote suffix) "$")))
!           (while continue
!             ;; Look at next local variable spec.
!             (if selective-display (re-search-forward "[\n\C-m]")
!               (forward-line 1))
!             ;; Skip the prefix, if any.
!             (if prefix
!                 (if (looking-at prefix)
!                     (forward-char prefixlen)
!                   (error "Local variables entry is missing the prefix")))
!             ;; 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)
!               ;; Setting variable named "end" means end of list.
!               (if (string-equal (downcase str) "end")
!                   (setq continue nil)
!                 ;; Otherwise read the variable value.
!                 (skip-chars-forward "^:")
!                 (forward-char 1)
!                 (setq val (read (current-buffer)))
!                 (skip-chars-backward "\n")
                  (skip-chars-forward " \t")
!                 (or (if suffix (looking-at suffix) (eolp))
!                     (error "Local variables entry is terminated incorrectly"))
!                 (if mode-only
!                     (if (eq var 'mode)
!                         (setq mode-specified t))
!                   ;; Set the variable.  "Variables" mode and eval are funny.
!                   (hack-one-local-variable var val))))))))
      (unless mode-only
        (run-hooks 'hack-local-variables-hook))
      mode-specified))
  
! (defvar ignored-local-variables
!   '(enable-local-eval)
    "Variables to be ignored in a file's local variable spec.")
  
  ;; Get confirmation before setting these variables as locals in a file.
--- 2124,2189 ----
            (if prefix (setq prefixlen (length prefix)
                             prefix (regexp-quote prefix)))
            (if suffix (setq suffix (concat (regexp-quote suffix) "$")))
!           (forward-line 1)
!           (let ((startpos (point))
!                 endpos
!                 (thisbuf (current-buffer)))
!             (save-excursion
!               (if (not (re-search-forward
!                         (concat (or prefix "")
!                                 "[ \t]*End:[ \t]*"
!                                 (or 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 any.
!                 (if 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 any.
!                 (if 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))
  
! (defvar ignored-local-variables ()
    "Variables to be ignored in a file's local variable spec.")
  
  ;; Get confirmation before setting these variables as locals in a file.
***************
*** 2234,2241 ****
  If VAL is nil or omitted, the question is whether any value might be
  dangerous."
    (let ((safep (get sym 'safe-local-variable)))
!     (or (memq sym ignored-local-variables)
!       (get sym 'risky-local-variable)
        (and (string-match 
"-hooks?$\\|-functions?$\\|-forms?$\\|-program$\\|-command$\\|-predicate$\\|font-lock-keywords$\\|font-lock-keywords-[0-9]+$\\|font-lock-syntactic-keywords$\\|-frame-alist$\\|-mode-alist$\\|-map$\\|-map-alist$"
                           (symbol-name sym))
             (not safep))
--- 2249,2255 ----
  If VAL is nil or omitted, the question is whether any value might be
  dangerous."
    (let ((safep (get sym 'safe-local-variable)))
!     (or (get sym 'risky-local-variable)
        (and (string-match 
"-hooks?$\\|-functions?$\\|-forms?$\\|-program$\\|-command$\\|-predicate$\\|font-lock-keywords$\\|font-lock-keywords-[0-9]+$\\|font-lock-syntactic-keywords$\\|-frame-alist$\\|-mode-alist$\\|-map$\\|-map-alist$"
                           (symbol-name sym))
             (not safep))
***************
*** 2309,2314 ****
--- 2323,2330 ----
        ((eq var 'coding)
         ;; We have already handled coding: tag in set-auto-coding.
         nil)
+       ((memq var ignored-local-variables)
+        nil)
        ;; "Setting" eval means either eval it or do nothing.
        ;; Likewise for setting hook variables.
        ((risky-local-variable-p var val)




reply via email to

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