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

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.