Function: dired-do-kill-lines

dired-do-kill-lines is an autoloaded, interactive and byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-do-kill-lines &optional ARG FMT)

Documentation

Kill all marked lines (not the files).

With a prefix argument, kill that many lines starting with the current line.
(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).

To undo the killing, the undo command can be used as normally.

This function returns the number of killed lines.

FMT is a format string used for messaging the user about the killed lines, and defaults to "Killed %d line%s." if not present. A FMT of "" will suppress the messaging.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(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 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).

To undo the killing, the undo command can be used as normally.

This function returns the number of killed lines.

FMT is a format string used for messaging the user about the
killed lines, and defaults to \"Killed %d line%s.\" if not
present.  A FMT of \"\" will suppress the messaging."
  (interactive "P")
  (if arg
      (if (dired-get-subdir)
	  (dired-kill-subdir)
	(dired-kill-line arg))
    (save-excursion
      (goto-char (point-min))
      (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 (line-beginning-position)
			 (progn (forward-line 1) (point))))
	(or (equal "" fmt)
	    (message (or fmt "Killed %d line%s.") count (dired-plural-s count)))
	count))))