emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107719: Rename file-subdir-of-p to f


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107719: Rename file-subdir-of-p to file-in-directory-p.
Date: Sun, 01 Apr 2012 10:44:24 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107719
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-04-01 10:44:24 +0800
message:
  Rename file-subdir-of-p to file-in-directory-p.
  
  * lisp/files.el (file-in-directory-p): Rename from file-subdir-of-p.
  Handle root directory properly.
  (copy-directory): Caller changed.
  
  * lisp/dired-aux.el (dired-copy-file-recursive, dired-create-files):
  * lisp/net/tramp.el (tramp-file-name-for-operation): Callers changed.
  
  * doc/lispref/files.texi (Kinds of Files): file-subdir-of-p renamed to
  file-in-directory-p.
modified:
  doc/lispref/ChangeLog
  doc/lispref/files.texi
  lisp/ChangeLog
  lisp/dired-aux.el
  lisp/dired.el
  lisp/files.el
  lisp/net/tramp.el
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2012-03-31 19:58:05 +0000
+++ b/doc/lispref/ChangeLog     2012-04-01 02:44:24 +0000
@@ -1,3 +1,8 @@
+2012-04-01  Chong Yidong  <address@hidden>
+
+       * files.texi (Kinds of Files): file-subdir-of-p renamed to
+       file-in-directory-p.
+
 2012-03-31  Glenn Morris  <address@hidden>
 
        * edebug.texi (Instrumenting Macro Calls):

=== modified file 'doc/lispref/files.texi'
--- a/doc/lispref/files.texi    2012-03-01 08:21:32 +0000
+++ b/doc/lispref/files.texi    2012-04-01 02:44:24 +0000
@@ -1024,12 +1024,13 @@
 not exist, the return value is unspecified.
 @end defun
 
address@hidden file-subdir-of-p dir1 dir2
-This function returns @code{t} if directory @var{dir1} is a
-subdirectory of @var{dir2}, or if @var{dir1} and @var{dir2} are the
-same directory.  It compares the @code{file-truename} values of the
-two directories (@pxref{Truenames}).  If @var{dir2}
-do not name an existing directory, the return value is @code{nil}.
address@hidden file-in-directory-p file dir
+This function returns @code{t} if @var{file} is a file in directory
address@hidden, or in a subdirectory of @var{dir}.  It also returns
address@hidden if @var{file} and @var{dir} are the same directory.  It
+compares the @code{file-truename} values of the two directories
+(@pxref{Truenames}).  If @var{dir} does not name an existing
+directory, the return value is @code{nil}.
 @end defun
 
 @node Truenames
@@ -2718,7 +2719,7 @@
 @code{file-name-nondirectory},
 @code{file-name-sans-versions}, @code{file-newer-than-file-p},
 @code{file-ownership-preserved-p},
address@hidden, @code{file-regular-p}, @code{file-subdir-of-p},
address@hidden, @code{file-regular-p}, @code{file-in-directory-p},
 @code{file-symlink-p}, @code{file-truename}, @code{file-writable-p},
 @code{file-equal-p}, @code{find-backup-file-name},
 @c Not sure why it was here:   @code{find-file-noselect},@*

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-31 20:22:04 +0000
+++ b/lisp/ChangeLog    2012-04-01 02:44:24 +0000
@@ -1,3 +1,12 @@
+2012-04-01  Chong Yidong  <address@hidden>
+
+       * files.el (file-in-directory-p): Rename from file-subdir-of-p.
+       Handle root directory properly.
+       (copy-directory): Caller changed.
+
+       * dired-aux.el (dired-copy-file-recursive, dired-create-files):
+       * net/tramp.el (tramp-file-name-for-operation): Callers changed.
+
 2012-03-31  Glenn Morris  <address@hidden>
 
        * term/xterm.el (xterm-extra-capabilities): Doc fix.

=== modified file 'lisp/dired-aux.el'
--- a/lisp/dired-aux.el 2012-03-30 16:52:52 +0000
+++ b/lisp/dired-aux.el 2012-04-01 02:44:24 +0000
@@ -1265,7 +1265,7 @@
 (defun dired-copy-file-recursive (from to ok-flag &optional
                                       preserve-time top recursive)
   (when (and (eq t (car (file-attributes from)))
-            (file-subdir-of-p to from))
+            (file-in-directory-p to from))
     (error "Cannot copy `%s' into its subdirectory `%s'" from to))
   (let ((attrs (file-attributes from)))
     (if (and recursive
@@ -1456,7 +1456,7 @@
              ;; and the method in use is copying, signal an error.
              (and (eq t (car (file-attributes destname)))
                   (eq file-creator 'dired-copy-file)
-                  (file-subdir-of-p destname from)
+                  (file-in-directory-p destname from)
                   (error "Cannot copy `%s' into its subdirectory `%s'"
                          from to)))
             (condition-case err

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2012-03-31 07:45:33 +0000
+++ b/lisp/dired.el     2012-04-01 02:44:24 +0000
@@ -3736,7 +3736,7 @@
 ;;;;;;  dired-run-shell-command dired-do-shell-command 
dired-do-async-shell-command
 ;;;;;;  dired-clean-directory dired-do-print dired-do-touch dired-do-chown
 ;;;;;;  dired-do-chgrp dired-do-chmod dired-compare-directories 
dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" 
"a07cca6379bd3fdc9eaeba4d341b89ee")
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" 
"58d623eb8e68e472e6164a1bcae83360")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2012-03-30 16:49:29 +0000
+++ b/lisp/files.el     2012-04-01 02:44:24 +0000
@@ -5015,20 +5015,20 @@
             (setq f2-attr (file-attributes (file-truename file2)))
             (equal f1-attr f2-attr))))))
 
-(defun file-subdir-of-p (dir1 dir2)
-  "Return non-nil if DIR1 is a subdirectory of DIR2.
-A directory is considered to be a subdirectory of itself.
-Return nil if top directory DIR2 is not an existing directory."
-  (let ((handler (or (find-file-name-handler dir1 'file-subdir-of-p)
-                     (find-file-name-handler dir2 'file-subdir-of-p))))
+(defun file-in-directory-p (file dir)
+  "Return non-nil if FILE is in DIR or a subdirectory of DIR.
+A directory is considered to be \"in\" itself.
+Return nil if DIR is not an existing directory."
+  (let ((handler (or (find-file-name-handler file 'file-in-directory-p)
+                     (find-file-name-handler dir  'file-in-directory-p))))
     (if handler
-        (funcall handler 'file-subdir-of-p dir1 dir2)
-      (when (file-directory-p dir2) ; Top dir must exist.
-       (setq dir1 (file-truename dir1)
-             dir2 (file-truename dir2))
-       (let ((ls1  (or (split-string dir1 "/" t) '("/")))
-             (ls2  (or (split-string dir2 "/" t) '("/")))
-             (root (if (string-match "\\`/" dir1) "/" ""))
+        (funcall handler 'file-in-directory-p file dir)
+      (when (file-directory-p dir) ; DIR must exist.
+       (setq file (file-truename file)
+             dir  (file-truename dir))
+       (let ((ls1 (split-string file "/" t))
+             (ls2 (split-string dir  "/" t))
+             (root (if (string-match "\\`/" file) "/" ""))
              (mismatch nil))
          (while (and ls1 ls2 (not mismatch))
            (if (string-equal (car ls1) (car ls2))
@@ -5037,7 +5037,7 @@
            (setq ls1 (cdr ls1)
                  ls2 (cdr ls2)))
          (unless mismatch
-           (file-equal-p root dir2)))))))
+           (file-equal-p root dir)))))))
 
 (defun copy-directory (directory newname &optional keep-time parents 
copy-contents)
   "Copy DIRECTORY to NEWNAME.  Both args must be strings.
@@ -5065,7 +5065,7 @@
            (format "Copy directory %s to: " dir)
            default-directory default-directory nil nil)
           current-prefix-arg t nil)))
-  (when (file-subdir-of-p newname directory)
+  (when (file-in-directory-p newname directory)
     (error "Cannot copy `%s' into its subdirectory `%s'"
            directory newname))
   ;; If default-directory is a remote directory, make sure we find its

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2012-02-28 09:28:52 +0000
+++ b/lisp/net/tramp.el 2012-04-01 02:44:24 +0000
@@ -1810,7 +1810,7 @@
                  ;; Emacs 23+ only.
                  'copy-directory
                  ;; Emacs 24+ only.
-                 'file-equal-p 'file-subdir-of-p
+                 'file-equal-p 'file-in-directory-p
                  ;; XEmacs only.
                  'dired-make-relative-symlink
                  'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))


reply via email to

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