diff options
| -rw-r--r-- | lisp/dired-aux.el | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index bf7c9c00d18..9b401b7e41c 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -627,9 +627,14 @@ the list of file names explicitly with the FILE-LIST argument." | |||
| 627 | (defun dired-do-kill-lines (&optional arg fmt) | 627 | (defun dired-do-kill-lines (&optional arg fmt) |
| 628 | "Kill all marked lines (not the files). | 628 | "Kill all marked lines (not the files). |
| 629 | With a prefix argument, kill that many lines starting with the current line. | 629 | With a prefix argument, kill that many lines starting with the current line. |
| 630 | \(A negative argument kills lines before the current line.) | 630 | \(A negative argument kills backward.) |
| 631 | To kill an entire subdirectory, go to its directory header line | 631 | If you use this command with a prefix argument to kill the line |
| 632 | and use this command with a prefix argument (the value does not matter)." | 632 | for a file that is a directory, which you have inserted in the |
| 633 | Dired buffer as a subdirectory, then it deletes that subdirectory | ||
| 634 | from the buffer as well. | ||
| 635 | To kill an entire subdirectory \(without killing its line in the | ||
| 636 | parent directory), go to its directory header line and use this | ||
| 637 | command with a prefix argument (the value does not matter)." | ||
| 633 | ;; Returns count of killed lines. FMT="" suppresses message. | 638 | ;; Returns count of killed lines. FMT="" suppresses message. |
| 634 | (interactive "P") | 639 | (interactive "P") |
| 635 | (if arg | 640 | (if arg |
| @@ -638,23 +643,14 @@ and use this command with a prefix argument (the value does not matter)." | |||
| 638 | (dired-kill-line arg)) | 643 | (dired-kill-line arg)) |
| 639 | (save-excursion | 644 | (save-excursion |
| 640 | (goto-char (point-min)) | 645 | (goto-char (point-min)) |
| 641 | (let (buffer-read-only (count 0)) | 646 | (let (buffer-read-only |
| 642 | (if (not arg) ; kill marked lines | 647 | (count 0) |
| 643 | (let ((regexp (dired-marker-regexp))) | 648 | (regexp (dired-marker-regexp))) |
| 644 | (while (and (not (eobp)) | 649 | (while (and (not (eobp)) |
| 645 | (re-search-forward regexp nil t)) | 650 | (re-search-forward regexp nil t)) |
| 646 | (setq count (1+ count)) | 651 | (setq count (1+ count)) |
| 647 | (delete-region (progn (beginning-of-line) (point)) | 652 | (delete-region (progn (beginning-of-line) (point)) |
| 648 | (progn (forward-line 1) (point))))) | 653 | (progn (forward-line 1) (point)))) |
| 649 | ;; else kill unmarked lines | ||
| 650 | (while (not (eobp)) | ||
| 651 | (if (or (dired-between-files) | ||
| 652 | (not (looking-at "^ "))) | ||
| 653 | (forward-line 1) | ||
| 654 | (setq count (1+ count)) | ||
| 655 | (delete-region (point) (save-excursion | ||
| 656 | (forward-line 1) | ||
| 657 | (point)))))) | ||
| 658 | (or (equal "" fmt) | 654 | (or (equal "" fmt) |
| 659 | (message (or fmt "Killed %d line%s.") count (dired-plural-s count))) | 655 | (message (or fmt "Killed %d line%s.") count (dired-plural-s count))) |
| 660 | count)))) | 656 | count)))) |