summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-07 20:15:18 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-07 20:15:18 +0000
commitc16adbd53de18ba0d21afd076bbcca37ebb98a5b (patch)
treed4e368dc5c7c52d6cbb4886e2870f1d398bf4ea7
parentf6f31295e54335b3c0003dd490ed6caf4e28786d (diff)
downloademacs-c16adbd53de18ba0d21afd076bbcca37ebb98a5b.tar.gz
(dired-omit-size-limit): New variable.
(dired-omit-toggle, dired-omit-expunge): Respect it.
-rw-r--r--lisp/dired-x.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index b626b3aade5..a45c9ad52df 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -91,6 +91,7 @@
;; dired-omit-files-p
;; dired-omit-files
;; dired-omit-extensions
+;; dired-omit-size-limit
;;
;; To find out more about these variables, load this file, put your cursor at
;; the end of any of the variable names, and hit C-h v [RET]. *Please* see
@@ -168,6 +169,10 @@ This only has effect when `dired-omit-files-p' is t. See interactive function
`dired-omit-extensions'. The default is to omit `.', `..', and auto-save
files.")
+(defvar dired-omit-size-limit 20000
+ "*If a dired buffer listing contains more than this many characters,
+do not do omitting. If nil, always do omitting.")
+
(defvar dired-find-subdir nil ; t is pretty near to DWIM...
"*If non-nil, Dired always finds a directory in a buffer of its own.
If nil, Dired finds the directory as a subdirectory in some other buffer
@@ -262,6 +267,7 @@ For more features, see variables
dired-omit-files-p
dired-omit-files
dired-omit-extensions
+ dired-omit-size-limit
dired-find-subdir
dired-enable-local-variables
dired-local-variables-file
@@ -535,7 +541,8 @@ With an arg, and if omitting was on, turn it off but don't refresh the buffer."
(if (not dired-omit-files-p)
(revert-buffer)
;; this will mention how many were omitted:
- (dired-omit-expunge))))
+ (let ((dired-omit-size-limit nil))
+ (dired-omit-expunge)))))
(defvar dired-omit-extensions
(append completion-ignored-extensions
@@ -552,7 +559,8 @@ variables `dired-omit-files-p' and `dired-omit-files'.")
(defun dired-omit-expunge (&optional regexp)
"Erases all unmarked files matching REGEXP.
-Does nothing if global variable `dired-omit-files-p' is nil.
+Does nothing if global variable `dired-omit-files-p' is nil, or if called
+ non-interactively and buffer is bigger than `dired-omit-size-limit'.
If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
filenames ending in `dired-omit-extensions'.
If REGEXP is the empty string, this function is a no-op.
@@ -560,7 +568,10 @@ If REGEXP is the empty string, this function is a no-op.
This functions works by temporarily binding `dired-marker-char' to
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
(interactive "sOmit files (regexp): ")
- (if dired-omit-files-p
+ (if (and dired-omit-files-p
+ (or (interactive-p)
+ (not dired-omit-size-limit)
+ (< (buffer-size) dired-omit-size-limit)))
(let ((omit-re (or regexp (dired-omit-regexp)))
(old-modified-p (buffer-modified-p))
count)