From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Phil Sung" Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: 23.0.50; Deleting files in wdired does not work Date: Mon, 21 Jan 2008 00:41:18 -0500 Message-ID: <60c603510801202141p7e4fdcfcmddf4d81b330a9715@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1200894100 15225 80.91.229.12 (21 Jan 2008 05:41:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jan 2008 05:41:40 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 21 06:41:59 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JGpPx-0003WL-5X for ged-emacs-devel@m.gmane.org; Mon, 21 Jan 2008 06:41:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGpPX-0004T5-5Q for ged-emacs-devel@m.gmane.org; Mon, 21 Jan 2008 00:41:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGpPS-0004Si-1s for emacs-devel@gnu.org; Mon, 21 Jan 2008 00:41:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGpPQ-0004SV-QA for emacs-devel@gnu.org; Mon, 21 Jan 2008 00:41:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGpPQ-0004SP-HF for emacs-devel@gnu.org; Mon, 21 Jan 2008 00:41:24 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JGpPQ-0006m1-5W for emacs-devel@gnu.org; Mon, 21 Jan 2008 00:41:24 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JGpPP-0001bY-S3 for emacs-pretest-bug@gnu.org; Mon, 21 Jan 2008 00:41:23 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JGpPM-0006lD-RS for emacs-pretest-bug@gnu.org; Mon, 21 Jan 2008 00:41:23 -0500 Original-Received: from fg-out-1718.google.com ([72.14.220.152]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JGpPM-0006kx-Ck for emacs-pretest-bug@gnu.org; Mon, 21 Jan 2008 00:41:20 -0500 Original-Received: by fg-out-1718.google.com with SMTP id d23so1842445fga.30 for ; Sun, 20 Jan 2008 21:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; bh=kQ057FwYT+pXlJajyCNWcfN4HBrFehoVjVYL6M6YfDI=; b=mBpAKcdrN9mr2OYy9mOXMIcTitanAuLQj8FoON58fQ9z9AnTGxbjW3dFH8oNJv2v0W1rx1DUd17AfAk5Ga0OrkeWTPh5ElmcexHKF0cCka4ME0coMX+6VAAxe5r162padPVdNakK5T8RVnmZahTTs39H3WN00CNpq+HfcLwmbK4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=c8briU/wbFc8YuM24OPbBHDA8VGdUCdKFavOIP6Zn74hZu1wCvAsf776S121F+WHby0BcOVpKYP88UQvLGfNFdQ33AFMuG73NKhUv0VSIemciFHSRYC6jBwSZ0JvZiaD45saUVs7amKH3mOywJVDI1nZTdB8zYWX8kWLTtOw+vw= Original-Received: by 10.86.25.17 with SMTP id 17mr6117521fgy.15.1200894078914; Sun, 20 Jan 2008 21:41:18 -0800 (PST) Original-Received: by 10.86.68.9 with HTTP; Sun, 20 Jan 2008 21:41:18 -0800 (PST) Content-Disposition: inline X-Google-Sender-Auth: 6c8b4c50fe97abb6 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:87189 gmane.emacs.pretest.bugs:20712 Archived-At: Marking files for deletion in wdired by deleting their filenames (as advertised in wdired.el and in the Info) does not work. Steps to reproduce: Open a directory in dired, e.g.: C-x C-f ~/wd/test RET Change to wdired mode: M-x wdired-change-to-wdired-mode The buffer looks like this: /home/phil/wd/test: total used in directory 8 available 130996008 drwxr-xr-x 2 phil phil 4096 2008-01-20 22:51 . drwxr-xr-x 15 phil phil 4096 2008-01-20 03:34 .. -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 bar -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 foo Delete a filename, like so: /home/phil/wd/test: total used in directory 8 available 130996008 drwxr-xr-x 2 phil phil 4096 2008-01-20 22:51 . drwxr-xr-x 15 phil phil 4096 2008-01-20 03:34 .. -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 foo Save the changes: C-c C-c The buffer now looks like this: /home/phil/wd/test: total used in directory 8 available 130996008 drwxr-xr-x 2 phil phil 4096 2008-01-20 22:52 . drwxr-xr-x 15 phil phil 4096 2008-01-20 03:34 .. -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 -rw-r--r-- 1 phil phil 0 2008-01-20 22:51 foo Expected output-- the file name should have been restored and the file marked for deletion: /home/phil/wd/test: total used in directory 8 available 130984448 drwxr-xr-x 2 phil phil 4096 2008-01-20 23:11 . drwxr-xr-x 15 phil phil 4096 2008-01-20 03:34 .. D -rw-r--r-- 1 phil phil 0 2008-01-20 23:11 bar -rw-r--r-- 1 phil phil 0 2008-01-20 23:11 foo It looks like wdired-get-filename adds a spurious newline to the result whenever the filename has been deleted in wdired. In addition, in wdired-finish-edit, to test whether a filename has been deleted, we should look at (wdired-get-filename t), which returns the basename only, and see whether it equals "". I propose the following patch: *** lisp/wdired.el 8 Jan 2008 20:44:46 -0000 1.33 --- lisp/wdired.el 21 Jan 2008 05:03:35 -0000 *************** *** 324,328 **** (if old (setq file (get-text-property beg 'old-name)) ! (setq end (next-single-property-change (1+ beg) 'end-name)) (setq file (buffer-substring-no-properties (1+ beg) end))) (and file (setq file (wdired-normalize-filename file)))) --- 324,332 ---- (if old (setq file (get-text-property beg 'old-name)) ! (setq end (min (line-end-position) ! ; n-s-p-c can return nil on the last filename in the ! ; buffer when that filename has been deleted ! (or (next-single-property-change (1+ beg) 'end-name) ! (point-max)))) (setq file (buffer-substring-no-properties (1+ beg) end))) (and file (setq file (wdired-normalize-filename file)))) *************** *** 390,394 **** (when (and file-ori (not (equal file-new file-ori))) (setq changes t) ! (if (not file-new) ;empty filename! (setq files-deleted (cons file-ori files-deleted)) (setq file-new (substitute-in-file-name file-new)) --- 394,398 ---- (when (and file-ori (not (equal file-new file-ori))) (setq changes t) ! (if (zerop (length (wdired-get-filename t))) ; empty filename (setq files-deleted (cons file-ori files-deleted)) (setq file-new (substitute-in-file-name file-new)) --- In GNU Emacs 23.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.12.3) of 2008-01-20 on phil Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Dired Minor modes in effect: shell-dirtrack-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t Recent input: C-a C-f C-f C-f ESC : ESC p C-e RET C-e DEL DEL DEL DEL DEL DEL C-a ESC : ESC p C-e ESC O D SPC t C-e RET C-e a C-a ESC : ESC p C-e RET C-e DEL C-x o C-s w d i r e d - g e t - f i l e n a m e C-s C-s C-s C-s C-s C-s C-s C-s C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n C-p C-p C-p C-n C-x b w d i r e d l DEL . e l RET C-n C-s w d i r e d - g e t - f i l e n a m e C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p ESC C-x C-n C-n C-p C-e C-p C-e C-n C-n C-p C-p C-a C-e C-a C-n C-e C-a C-p C-e C-a C-e C-a C-n C-e C-a C-p C-e C-a C-n C-e C-a C-p C-e C-a C-n C-e C-a C-p C-e C-a C-n C-p C-n C-p C-s w d i r e d - f i n i s h - e d i t C-s C-r C-r C-n ESC C-x C-x o C-c ESC C-n g C-x C-q C-e C-p DEL DEL DEL C-x C-s C-n C-n C-p C-p C-p C-n C-n C-n C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n ESC x r e p o r t - e m a c s - b u g TAB RET Recent messages: "/home/phil/wd/test/abcdef" " [2 times] "a" Mark saved where search started [2 times] wdired-get-filename Mark saved where search started wdired-finish-edit Changes aborted Press C-c C-c when finished or C-c ESC to abort changes Source file `/home/phil/source/emacs/lisp/mail/sendmail.el' newer than byte-compiled file