/[emacs]/emacs/lisp/files.el
ViewVC logotype

Diff of /emacs/lisp/files.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.589 by pot, Fri Jul 5 23:15:37 2002 UTC revision 1.590 by rms, Sun Jul 7 09:21:52 2002 UTC
# Line 1422  unless NOMODES is non-nil." Line 1422  unless NOMODES is non-nil."
1422    ;; before altering a backup file.    ;; before altering a backup file.
1423    (when (backup-file-name-p buffer-file-name)    (when (backup-file-name-p buffer-file-name)
1424      (setq buffer-read-only t))      (setq buffer-read-only t))
1425      ;; When a file is marked read-only,
1426      ;; make the buffer read-only even if root is looking at it.
1427      (when (zerop (logand (file-modes (buffer-file-name)) #o222))
1428        (setq buffer-read-only t))
1429    (unless nomodes    (unless nomodes
1430      (when (and view-read-only view-mode)      (when (and view-read-only view-mode)
1431        (view-mode-disable))        (view-mode-disable))
# Line 2041  is specified, returning t if it is speci Line 2045  is specified, returning t if it is speci
2045  ;; This one is safe because the user gets to check it before it is used.  ;; This one is safe because the user gets to check it before it is used.
2046  (put 'compile-command 'safe-local-variable t)  (put 'compile-command 'safe-local-variable t)
2047    
2048  (put 'c-add-style 'safe-local-eval-function t)  (defcustom safe-local-eval-forms nil
2049      "*Expressions that are considered \"safe\" in an `eval:' local variable.
2050    Add expressions to this list if you want Emacs to evaluate them, when
2051    they appear in an `eval' local variable specification, without first
2052    asking you for confirmation."
2053      :group 'find-file
2054      :version "21.4"
2055      :type '(repeat sexp))
2056    
2057  (put 'c-set-style 'safe-local-eval-function t)  (put 'c-set-style 'safe-local-eval-function t)
2058    
2059  (defun hack-one-local-variable-quotep (exp)  (defun hack-one-local-variable-quotep (exp)
# Line 2055  is specified, returning t if it is speci Line 2067  is specified, returning t if it is speci
2067    
2068  (defun hack-one-local-variable-eval-safep (exp)  (defun hack-one-local-variable-eval-safep (exp)
2069    "Return t if it is safe to eval EXP when it is found in a file."    "Return t if it is safe to eval EXP when it is found in a file."
2070    (and (consp exp)    (or (not (consp exp))
2071         (or (and (eq (car exp) 'put)        ;; Detect certain `put' expressions.
2072                  (hack-one-local-variable-quotep (nth 1 exp))        (and (eq (car exp) 'put)
2073                  (hack-one-local-variable-quotep (nth 2 exp))             (hack-one-local-variable-quotep (nth 1 exp))
2074                  (memq (nth 1 (nth 2 exp))             (hack-one-local-variable-quotep (nth 2 exp))
2075                        '(lisp-indent-hook))             (memq (nth 1 (nth 2 exp))
2076                  ;; Only allow safe values of lisp-indent-hook;                   '(lisp-indent-hook))
2077                  ;; not functions.             ;; Only allow safe values of lisp-indent-hook;
2078                  (or (numberp (nth 3 exp))             ;; not functions.
2079                      (equal (nth 3 exp) ''defun)))             (or (numberp (nth 3 exp))
2080             (and (symbolp (car exp))                 (equal (nth 3 exp) ''defun)))
2081                  (get (car exp) 'safe-local-eval-function)        ;; Allow expressions that the user requested.
2082                  (let ((ok t))        (member exp safe-local-eval-forms)
2083                    (dolist (arg (cdr exp))        ;; Certain functions can be allowed with safe arguments
2084                      (unless (hack-one-local-variable-constantp arg)        ;; or can specify verification functions to try.
2085                        (setq ok nil)))        (and (symbolp (car exp))
2086                    ok)))))             (let ((prop (get (car exp) 'safe-local-eval-function)))
2087                 (cond ((eq prop t)
2088                        (let ((ok t))
2089                          (dolist (arg (cdr exp))
2090                            (unless (hack-one-local-variable-constantp arg)
2091                              (setq ok nil)))
2092                          ok))
2093                       ((functionp prop)
2094                        (funcall prop exp))
2095                       ((listp prop)
2096                        (let ((ok nil))
2097                          (dolist (function prop)
2098                            (if (funcall function exp)
2099                                (setq ok t)))
2100                          ok)))))))
2101    
2102  (defun hack-one-local-variable (var val)  (defun hack-one-local-variable (var val)
2103    "\"Set\" one variable in a local variables spec.    "\"Set\" one variable in a local variables spec.
# Line 2942  After saving the buffer, this function r Line 2968  After saving the buffer, this function r
2968    
2969  (defun save-some-buffers (&optional arg pred)  (defun save-some-buffers (&optional arg pred)
2970    "Save some modified file-visiting buffers.  Asks user about each one.    "Save some modified file-visiting buffers.  Asks user about each one.
2971    You can answer `y' to save, `n' not to save, or `C-r' to look at the
2972    buffer in question with `view-buffer' before deciding.
2973    
2974  Optional argument (the prefix) non-nil means save all with no questions.  Optional argument (the prefix) non-nil means save all with no questions.
2975  Optional second argument PRED determines which buffers are considered:  Optional second argument PRED determines which buffers are considered:
2976  If PRED is nil, all the file-visiting buffers are considered.  If PRED is nil, all the file-visiting buffers are considered.

Legend:
Removed from v.1.589  
changed lines
  Added in v.1.590

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26