* bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
@ 2011-04-12 11:58 Stephen Berman
2016-01-22 20:55 ` Marcin Borkowski
2020-09-14 12:58 ` Lars Ingebrigtsen
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Berman @ 2011-04-12 11:58 UTC (permalink / raw)
To: 8484
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
2011-04-12 11:58 bug#8484: 24.0.50; Dired problems with marking and hidden subdirs Stephen Berman
@ 2016-01-22 20:55 ` Marcin Borkowski
2020-09-14 12:58 ` Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2016-01-22 20:55 UTC (permalink / raw)
To: Stephen Berman; +Cc: 8484
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@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
2011-04-12 11:58 bug#8484: 24.0.50; Dired problems with marking and hidden subdirs Stephen Berman
2016-01-22 20:55 ` Marcin Borkowski
@ 2020-09-14 12:58 ` Lars Ingebrigtsen
2020-09-15 18:04 ` Juri Linkov
1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-14 12:58 UTC (permalink / raw)
To: Stephen Berman; +Cc: 8484
Stephen Berman <stephen.berman@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
2020-09-14 12:58 ` Lars Ingebrigtsen
@ 2020-09-15 18:04 ` Juri Linkov
2020-09-16 11:36 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2020-09-15 18:04 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Stephen Berman, 8484
> 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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#8484: 24.0.50; Dired problems with marking and hidden subdirs
2020-09-15 18:04 ` Juri Linkov
@ 2020-09-16 11:36 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-16 11:36 UTC (permalink / raw)
To: Juri Linkov; +Cc: Stephen Berman, 8484
Juri Linkov <juri@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-16 11:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 11:58 bug#8484: 24.0.50; Dired problems with marking and hidden subdirs Stephen Berman
2016-01-22 20:55 ` Marcin Borkowski
2020-09-14 12:58 ` Lars Ingebrigtsen
2020-09-15 18:04 ` Juri Linkov
2020-09-16 11:36 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.