changeset 16617:19b2aeb694d1

(dired-omit-size-limit): New variable. (dired-omit-toggle, dired-omit-expunge): Respect it.
author Richard M. Stallman <rms@gnu.org>
date Sat, 07 Dec 1996 20:15:18 +0000
parents f56c39dd998d
children 7f975e29d4ee
files lisp/dired-x.el
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-x.el	Sat Dec 07 19:22:49 1996 +0000
+++ b/lisp/dired-x.el	Sat Dec 07 20:15:18 1996 +0000
@@ -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 @@
 `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 @@
   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 @@
     (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 @@
 
 (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 @@
 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)