all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
@ 2022-11-05 11:32 Gabriel
  2022-11-10 10:09 ` Eli Zaretskii
  2022-11-11 21:37 ` Michael Heerdegen
  0 siblings, 2 replies; 6+ messages in thread
From: Gabriel @ 2022-11-05 11:32 UTC (permalink / raw)
  To: 59047

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Description:
In Dired, the use of `dired-hide-subdir' breaks the subsequent
invocations of `dired-hide-details-mode'.

Steps to reproduce:
Emacs 29.0.50 (master 8721e87a6ec0874057f83f54498a0e3a64475a53)
1) emacs -Q
2) Open any Dired buffer, e.g.: C-x C-f ~/
3) Press key ( a couple of times to toggle `dired-hide-details-mode'
4) Press key $ twice to hide and unhide the current directory list
5) Press key ( a couple of times to toggle `dired-hide-details-mode'

On step 5), the `dired-hide-details-mode' ceases to work.

Patch:
The patch below adds a call to `dired-insert-set-properties` to restore
the text properties lost by `dired-hide-subdir'. More specifically, the
`dired--hide' removes the 'invisible text property that is used by Dired
to toggle the visibility of some information, such as
details-information, details-detail and details-link.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-dired-hide-details-mode-work-after-dired-hide-s.patch --]
[-- Type: text/x-diff, Size: 1734 bytes --]

From 24100cce5eca106d5019def99ba39848fff1a901 Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
Date: Sat, 5 Nov 2022 08:27:50 -0300
Subject: [PATCH 1/1] Make dired-hide-details-mode work after
 dired-hide-subdir.

* lisp/dired.el (dired--unhide): Restore text properties.
---
 lisp/dired.el            |  3 ++-
 test/lisp/dired-tests.el | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 209e270942..825d0e4750 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3034,7 +3034,8 @@ dired--unhide
       (remove-list-of-text-properties
        (progn (goto-char start) (line-end-position))
        (progn (goto-char end) (line-end-position))
-       '(invisible)))))
+       '(invisible))
+      (dired-insert-set-properties start end))))
 
 ;;; Functions for finding the file name in a dired buffer line
 
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 09becc7fe7..fd7ff73267 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -288,6 +288,16 @@ dired-test-bug27631
             (should (cdr (dired-get-marked-files))))
         (when (buffer-live-p buf) (kill-buffer buf))))))
 
+(ert-deftest dired-test-bugXXXX ()
+  "Test for https://debbugs.gnu.org/XXXX ."
+  (dired (list (expand-file-name "src" source-directory)
+               "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c"))
+  (dired-hide-all)
+  (dired-hide-all)
+  (dired-next-line 1)
+  (should (equal 'dired-hide-details-detail
+                 (get-text-property (1+ (line-beginning-position)) 'invisible))))
+
 (ert-deftest dired-test-bug27899 ()
   "Test for https://debbugs.gnu.org/27899 ."
   :tags '(:unstable)
-- 
2.34.1


[-- Attachment #3: Type: text/plain, Size: 178 bytes --]


I did some tests and could not find any regression. I wrote a simple
test case. If there is a better way to fix the issue or to improve the
test case, let me know.

---
Gabriel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
  2022-11-05 11:32 bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode Gabriel
@ 2022-11-10 10:09 ` Eli Zaretskii
  2022-11-11 21:37 ` Michael Heerdegen
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-11-10 10:09 UTC (permalink / raw)
  To: Gabriel; +Cc: 59047-done

> From: Gabriel <gabriel376@hotmail.com>
> Date: Sat, 05 Nov 2022 08:32:16 -0300
> 
> Description:
> In Dired, the use of `dired-hide-subdir' breaks the subsequent
> invocations of `dired-hide-details-mode'.
> 
> Steps to reproduce:
> Emacs 29.0.50 (master 8721e87a6ec0874057f83f54498a0e3a64475a53)
> 1) emacs -Q
> 2) Open any Dired buffer, e.g.: C-x C-f ~/
> 3) Press key ( a couple of times to toggle `dired-hide-details-mode'
> 4) Press key $ twice to hide and unhide the current directory list
> 5) Press key ( a couple of times to toggle `dired-hide-details-mode'
> 
> On step 5), the `dired-hide-details-mode' ceases to work.
> 
> Patch:
> The patch below adds a call to `dired-insert-set-properties` to restore
> the text properties lost by `dired-hide-subdir'. More specifically, the
> `dired--hide' removes the 'invisible text property that is used by Dired
> to toggle the visibility of some information, such as
> details-information, details-detail and details-link.

Thanks, installed.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
  2022-11-05 11:32 bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode Gabriel
  2022-11-10 10:09 ` Eli Zaretskii
@ 2022-11-11 21:37 ` Michael Heerdegen
  2022-11-11 21:48   ` Gabriel
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2022-11-11 21:37 UTC (permalink / raw)
  To: Gabriel; +Cc: 59047

Gabriel <gabriel376@hotmail.com> writes:

> I did some tests and could not find any regression. I wrote a simple
> test case. If there is a better way to fix the issue or to improve the
> test case, let me know.

Thanks for that.

Does your patch also fix Bug#48147: 27.2; "dired-hide-details-mode does
not work properly with dired-subdirs" (seems so...)?  Can you confirm
that your patch is the correct fix also for that very similar bug?

TIA,

Michael.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
  2022-11-11 21:37 ` Michael Heerdegen
@ 2022-11-11 21:48   ` Gabriel
  2022-11-12  7:04     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel @ 2022-11-11 21:48 UTC (permalink / raw)
  To: 59047

Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> Thanks for that.
>
> Does your patch also fix Bug#48147: 27.2; "dired-hide-details-mode does
> not work properly with dired-subdirs" (seems so...)?  Can you confirm
> that your patch is the correct fix also for that very similar bug?
>
> TIA,
>
> Michael.

Hi Michael,

Thank you for your message. This bug looks exactly the same I reported
in this thread. I did some tests and confirm that the patch fixes the
original issue. Perhaps we can remove the `FIXME` note in
`dired--unhide`?

---

Gabriel





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
  2022-11-11 21:48   ` Gabriel
@ 2022-11-12  7:04     ` Eli Zaretskii
  2022-11-12 21:58       ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-11-12  7:04 UTC (permalink / raw)
  To: Gabriel; +Cc: 48147-done, 59047

> From: Gabriel <gabriel376@hotmail.com>
> Date: Fri, 11 Nov 2022 18:48:59 -0300
> 
> Michael Heerdegen <michael_heerdegen@web.de> writes:
> >
> > Thanks for that.
> >
> > Does your patch also fix Bug#48147: 27.2; "dired-hide-details-mode does
> > not work properly with dired-subdirs" (seems so...)?  Can you confirm
> > that your patch is the correct fix also for that very similar bug?
> >
> > TIA,
> >
> > Michael.
> 
> Hi Michael,
> 
> Thank you for your message. This bug looks exactly the same I reported
> in this thread. I did some tests and confirm that the patch fixes the
> original issue. Perhaps we can remove the `FIXME` note in
> `dired--unhide`?

Done.

I'm also closing bug#48147.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
  2022-11-12  7:04     ` Eli Zaretskii
@ 2022-11-12 21:58       ` Michael Heerdegen
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Heerdegen @ 2022-11-12 21:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Gabriel, 48147-done, 59047

Eli Zaretskii <eliz@gnu.org> writes:

> Done. [I.e. removing this FIXME:
| -  ;; FIXME: This also removes other invisible properties!
> in `dired--unhide'.]

Although the FIXME hinted at the solution for this bug, that code could
still be causing other trouble (we now re-add only invisible props
coming from dired-hide-details-mode, right?), so I'm not sure if it's
good to remove the FIXME.

> I'm also closing bug#48147

Thanks.


Michael.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-12 21:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-05 11:32 bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode Gabriel
2022-11-10 10:09 ` Eli Zaretskii
2022-11-11 21:37 ` Michael Heerdegen
2022-11-11 21:48   ` Gabriel
2022-11-12  7:04     ` Eli Zaretskii
2022-11-12 21:58       ` Michael Heerdegen

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.