emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f450e53 1/2: Fix problem of marking files with hidden subdirs


From: Lars Ingebrigtsen
Subject: master f450e53 1/2: Fix problem of marking files with hidden subdirs
Date: Mon, 14 Sep 2020 09:19:04 -0400 (EDT)

branch: master
commit f450e53d5c01c589986bea07671acebaaf501c5f
Author: Stephen Berman <stephen.berman@gmx.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix problem of marking files with hidden subdirs
    
    * lisp/dired.el (dired-unhide-subdir):
    (dired-subdir-hidden-p):
    (dired-subdir-min): Moved from subr-x.
    (dired-get-filename): Get the correct filename when directories
    are hidden (bug#8484).
---
 lisp/dired-aux.el | 15 ---------------
 lisp/dired.el     | 22 +++++++++++++++++++++-
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 3ee877e..cf2926a 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2718,12 +2718,6 @@ When called interactively and not on a subdir line, go 
to this subdir's line."
           (if (dired-get-subdir) 1 0))))
   (dired-next-subdir (- arg) no-error-if-not-found no-skip))
 
-(defun dired-subdir-min ()
-  (save-excursion
-    (if (not (dired-prev-subdir 0 t t))
-       (error "Not in a subdir!")
-      (point))))
-
 ;;;###autoload
 (defun dired-goto-subdir (dir)
   "Go to end of header line of DIR in this dired buffer.
@@ -2816,15 +2810,6 @@ Lower levels are unaffected."
 
 ;;; hiding
 
-(defun dired-unhide-subdir ()
-  (with-silent-modifications
-    (dired--unhide (dired-subdir-min) (dired-subdir-max))))
-
-(defun dired-subdir-hidden-p (dir)
-  (save-excursion
-    (dired-goto-subdir dir)
-    (dired--hidden-p)))
-
 ;;;###autoload
 (defun dired-hide-subdir (arg)
   "Hide or unhide the current subdirectory and move to next directory.
diff --git a/lisp/dired.el b/lisp/dired.el
index 15592ce..1b6da1f 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2585,6 +2585,21 @@ Otherwise, display it in another buffer."
 
 ;;; Functions for extracting and manipulating file names in Dired buffers.
 
+(defun dired-unhide-subdir ()
+  (with-silent-modifications
+    (dired--unhide (dired-subdir-min) (dired-subdir-max))))
+
+(defun dired-subdir-hidden-p (dir)
+  (save-excursion
+    (dired-goto-subdir dir)
+    (dired--hidden-p)))
+
+(defun dired-subdir-min ()
+  (save-excursion
+    (if (not (dired-prev-subdir 0 t t))
+       (error "Not in a subdir!")
+      (point))))
+
 (defun dired-get-filename (&optional localp no-error-if-not-filep)
   "In Dired, return name of file mentioned on this line.
 Value returned normally includes the directory name.
@@ -2595,10 +2610,15 @@ it occurs in the buffer, and a value of t means 
construct name relative to
 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)
+  (let ((hidden (dired-subdir-hidden-p (dired-current-directory)))
+       case-fold-search file p1 p2 already-absolute)
+    (when 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))))
+    (when 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]