comparison lisp/dired-x.el @ 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 40a1e1451821
children d04999ad25b9
comparison
equal deleted inserted replaced
16616:f56c39dd998d 16617:19b2aeb694d1
89 ;; dired-guess-shell-alist-user 89 ;; dired-guess-shell-alist-user
90 ;; dired-clean-up-buffers-too 90 ;; dired-clean-up-buffers-too
91 ;; dired-omit-files-p 91 ;; dired-omit-files-p
92 ;; dired-omit-files 92 ;; dired-omit-files
93 ;; dired-omit-extensions 93 ;; dired-omit-extensions
94 ;; dired-omit-size-limit
94 ;; 95 ;;
95 ;; To find out more about these variables, load this file, put your cursor at 96 ;; To find out more about these variables, load this file, put your cursor at
96 ;; the end of any of the variable names, and hit C-h v [RET]. *Please* see 97 ;; the end of any of the variable names, and hit C-h v [RET]. *Please* see
97 ;; the info pages for more details. 98 ;; the info pages for more details.
98 99
166 This only has effect when `dired-omit-files-p' is t. See interactive function 167 This only has effect when `dired-omit-files-p' is t. See interactive function
167 `dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable 168 `dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
168 `dired-omit-extensions'. The default is to omit `.', `..', and auto-save 169 `dired-omit-extensions'. The default is to omit `.', `..', and auto-save
169 files.") 170 files.")
170 171
172 (defvar dired-omit-size-limit 20000
173 "*If a dired buffer listing contains more than this many characters,
174 do not do omitting. If nil, always do omitting.")
175
171 (defvar dired-find-subdir nil ; t is pretty near to DWIM... 176 (defvar dired-find-subdir nil ; t is pretty near to DWIM...
172 "*If non-nil, Dired always finds a directory in a buffer of its own. 177 "*If non-nil, Dired always finds a directory in a buffer of its own.
173 If nil, Dired finds the directory as a subdirectory in some other buffer 178 If nil, Dired finds the directory as a subdirectory in some other buffer
174 if it is present as one. 179 if it is present as one.
175 180
260 dired-bind-man 265 dired-bind-man
261 dired-vm-read-only-folders 266 dired-vm-read-only-folders
262 dired-omit-files-p 267 dired-omit-files-p
263 dired-omit-files 268 dired-omit-files
264 dired-omit-extensions 269 dired-omit-extensions
270 dired-omit-size-limit
265 dired-find-subdir 271 dired-find-subdir
266 dired-enable-local-variables 272 dired-enable-local-variables
267 dired-local-variables-file 273 dired-local-variables-file
268 dired-guess-shell-gnutar 274 dired-guess-shell-gnutar
269 dired-guess-shell-gzip-quiet 275 dired-guess-shell-gzip-quiet
533 ;; no FLAG 539 ;; no FLAG
534 (setq dired-omit-files-p (not dired-omit-files-p)) 540 (setq dired-omit-files-p (not dired-omit-files-p))
535 (if (not dired-omit-files-p) 541 (if (not dired-omit-files-p)
536 (revert-buffer) 542 (revert-buffer)
537 ;; this will mention how many were omitted: 543 ;; this will mention how many were omitted:
538 (dired-omit-expunge)))) 544 (let ((dired-omit-size-limit nil))
545 (dired-omit-expunge)))))
539 546
540 (defvar dired-omit-extensions 547 (defvar dired-omit-extensions
541 (append completion-ignored-extensions 548 (append completion-ignored-extensions
542 dired-latex-unclean-extensions 549 dired-latex-unclean-extensions
543 dired-bibtex-unclean-extensions 550 dired-bibtex-unclean-extensions
550 See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and 557 See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and
551 variables `dired-omit-files-p' and `dired-omit-files'.") 558 variables `dired-omit-files-p' and `dired-omit-files'.")
552 559
553 (defun dired-omit-expunge (&optional regexp) 560 (defun dired-omit-expunge (&optional regexp)
554 "Erases all unmarked files matching REGEXP. 561 "Erases all unmarked files matching REGEXP.
555 Does nothing if global variable `dired-omit-files-p' is nil. 562 Does nothing if global variable `dired-omit-files-p' is nil, or if called
563 non-interactively and buffer is bigger than `dired-omit-size-limit'.
556 If REGEXP is nil or not specified, uses `dired-omit-files', and also omits 564 If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
557 filenames ending in `dired-omit-extensions'. 565 filenames ending in `dired-omit-extensions'.
558 If REGEXP is the empty string, this function is a no-op. 566 If REGEXP is the empty string, this function is a no-op.
559 567
560 This functions works by temporarily binding `dired-marker-char' to 568 This functions works by temporarily binding `dired-marker-char' to
561 `dired-omit-marker-char' and calling `dired-do-kill-lines'." 569 `dired-omit-marker-char' and calling `dired-do-kill-lines'."
562 (interactive "sOmit files (regexp): ") 570 (interactive "sOmit files (regexp): ")
563 (if dired-omit-files-p 571 (if (and dired-omit-files-p
572 (or (interactive-p)
573 (not dired-omit-size-limit)
574 (< (buffer-size) dired-omit-size-limit)))
564 (let ((omit-re (or regexp (dired-omit-regexp))) 575 (let ((omit-re (or regexp (dired-omit-regexp)))
565 (old-modified-p (buffer-modified-p)) 576 (old-modified-p (buffer-modified-p))
566 count) 577 count)
567 (or (string= omit-re "") 578 (or (string= omit-re "")
568 (let ((dired-marker-char dired-omit-marker-char)) 579 (let ((dired-marker-char dired-omit-marker-char))