mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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).
This commit is contained in:
parent
14486c4488
commit
f450e53d5c
2 changed files with 21 additions and 16 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue