diff options
| author | Gerd Moellmann | 2000-07-24 12:27:26 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-07-24 12:27:26 +0000 |
| commit | e17dba1ffd64edc41ff9fa4ad09b78a719bccdfd (patch) | |
| tree | 0f9077bc806321939f1c76b7fca5cb402f9d8257 /lisp/dired.el | |
| parent | 23a96c7762a45eed54d73518b98b3d8a1b3679a5 (diff) | |
| download | emacs-e17dba1ffd64edc41ff9fa4ad09b78a719bccdfd.tar.gz emacs-e17dba1ffd64edc41ff9fa4ad09b78a719bccdfd.zip | |
(dired-sort-R-check): Added to allow recursive listing
to be undone.
(dired-sort-other): Use it.
Diffstat (limited to 'lisp/dired.el')
| -rw-r--r-- | lisp/dired.el | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 5c9e95d6b15..e7dedadd7e1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -2632,9 +2632,45 @@ With a prefix argument you can edit the current listing switches instead." | |||
| 2632 | ;; `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' set the | 2632 | ;; `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' set the |
| 2633 | ;; minor mode accordingly, others appear literally in the mode line. | 2633 | ;; minor mode accordingly, others appear literally in the mode line. |
| 2634 | ;; With optional second arg NO-REVERT, don't refresh the listing afterwards. | 2634 | ;; With optional second arg NO-REVERT, don't refresh the listing afterwards. |
| 2635 | (dired-sort-R-check switches) | ||
| 2635 | (setq dired-actual-switches switches) | 2636 | (setq dired-actual-switches switches) |
| 2636 | (if (eq major-mode 'dired-mode) (dired-sort-set-modeline)) | 2637 | (if (eq major-mode 'dired-mode) (dired-sort-set-modeline)) |
| 2637 | (or no-revert (revert-buffer))) | 2638 | (or no-revert (revert-buffer))) |
| 2639 | |||
| 2640 | (make-variable-buffer-local | ||
| 2641 | (defvar dired-subdir-alist-pre-R nil | ||
| 2642 | "Value of `dired-subdir-alist' before -R switch added.")) | ||
| 2643 | |||
| 2644 | (defun dired-sort-R-check (switches) | ||
| 2645 | "Additional processing of -R in ls option string SWITCHES. | ||
| 2646 | Saves `dired-subdir-alist' when R is set and restores saved value | ||
| 2647 | minus any directories explicitly deleted when R is cleared. | ||
| 2648 | To be called first in body of `dired-sort-other', etc." | ||
| 2649 | (cond | ||
| 2650 | ((and (string-match "R" switches) | ||
| 2651 | (not (string-match "R" dired-actual-switches))) | ||
| 2652 | ;; Adding -R to ls switches -- save `dired-subdir-alist': | ||
| 2653 | (setq dired-subdir-alist-pre-R dired-subdir-alist)) | ||
| 2654 | ((and (string-match "R" dired-actual-switches) | ||
| 2655 | (not (string-match "R" switches))) | ||
| 2656 | ;; Deleting -R from ls switches -- revert to pre-R subdirs | ||
| 2657 | ;; that are still present: | ||
| 2658 | (setq dired-subdir-alist | ||
| 2659 | (if dired-subdir-alist-pre-R | ||
| 2660 | (let (subdirs) | ||
| 2661 | (while dired-subdir-alist-pre-R | ||
| 2662 | (if (assoc (caar dired-subdir-alist-pre-R) | ||
| 2663 | dired-subdir-alist) | ||
| 2664 | ;; subdir still present... | ||
| 2665 | (setq subdirs | ||
| 2666 | (cons (car dired-subdir-alist-pre-R) | ||
| 2667 | subdirs))) | ||
| 2668 | (setq dired-subdir-alist-pre-R | ||
| 2669 | (cdr dired-subdir-alist-pre-R))) | ||
| 2670 | (reverse subdirs)) | ||
| 2671 | ;; No pre-R subdir alist, so revert to main directory | ||
| 2672 | ;; listing: | ||
| 2673 | (list (car (reverse dired-subdir-alist)))))))) | ||
| 2638 | 2674 | ||
| 2639 | ;; To make this file smaller, the less common commands | 2675 | ;; To make this file smaller, the less common commands |
| 2640 | ;; go in a separate file. But autoload them here | 2676 | ;; go in a separate file. But autoload them here |