GNU bug report logs -
#8484
24.0.50; Dired problems with marking and hidden subdirs
Previous Next
Reported by: Stephen Berman <stephen.berman <at> gmx.net>
Date: Tue, 12 Apr 2011 12:00:04 UTC
Severity: normal
Tags: fixed
Merged with 23454
Found in versions 24.0.50, 25.0.93
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8484 in the body.
You can then email your comments to 8484 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8484
; Package
emacs
.
(Tue, 12 Apr 2011 12:00:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 12 Apr 2011 12:00:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8484
; Package
emacs
.
(Fri, 22 Jan 2016 20:56:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 8484 <at> debbugs.gnu.org (full text, mbox):
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 <stephen.berman <at> gmx.net> 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
Merged 8484 23454.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 05 May 2016 22:50:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8484
; Package
emacs
.
(Mon, 14 Sep 2020 12:59:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 8484 <at> debbugs.gnu.org (full text, mbox):
Stephen Berman <stephen.berman <at> gmx.net> writes:
> 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 tried this recipe in Emacs 28, and I was unable to reproduce it, but
the recipe from the merged bug bug#23454 was still present in Emacs 28.
Stephen's patch seems to fix that example, so I've now applied it to the
trunk. I had to move some utility functions from dired-aux to avoid
dired.el unconditionally loading dired-aux always (since this change is
in a very fundamental dired function).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Sep 2020 12:59:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
8484 <at> debbugs.gnu.org and Stephen Berman <stephen.berman <at> gmx.net>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Sep 2020 12:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8484
; Package
emacs
.
(Tue, 15 Sep 2020 18:19:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 8484 <at> debbugs.gnu.org (full text, mbox):
> Stephen's patch seems to fix that example, so I've now applied it to the
> trunk. I had to move some utility functions from dired-aux to avoid
> dired.el unconditionally loading dired-aux always (since this change is
> in a very fundamental dired function).
Ouch, this broke my configuration. When the init file contains:
(add-hook 'dired-mode-hook 'dired-sort-toggle)
trying to visit a Dired buffer fails with:
Debugger entered--Lisp error: (error "No subdir-alist in tmp")
signal(error ("No subdir-alist in tmp"))
error("No subdir-alist in %s" #<buffer tmp>)
dired-current-directory()
dired-get-filename(nil t)
dired-save-positions()
dired-revert(nil nil)
revert-buffer()
dired-sort-toggle()
run-hooks(change-major-mode-after-body-hook dired-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook dired-mode-hook))
run-mode-hooks(dired-mode-hook)
dired-mode("/tmp/" "-al")
dired-internal-noselect("/tmp/" nil)
dired-noselect("/tmp" nil)
dired("/tmp" nil)
funcall-interactively(dired "/tmp" nil)
call-interactively(dired nil nil)
command-execute(dired)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#8484
; Package
emacs
.
(Wed, 16 Sep 2020 11:37:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 8484 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> Stephen's patch seems to fix that example, so I've now applied it to the
>> trunk. I had to move some utility functions from dired-aux to avoid
>> dired.el unconditionally loading dired-aux always (since this change is
>> in a very fundamental dired function).
>
> Ouch, this broke my configuration. When the init file contains:
>
> (add-hook 'dired-mode-hook 'dired-sort-toggle)
>
> trying to visit a Dired buffer fails with:
>
> Debugger entered--Lisp error: (error "No subdir-alist in tmp")
> signal(error ("No subdir-alist in tmp"))
> error("No subdir-alist in %s" #<buffer tmp>)
> dired-current-directory()
> dired-get-filename(nil t)
It looks like that function can't be called before a dired function is
properly set up, but dired-sort-toggle does so. I've now made
dired-get-filename more robust again after the previous change to that
function.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 15 Oct 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.