all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gabriel <gabriel376@hotmail.com>
To: 59047@debbugs.gnu.org
Subject: bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode
Date: Sat, 05 Nov 2022 08:32:16 -0300	[thread overview]
Message-ID: <SJ0PR06MB86099CE043DF02B5B8BB28928B3A9@SJ0PR06MB8609.namprd06.prod.outlook.com> (raw)

[-- 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

             reply	other threads:[~2022-11-05 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 11:32 Gabriel [this message]
2022-11-10 10:09 ` bug#59047: 29.0.50; [PATCH] dired-hide-subdir breaks dired-hide-details-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR06MB86099CE043DF02B5B8BB28928B3A9@SJ0PR06MB8609.namprd06.prod.outlook.com \
    --to=gabriel376@hotmail.com \
    --cc=59047@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.