From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: `k' in Dired with inserted subdirectories. Date: Tue, 13 Jul 2004 14:55:13 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200407131955.i6DJtDt10122@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1089748714 21355 80.91.224.253 (13 Jul 2004 19:58:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2004 19:58:34 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Jul 13 21:58:22 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BkTPx-0003Hc-00 for ; Tue, 13 Jul 2004 21:58:21 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BkTPx-0002XZ-00 for ; Tue, 13 Jul 2004 21:58:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BkTSL-0006rL-0n for emacs-devel@quimby.gnus.org; Tue, 13 Jul 2004 16:00:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BkTSD-0006rE-VJ for emacs-devel@gnu.org; Tue, 13 Jul 2004 16:00:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BkTSB-0006r2-4X for emacs-devel@gnu.org; Tue, 13 Jul 2004 16:00:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BkTSA-0006qz-Ra for emacs-devel@gnu.org; Tue, 13 Jul 2004 16:00:39 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BkTPd-0003nZ-Nk for emacs-devel@gnu.org; Tue, 13 Jul 2004 15:58:01 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i6DJvtuE022109 for ; Tue, 13 Jul 2004 14:57:55 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i6DJtDt10122; Tue, 13 Jul 2004 14:55:13 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25654 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25654 As I pointed out in a prior message in this thread (quite a while ago), the documentation of `dired-do-kill-lines' in the docstring and the Emacs manual contradict each other and _both_ are wrong. Moreover, `dired-do-kill-lines' contains code that never gets executed. Of course, it is strictly speaking not necessary to remove that code. Since it never gets executed it never does any harm. But it is confusing to anybody reading the source code. The patches below to dired-aux and man/dired.texi correct both problems. The reason I replaced: ! \(A negative argument kills lines before the current line.) with: ! \(A negative argument kills backward.) in `dired-do-kill-lines's docstring is that to me, the original sentence does not make clear whether the line itself is included (it is). I can install if it looks OK. ===File ~/dired-aux-diff==================================== *** dired-aux.el 14 Jun 2004 22:05:32 -0500 1.124 --- dired-aux.el 13 Jul 2004 14:22:28 -0500 *************** *** 627,635 **** (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)." ;; Returns count of killed lines. FMT="" suppresses message. (interactive "P") (if arg --- 627,640 ---- (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 a prefix argument is given and you kill the line for a file ! that is a directory, which is inserted in the Dired buffer as ! a subdirectory, then that subdirectory is deleted 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 *************** *** 638,660 **** (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)))))) (or (equal "" fmt) (message (or fmt "Killed %d line%s.") count (dired-plural-s count))) count)))) --- 643,656 ---- (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 (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)))) ============================================================ ===File ~/dired.texi-diff=================================== *** dired.texi 14 Jun 2004 14:51:51 -0500 1.29 --- dired.texi 13 Jul 2004 12:46:51 -0500 *************** *** 1030,1039 **** files, or on the marked files if any; but it does not operate on the current file as a last resort. ! If you kill the line for a file that is a directory, the directory's ! contents are also deleted from the buffer. Typing @kbd{C-u k} on the ! header line for a subdirectory is another way to delete a subdirectory ! from the Dired buffer. The @kbd{g} command brings back any individual lines that you have killed in this way, but not subdirectories---you must use @kbd{i} to --- 1030,1040 ---- files, or on the marked files if any; but it does not operate on the current file as a last resort. ! If a numeric prefix argument is given and you kill the line for a ! file that is a directory, the directory's contents are also deleted ! from the buffer. Typing @kbd{C-u k} on the header line for a ! subdirectory is another way to delete a subdirectory from the Dired ! buffer. The @kbd{g} command brings back any individual lines that you have killed in this way, but not subdirectories---you must use @kbd{i} to ============================================================