aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2020-09-14 14:55:52 +0200
committerLars Ingebrigtsen2020-09-14 14:55:52 +0200
commitf450e53d5c01c589986bea07671acebaaf501c5f (patch)
tree647dab9ffdcf333a75cc0bd9acebfe62f88d9daa
parent14486c44885ffe4532118676aaa6e3783a0417bb (diff)
downloademacs-f450e53d5c01c589986bea07671acebaaf501c5f.tar.gz
emacs-f450e53d5c01c589986bea07671acebaaf501c5f.zip
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).
-rw-r--r--lisp/dired-aux.el15
-rw-r--r--lisp/dired.el22
2 files changed, 21 insertions, 16 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 3ee877ee8de..cf2926ad377 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."
2718 (if (dired-get-subdir) 1 0)))) 2718 (if (dired-get-subdir) 1 0))))
2719 (dired-next-subdir (- arg) no-error-if-not-found no-skip)) 2719 (dired-next-subdir (- arg) no-error-if-not-found no-skip))
2720 2720
2721(defun dired-subdir-min ()
2722 (save-excursion
2723 (if (not (dired-prev-subdir 0 t t))
2724 (error "Not in a subdir!")
2725 (point))))
2726
2727;;;###autoload 2721;;;###autoload
2728(defun dired-goto-subdir (dir) 2722(defun dired-goto-subdir (dir)
2729 "Go to end of header line of DIR in this dired buffer. 2723 "Go to end of header line of DIR in this dired buffer.
@@ -2816,15 +2810,6 @@ Lower levels are unaffected."
2816 2810
2817;;; hiding 2811;;; hiding
2818 2812
2819(defun dired-unhide-subdir ()
2820 (with-silent-modifications
2821 (dired--unhide (dired-subdir-min) (dired-subdir-max))))
2822
2823(defun dired-subdir-hidden-p (dir)
2824 (save-excursion
2825 (dired-goto-subdir dir)
2826 (dired--hidden-p)))
2827
2828;;;###autoload 2813;;;###autoload
2829(defun dired-hide-subdir (arg) 2814(defun dired-hide-subdir (arg)
2830 "Hide or unhide the current subdirectory and move to next directory. 2815 "Hide or unhide the current subdirectory and move to next directory.
diff --git a/lisp/dired.el b/lisp/dired.el
index 15592ceb080..1b6da1f9617 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2585,6 +2585,21 @@ Otherwise, display it in another buffer."
2585 2585
2586;;; Functions for extracting and manipulating file names in Dired buffers. 2586;;; Functions for extracting and manipulating file names in Dired buffers.
2587 2587
2588(defun dired-unhide-subdir ()
2589 (with-silent-modifications
2590 (dired--unhide (dired-subdir-min) (dired-subdir-max))))
2591
2592(defun dired-subdir-hidden-p (dir)
2593 (save-excursion
2594 (dired-goto-subdir dir)
2595 (dired--hidden-p)))
2596
2597(defun dired-subdir-min ()
2598 (save-excursion
2599 (if (not (dired-prev-subdir 0 t t))
2600 (error "Not in a subdir!")
2601 (point))))
2602
2588(defun dired-get-filename (&optional localp no-error-if-not-filep) 2603(defun dired-get-filename (&optional localp no-error-if-not-filep)
2589 "In Dired, return name of file mentioned on this line. 2604 "In Dired, return name of file mentioned on this line.
2590Value returned normally includes the directory name. 2605Value 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
2595Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as 2610Optional arg NO-ERROR-IF-NOT-FILEP means treat `.' and `..' as
2596regular filenames and return nil if no filename on this line. 2611regular filenames and return nil if no filename on this line.
2597Otherwise, an error occurs in these cases." 2612Otherwise, an error occurs in these cases."
2598 (let (case-fold-search file p1 p2 already-absolute) 2613 (let ((hidden (dired-subdir-hidden-p (dired-current-directory)))
2614 case-fold-search file p1 p2 already-absolute)
2615 (when hidden
2616 (dired-unhide-subdir))
2599 (save-excursion 2617 (save-excursion
2600 (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep))) 2618 (if (setq p1 (dired-move-to-filename (not no-error-if-not-filep)))
2601 (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep)))) 2619 (setq p2 (dired-move-to-end-of-filename no-error-if-not-filep))))
2620 (when hidden
2621 (dired-hide-subdir 1))
2602 ;; nil if no file on this line, but no-error-if-not-filep is t: 2622 ;; nil if no file on this line, but no-error-if-not-filep is t:
2603 (if (setq file (and p1 p2 (buffer-substring p1 p2))) 2623 (if (setq file (and p1 p2 (buffer-substring p1 p2)))
2604 (progn 2624 (progn