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


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Tue, 02 Jul 2002 14:58:29 -0400

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.587 emacs/lisp/files.el:1.588
*** emacs/lisp/files.el:1.587   Sun Jun 30 10:41:43 2002
--- emacs/lisp/files.el Tue Jul  2 14:58:29 2002
***************
*** 613,618 ****
--- 613,624 ----
                          (cons load-path load-suffixes))))
    (load library))
  
+ (defun file-remote-p (file)
+   "Test whether FILE specifies a location on a remote system."
+   (let ((handler (find-file-name-handler file 'file-local-copy)))
+     (if handler
+       (get handler 'file-remote-p))))
+ 
  (defun file-local-copy (file)
    "Copy the file FILE into a temporary file on this machine.
  Returns the name of the local copy, or nil, if FILE is directly
***************
*** 2034,2042 ****
--- 2040,2077 ----
  ;; This one is safe because the user gets to check it before it is used.
  (put 'compile-command 'safe-local-variable t)
  
+ (put 'c-add-style 'safe-local-eval-function t)
+ (put 'c-set-style 'safe-local-eval-function t)
+ 
  (defun hack-one-local-variable-quotep (exp)
    (and (consp exp) (eq (car exp) 'quote) (consp (cdr exp))))
  
+ (defun hack-one-local-variable-constantp (exp)
+   (or (and (not (symbolp exp)) (not (consp exp)))
+       (memq exp '(t nil))
+       (keywordp exp)
+       (hack-one-local-variable-quotep exp)))
+ 
+ (defun hack-one-local-variable-eval-safep (exp)
+   "Return t if it is safe to eval EXP when it is found in a file."
+   (and (consp exp)
+        (or (and (eq (car exp) 'put)
+               (hack-one-local-variable-quotep (nth 1 exp))
+               (hack-one-local-variable-quotep (nth 2 exp))
+               (memq (nth 1 (nth 2 exp))
+                     '(lisp-indent-hook))
+               ;; Only allow safe values of lisp-indent-hook;
+               ;; not functions.
+               (or (numberp (nth 3 exp))
+                   (equal (nth 3 exp) ''defun)))
+          (and (symbolp (car exp))
+               (get (car exp) 'safe-local-eval-function)
+               (let ((ok t))
+                 (dolist (arg (cdr exp))
+                   (unless (hack-one-local-variable-constantp arg)
+                     (setq ok nil)))
+                 ok)))))
+ 
  (defun hack-one-local-variable (var val)
    "\"Set\" one variable in a local variables spec.
  A few patterns are specified so that any name which matches one
***************
*** 2059,2074 ****
         ;; Permit evalling a put of a harmless property.
         ;; if the args do nothing tricky.
         (if (or (and (eq var 'eval)
!                     (consp val)
!                     (eq (car val) 'put)
!                     (hack-one-local-variable-quotep (nth 1 val))
!                     (hack-one-local-variable-quotep (nth 2 val))
!                     ;; Only allow safe values of lisp-indent-hook;
!                     ;; not functions.
!                     (or (numberp (nth 3 val))
!                         (equal (nth 3 val) ''defun))
!                     (memq (nth 1 (nth 2 val))
!                           '(lisp-indent-hook)))
                 ;; Permit eval if not root and user says ok.
                 (and (not (zerop (user-uid)))
                      (or (eq enable-local-eval t)
--- 2094,2100 ----
         ;; Permit evalling a put of a harmless property.
         ;; if the args do nothing tricky.
         (if (or (and (eq var 'eval)
!                     (hack-one-local-variable-eval-safep val))
                 ;; Permit eval if not root and user says ok.
                 (and (not (zerop (user-uid)))
                      (or (eq enable-local-eval t)
***************
*** 3849,3855 ****
                 wildcard full-directory-p)
        (if (eq system-type 'vax-vms)
          (vms-read-directory file switches (current-buffer))
!       (let (result available)
  
          ;; Read the actual directory using `insert-directory-program'.
          ;; RESULT gets the status code.
--- 3875,3881 ----
                 wildcard full-directory-p)
        (if (eq system-type 'vax-vms)
          (vms-read-directory file switches (current-buffer))
!       (let (result available (beg (point)))
  
          ;; Read the actual directory using `insert-directory-program'.
          ;; RESULT gets the status code.
***************
*** 3926,3940 ****
                (access-file file "Reading directory")
                (error "Listing directory failed but `access-file' worked")))
  
          ;; Try to insert the amount of free space.
          (save-excursion
!           (goto-char (point-min))
            ;; First find the line to put it on.
!           (when (re-search-forward "^total" nil t)
              (let ((available (get-free-disk-space ".")))
                (when available
                  ;; Replace "total" with "used", to avoid confusion.
!                 (replace-match "total used in directory")
                  (end-of-line)
                  (insert " available " available))))))))))
  
--- 3952,3979 ----
                (access-file file "Reading directory")
                (error "Listing directory failed but `access-file' worked")))
  
+         (when (string-match "--dired\\>" switches)
+           (forward-line -2)
+           (let ((end (line-end-position)))
+             (forward-word 1)
+             (forward-char 3)
+             (while (< (point) end)
+               (let ((start (+ beg (read (current-buffer))))
+                     (end (+ beg (read (current-buffer)))))
+                 (put-text-property start end 'dired-filename t)))
+             (goto-char end)
+             (beginning-of-line)
+             (delete-region (point) (progn (forward-line 2) (point)))))
+ 
          ;; Try to insert the amount of free space.
          (save-excursion
!           (goto-char beg)
            ;; First find the line to put it on.
!           (when (re-search-forward "^ *\\(total\\)" nil t)
              (let ((available (get-free-disk-space ".")))
                (when available
                  ;; Replace "total" with "used", to avoid confusion.
!                 (replace-match "total used in directory" nil nil nil 1)
                  (end-of-line)
                  (insert " available " available))))))))))
  



reply via email to

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