]> code.delx.au - gnu-emacs/blobdiff - lisp/dired-aux.el
Much whitespace and capitalization change.
[gnu-emacs] / lisp / dired-aux.el
index fa859f3d52e8bd7330466b169dd6bc6581363557..2e210d084ba4d54f36e1cc50be84dc6f63f5396d 100644 (file)
@@ -163,8 +163,8 @@ condition.  Two file items are considered to match if they are equal
        (unless (let ((list list2))
                  (while (and list
                              (not (let* ((file2 (car list))
-                                         (fa1 (caddr file1))
-                                         (fa2 (caddr file2))
+                                         (fa1 (car (cddr file1)))
+                                         (fa2 (car (cddr file2)))
                                          (size1 (nth 7 fa1))
                                          (size2 (nth 7 fa2))
                                          (mtime1 (float-time (nth 5 fa1)))
@@ -255,6 +255,7 @@ This calls chmod, thus symbolic modes like `g+w' are allowed."
       (error "chown not supported on this system"))
   (dired-do-chxxx "Owner" dired-chown-program 'chown arg))
 
+;;;###autoload
 (defun dired-do-touch (&optional arg)
   "Change the timestamp of the marked (or next ARG) files.
 This calls touch."
@@ -342,6 +343,7 @@ Uses the shell command coming from variables `lpr-command' and
 
 (defvar dired-file-version-alist)
 
+;;;###autoload
 (defun dired-clean-directory (keep)
   "Flag numerical backups for deletion.
 Spares `dired-kept-versions' latest versions, and `kept-old-versions' oldest.
@@ -551,6 +553,7 @@ the list of file names explicitly with the FILE-LIST argument."
        (funcall stuff-it files)))))
 
 ;; This is an extra function so that it can be redefined by ange-ftp.
+;;;###autoload
 (defun dired-run-shell-command (command)
   (let ((handler
         (find-file-name-handler (directory-file-name default-directory)
@@ -624,9 +627,14 @@ the list of file names explicitly with the FILE-LIST argument."
 (defun dired-do-kill-lines (&optional arg fmt)
   "Kill all marked lines (not the files).
 With a prefix argument, kill that many lines starting with the current line.
-\(A negative argument kills lines before the current line.)
-To kill an entire subdirectory, go to its directory header line
-and use this command with a prefix argument (the value does not matter)."
+\(A negative argument kills backward.)
+If you use this command with a prefix argument to kill the line
+for a file that is a directory, which you have inserted in the
+Dired buffer as a subdirectory, then it deletes that subdirectory
+from the buffer as well.
+To kill an entire subdirectory \(without killing its line in the
+parent directory), go to its directory header line and use this
+command with a prefix argument (the value does not matter)."
   ;; Returns count of killed lines.  FMT="" suppresses message.
   (interactive "P")
   (if arg
@@ -635,23 +643,14 @@ and use this command with a prefix argument (the value does not matter)."
        (dired-kill-line arg))
     (save-excursion
       (goto-char (point-min))
-      (let (buffer-read-only (count 0))
-       (if (not arg)                   ; kill marked lines
-           (let ((regexp (dired-marker-regexp)))
-             (while (and (not (eobp))
-                         (re-search-forward regexp nil t))
-               (setq count (1+ count))
-               (delete-region (progn (beginning-of-line) (point))
-                              (progn (forward-line 1) (point)))))
-         ;; else kill unmarked lines
-         (while (not (eobp))
-           (if (or (dired-between-files)
-                   (not (looking-at "^  ")))
-               (forward-line 1)
-             (setq count (1+ count))
-             (delete-region (point) (save-excursion
-                                      (forward-line 1)
-                                      (point))))))
+      (let (buffer-read-only
+           (count 0)
+           (regexp (dired-marker-regexp)))
+       (while (and (not (eobp))
+                   (re-search-forward regexp nil t))
+         (setq count (1+ count))
+         (delete-region (progn (beginning-of-line) (point))
+                        (progn (forward-line 1) (point))))
        (or (equal "" fmt)
            (message (or fmt "Killed %d line%s.") count (dired-plural-s count)))
        count))))
@@ -805,6 +804,7 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.")
     ;; None of these keys quit - use C-g for that.
     ))
 
+;;;###autoload
 (defun dired-query (qs-var qs-prompt &rest qs-args)
   ;; Query user and return nil or t.
   ;; Store answer in symbol VAR (which must initially be bound to nil).
@@ -898,7 +898,8 @@ the buffer will not reset them.  However, using `dired-undo' to re-insert
 or delete subdirectories can bypass this machinery.  Hence, you sometimes
 may have to reset some subdirectory switches after a `dired-undo'.
 You can reset all subdirectory switches to the default using
-\\<dired-mode-map>\\[dired-reset-subdir-switches]."
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details."
   ;; Moves point if the next ARG files are redisplayed.
   (interactive "P\np")
   (if (and test-for-subdir (dired-get-subdir))
@@ -1092,19 +1093,6 @@ You can reset all subdirectory switches to the default using
 \f
 ;;; Copy, move/rename, making hard and symbolic links
 
-(defcustom dired-recursive-copies nil
-  "*Decide whether recursive copies are allowed.
-nil means no recursive copies.
-`always' means copy recursively without asking.
-`top' means ask for each directory at top level.
-Anything else means ask for each directory."
-  :type '(choice :tag "Copy directories"
-                (const :tag "No recursive copies" nil)
-                (const :tag "Ask for each directory" t)
-                (const :tag "Ask for each top directory only" top)
-                (const :tag "Copy directories without asking" always))
-  :group 'dired)
-
 (defcustom dired-backup-overwrite nil
   "*Non-nil if Dired should ask about making backups before overwriting files.
 Special value `always' suppresses confirmation."
@@ -1747,7 +1735,8 @@ the buffer will not reset them.  However, using `dired-undo' to re-insert
 or delete subdirectories can bypass this machinery.  Hence, you sometimes
 may have to reset some subdirectory switches after a `dired-undo'.
 You can reset all subdirectory switches to the default using
-\\<dired-mode-map>\\[dired-reset-subdir-switches]."
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details."
   (interactive
    (list (dired-get-filename)
         (if current-prefix-arg
@@ -1808,10 +1797,10 @@ This function takes some pains to conform to `ls -lR' output."
        (push (cons dirname switches) dired-switches-alist)))
     (when switches-have-R
       (dired-build-subdir-alist switches)
+      (setq switches (dired-replace-in-string "R" "" switches))
       (dolist (cur-ass dired-subdir-alist)
        (let ((cur-dir (car cur-ass)))
          (and (dired-in-this-tree cur-dir dirname)
-              (not (string= cur-dir dirname))
               (let ((cur-cons (assoc-string cur-dir dired-switches-alist)))
                 (if cur-cons
                     (setcdr cur-cons switches)
@@ -1852,19 +1841,23 @@ This function takes some pains to conform to `ls -lR' output."
                          (> (dired-get-subdir-min elt1)
                             (dired-get-subdir-min elt2)))))))
 
-(defun dired-kill-tree (dirname &optional remember-marks)
+(defun dired-kill-tree (dirname &optional remember-marks kill-root)
   "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself.
-With optional arg REMEMBER-MARKS, return an alist of marked files."
-  (interactive "DKill tree below directory: ")
-  (setq dirname (expand-file-name dirname))
+Interactively, you can kill DIRNAME as well by using a prefix argument.
+In interactive use, the command prompts for DIRNAME.
+
+When called from Lisp, if REMEMBER-MARKS is non-nil, return an alist
+of marked files.  If KILL-ROOT is non-nil, kill DIRNAME as well."
+  (interactive "DKill tree below directory: \ni\nP")
+  (setq dirname (file-name-as-directory (expand-file-name dirname)))
   (let ((s-alist dired-subdir-alist) dir m-alist)
     (while s-alist
       (setq dir (car (car s-alist))
            s-alist (cdr s-alist))
-      (if (and (not (string-equal dir dirname))
-              (dired-in-this-tree dir dirname)
-              (dired-goto-subdir dir))
-         (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
+      (and (or kill-root (not (string-equal dir dirname)))
+          (dired-in-this-tree dir dirname)
+          (dired-goto-subdir dir)
+          (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
     m-alist))
 
 (defun dired-insert-subdir-newpos (new-dir)