From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#8484: 24.0.50; Dired problems with marking and hidden subdirs Date: Fri, 22 Jan 2016 21:55:21 +0100 Message-ID: <87y4bh72rq.fsf@amu.edu.pl> References: <87k4ez8yva.fsf@escher.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1453496187 10091 80.91.229.3 (22 Jan 2016 20:56:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Jan 2016 20:56:27 +0000 (UTC) Cc: 8484@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 22 21:56:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aMikh-0007Kq-4R for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Jan 2016 21:56:15 +0100 Original-Received: from localhost ([::1]:55500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMikg-0003s3-Fc for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Jan 2016 15:56:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMikZ-0003mC-5V for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2016 15:56:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMikU-00058b-41 for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2016 15:56:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMikU-00058X-19 for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2016 15:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aMikT-000827-SG for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2016 15:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Jan 2016 20:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8484 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8484-submit@debbugs.gnu.org id=B8484.145349613630846 (code B ref 8484); Fri, 22 Jan 2016 20:56:01 +0000 Original-Received: (at 8484) by debbugs.gnu.org; 22 Jan 2016 20:55:36 +0000 Original-Received: from localhost ([127.0.0.1]:58122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aMik4-00081Q-Ad for submit@debbugs.gnu.org; Fri, 22 Jan 2016 15:55:36 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:55429) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aMik2-00081I-G2 for 8484@debbugs.gnu.org; Fri, 22 Jan 2016 15:55:35 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 6D115893489; Fri, 22 Jan 2016 21:55:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YrI+Vewb31mt; Fri, 22 Jan 2016 21:55:25 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 51DE6893487; Fri, 22 Jan 2016 21:55:25 +0100 (CET) In-Reply-To: <87k4ez8yva.fsf@escher.fritz.box> (Stephen Berman's message of "Tue, 12 Apr 2011 13:58:49 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111861 Archived-At: Hello, I'm writing to confirm that I can reproduce this under GNU Emacs 25.1.50.1. Best, Marcin Borkowski On 2011-04-12, at 14:58, Stephen Berman wrote: > 1. emacs -Q > 2. Create a directory containing a non-empty directory, > e.g. "~/test/test0/test1". > 3. Visit "test" in Dired: `C-x d ~/test RET' > 4. Put point on "test0" and type `i' to insert the subdirectory. > 5. With point within the inserted subdirectory type `$' to hide it. > 6. Type `% m RET' to mark all files except "." and "..". This is what > buffer "test" now looks like: > > /home/steve/test: > total used in directory 12 available 24083132 > drwxr-xr-x 3 steve users 4096 2011-04-12 09:22 . > drwxr-xr-x 6 steve users 4096 2011-04-12 09:20 .. > * drwxr-xr-x 3 steve users 4096 2011-04-12 09:23 test0 > > * /home/steve/test/test0:... > > 7. Try to operate on the marked files, e.g. `C', `R', 'D' etc. > => Instead of the operation being executed, you get the message "Cannot > operate on `.' or `..'". > 8. Now type `$' on the hidden subdirectory to unhide it. The two marked > lines remain marked. Then repeat step 7. > => Regardless of where point is, you get this error: "No file on this line" > > I believe these problems are due to the hidden subdirectory being a > single line, since selective display replaces "\n" with "\r". In the > first case, when dired-mark-if is called in dired-mark-files-regexp, > with point at the beginning of the hidden subdirectory, (looking-at > dired-re-dot) is nil but dired-get-filename finds "." inside "test0", > and this triggers the error message. In the second case, when > dired-move-to-filename is called in dired-map-over-marks with point on > the subdirectory, it fails and raises the error. > > I see two directions to go for fixing this: (a) temporarily unhide the > subdirectory (probably iteratively) and then mark as usual, so that the > dired-re-dot filter succeeds; (b) prevent any marking of (and hence > within) hidden subdirectories. It seems that the latter is more > consistent with current Dired behavior: if you remove the marks from > "test" above, then unhide "test0", then type `% m RET', so that now > "test0" and "test1" are marked, then hide "test0" again, then invoke an > operation, e.g. `C', `R', 'D' etc. -- only "test0" gets operated on, not > "test1". That is, the marked file in the hidden subdirectory is > ignored. So marking the hidden subdirectory in step 6 above is the real > bug, given current Dired behavior. One way to fix this is the below > patch to dired-get-filename: this checks whether the current line is a > hidden subdirectory and if so, unhides it, so that it isn't just a > single line and the line does not get marked, then after > dired-move-to-filename fails, hides it again, shortcutting any further > marking. > > In GNU Emacs 24.0.50.1 (i686-suse-linux-gnu, GTK+ Version 2.20.1) > of 2011-04-03 on escher > Windowing system distributor `The X.Org Foundation', version 11.0.10800000 > configured using `configure '--without-toolkit-scroll-bars' 'CFLAGS=-g -O2 -fno-optimize-sibling-calls'' > > 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 > value of $XMODIFIERS: @im=local > locale-coding-system: utf-8-unix > default enable-multibyte-characters: t > > > *** /data/steve/bzr/emacs/trunk/lisp/dired.el 2011-04-03 16:10:27.000000000 +0200 > --- /data/steve/bzr/emacs/quickfixes/lisp/dired.el 2011-04-12 12:48:02.000000000 +0200 > *************** > *** 2049,2058 **** > Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as > regular filenames and return nil if no filename on this line. > Otherwise, an error occurs in these cases." > ! (let (case-fold-search file p1 p2 already-absolute) > (save-excursion > (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep))) > (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep)))) > ;; nil if no file on this line, but no-error-if-not-filep is t: > (if (setq file (and p1 p2 (buffer-substring p1 p2))) > (progn > --- 2049,2061 ---- > Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as > regular filenames and return nil if no filename on this line. > Otherwise, an error occurs in these cases." > ! (let ((hidden (dired-subdir-hidden-p (dired-current-directory))) > ! case-fold-search file p1 p2 already-absolute) > ! (if hidden (dired-unhide-subdir)) > (save-excursion > (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep))) > (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep)))) > + (if hidden (dired-hide-subdir 1)) > ;; nil if no file on this line, but no-error-if-not-filep is t: > (if (setq file (and p1 p2 (buffer-substring p1 p2))) > (progn