diff options
author | Stephen Berman <stephen.berman@gmx.net> | 2020-09-14 14:55:52 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-09-14 14:55:52 +0200 |
commit | f450e53d5c01c589986bea07671acebaaf501c5f (patch) | |
tree | 647dab9ffdcf333a75cc0bd9acebfe62f88d9daa /lisp/dired.el | |
parent | 14486c44885ffe4532118676aaa6e3783a0417bb (diff) | |
download | emacs-f450e53d5c01c589986bea07671acebaaf501c5f.tar.gz emacs-f450e53d5c01c589986bea07671acebaaf501c5f.tar.bz2 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).
Diffstat (limited to 'lisp/dired.el')
-rw-r--r-- | lisp/dired.el | 22 |
1 files changed, 21 insertions, 1 deletions
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." ;;; 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 |