/[emacs]/emacs/lisp/dired-x.el
ViewVC logotype

Diff of /emacs/lisp/dired-x.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54 by jurta, Wed Mar 31 16:09:18 2004 UTC revision 1.55 by lh, Sat Jun 5 17:53:03 2004 UTC
# Line 50  Line 50 
50  ;; (add-hook 'dired-mode-hook  ;; (add-hook 'dired-mode-hook
51  ;;           (function (lambda ()  ;;           (function (lambda ()
52  ;;                       ;; Set buffer-local variables here.  For example:  ;;                       ;; Set buffer-local variables here.  For example:
53  ;;                       ;; (setq dired-omit-files-p t)  ;;                       ;; (dired-omit-mode 1)
54  ;;                       )))  ;;                       )))
55  ;;  ;;
56  ;; At load time dired-x.el will install itself, redefine some functions, and  ;; At load time dired-x.el will install itself, redefine some functions, and
# Line 74  Line 74 
74  ;;      dired-guess-shell-znew-switches  ;;      dired-guess-shell-znew-switches
75  ;;      dired-guess-shell-alist-user  ;;      dired-guess-shell-alist-user
76  ;;      dired-clean-up-buffers-too  ;;      dired-clean-up-buffers-too
77  ;;      dired-omit-files-p  ;;      dired-omit-mode
78  ;;      dired-omit-files  ;;      dired-omit-files
79  ;;      dired-omit-extensions  ;;      dired-omit-extensions
80  ;;      dired-omit-size-limit  ;;      dired-omit-size-limit
# Line 154  Read-only folders only work in VM 5, not Line 154  Read-only folders only work in VM 5, not
154                   (other :tag "non-writable only" if-file-read-only))                   (other :tag "non-writable only" if-file-read-only))
155    :group 'dired-x)    :group 'dired-x)
156    
157  (defcustom dired-omit-files-p nil  (define-minor-mode dired-omit-mode
158    "*If non-nil, \"uninteresting\" files are not listed (buffer-local).    "Toggle Dired-Omit mode.
159  Use \\[dired-omit-toggle] to toggle its value.  With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
160    otherwise. Enabling and disabling is buffer-local.
161    If enabled, \"uninteresting\" files are not listed.
162  Uninteresting files are those whose filenames match regexp `dired-omit-files',  Uninteresting files are those whose filenames match regexp `dired-omit-files',
163  plus those ending with extensions in `dired-omit-extensions'."  plus those ending with extensions in `dired-omit-extensions'."
164    :type 'boolean    :group 'dired-x
165    :group 'dired-x)    (if dired-omit-mode
166  (make-variable-buffer-local 'dired-omit-files-p)        ;; This will mention how many lines were omitted:
167          (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
168        (revert-buffer)))
169    
170    ;; For backward compatibility
171    (defvaralias 'dired-omit-files-p 'dired-omit-mode)
172    (make-obsolete-variable 'dired-omit-files-p 'dired-omit-mode)
173    
174  (defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"  (defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
175    "*Filenames matching this regexp will not be displayed.    "*Filenames matching this regexp will not be displayed.
176  This only has effect when `dired-omit-files-p' is t.  See interactive function  This only has effect when `dired-omit-mode' is t.  See interactive function
177  `dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable  `dired-omit-mode' \(\\[dired-omit-mode]\) and variable
178  `dired-omit-extensions'.  The default is to omit  `.', `..', auto-save  `dired-omit-extensions'.  The default is to omit  `.', `..', auto-save
179  files and lock files."  files and lock files."
180    :type 'regexp    :type 'regexp
# Line 230  to nil: a pipe using `zcat' or `gunzip - Line 238  to nil: a pipe using `zcat' or `gunzip -
238    
239  ;;; KEY BINDINGS.  ;;; KEY BINDINGS.
240    
241  (define-key dired-mode-map "\M-o" 'dired-omit-toggle)  (define-key dired-mode-map "\M-o" 'dired-omit-mode)
242    (define-key dired-mode-map "\M-O" 'dired-mark-omitted)
243  (define-key dired-mode-map "\M-(" 'dired-mark-sexp)  (define-key dired-mode-map "\M-(" 'dired-mark-sexp)
244  (define-key dired-mode-map "*(" 'dired-mark-sexp)  (define-key dired-mode-map "*(" 'dired-mark-sexp)
245  (define-key dired-mode-map "*." 'dired-mark-extension)  (define-key dired-mode-map "*." 'dired-mark-extension)
# Line 268  to nil: a pipe using `zcat' or `gunzip - Line 277  to nil: a pipe using `zcat' or `gunzip -
277    \\[dired-info]\t-- run info on file    \\[dired-info]\t-- run info on file
278    \\[dired-man]\t-- run man on file    \\[dired-man]\t-- run man on file
279    \\[dired-do-find-marked-files]\t-- visit all marked files simultaneously    \\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
280    \\[dired-omit-toggle]\t-- toggle omitting of files    \\[dired-omit-mode]\t-- toggle omitting of files
281    \\[dired-mark-sexp]\t-- mark by Lisp expression    \\[dired-mark-sexp]\t-- mark by Lisp expression
282    \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring.    \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring.
283    \t   You can feed it to other commands using \\[yank].    \t   You can feed it to other commands using \\[yank].
# Line 280  For more features, see variables Line 289  For more features, see variables
289    `dired-bind-info'    `dired-bind-info'
290    `dired-bind-man'    `dired-bind-man'
291    `dired-vm-read-only-folders'    `dired-vm-read-only-folders'
292    `dired-omit-files-p'    `dired-omit-mode'
293    `dired-omit-files'    `dired-omit-files'
294    `dired-omit-extensions'    `dired-omit-extensions'
295    `dired-omit-size-limit'    `dired-omit-size-limit'
# Line 450  buffer and try again." Line 459  buffer and try again."
459                  (dired-insert-subdir (file-name-directory file))                  (dired-insert-subdir (file-name-directory file))
460                  (dired-goto-file file))                  (dired-goto-file file))
461                ;; Toggle omitting, if it is on, and try again.                ;; Toggle omitting, if it is on, and try again.
462                (if dired-omit-files-p                (if dired-omit-mode
463                    (progn                    (progn
464                      (dired-omit-toggle)                      (dired-omit-mode)
465                      (dired-goto-file file))))))))                      (dired-goto-file file))))))))
466    
467  (defun dired-jump-other-window ()  (defun dired-jump-other-window ()
# Line 479  need to match the entire file name.") Line 488  need to match the entire file name.")
488  Should never be used as marker by the user or other packages.")  Should never be used as marker by the user or other packages.")
489    
490  (defun dired-omit-startup ()  (defun dired-omit-startup ()
491    (or (assq 'dired-omit-files-p minor-mode-alist)    (or (assq 'dired-omit-mode minor-mode-alist)
492        (setq minor-mode-alist        (setq minor-mode-alist
493              (append '((dired-omit-files-p              (append '((dired-omit-mode
494                         (:eval (if (eq major-mode 'dired-mode)                         (:eval (if (eq major-mode 'dired-mode)
495                                    " Omit" ""))))                                    " Omit" ""))))
496                      minor-mode-alist))))                      minor-mode-alist))))
497    
498  (defun dired-omit-toggle (&optional flag)  (defun dired-mark-omitted ()
499    "Toggle omitting files matching `dired-omit-files' and `dired-omit-extensions'.    "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
500  With an arg, and if omitting was off, don't toggle and just mark the    (interactive)
501    files but don't actually omit them.    (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
502  With an arg, and if omitting was on, turn it off but don't refresh the buffer."    (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp))
   (interactive "P")  
   (if flag  
       (if dired-omit-files-p  
           (setq dired-omit-files-p (not dired-omit-files-p))  
         (dired-mark-unmarked-files (dired-omit-regexp) nil nil  
                                    dired-omit-localp))  
     ;; no FLAG  
     (setq dired-omit-files-p (not dired-omit-files-p))  
     (if (not dired-omit-files-p)  
         (revert-buffer)  
       ;; this will mention how many were omitted:  
       (let ((dired-omit-size-limit nil))  
         (dired-omit-expunge)))))  
503    
504  (defvar dired-omit-extensions  (defvar dired-omit-extensions
505    (append completion-ignored-extensions    (append completion-ignored-extensions
# Line 515  Defaults to elements of `completion-igno Line 511  Defaults to elements of `completion-igno
511  `dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and  `dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
512  `dired-texinfo-unclean-extensions'.  `dired-texinfo-unclean-extensions'.
513    
514  See interactive function `dired-omit-toggle' \(\\[dired-omit-toggle]\) and  See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
515  variables `dired-omit-files-p' and `dired-omit-files'.")  variables `dired-omit-mode' and `dired-omit-files'.")
516    
517  (defun dired-omit-expunge (&optional regexp)  (defun dired-omit-expunge (&optional regexp)
518    "Erases all unmarked files matching REGEXP.    "Erases all unmarked files matching REGEXP.
519  Does nothing if global variable `dired-omit-files-p' is nil, or if called  Does nothing if global variable `dired-omit-mode' is nil, or if called
520    non-interactively and buffer is bigger than `dired-omit-size-limit'.    non-interactively and buffer is bigger than `dired-omit-size-limit'.
521  If REGEXP is nil or not specified, uses `dired-omit-files', and also omits  If REGEXP is nil or not specified, uses `dired-omit-files', and also omits
522    filenames ending in `dired-omit-extensions'.    filenames ending in `dired-omit-extensions'.
# Line 529  If REGEXP is the empty string, this func Line 525  If REGEXP is the empty string, this func
525  This functions works by temporarily binding `dired-marker-char' to  This functions works by temporarily binding `dired-marker-char' to
526  `dired-omit-marker-char' and calling `dired-do-kill-lines'."  `dired-omit-marker-char' and calling `dired-do-kill-lines'."
527    (interactive "sOmit files (regexp): ")    (interactive "sOmit files (regexp): ")
528    (if (and dired-omit-files-p    (if (and dired-omit-mode
529             (or (interactive-p)             (or (interactive-p)
530                 (not dired-omit-size-limit)                 (not dired-omit-size-limit)
531                 (< (buffer-size) dired-omit-size-limit)                 (< (buffer-size) dired-omit-size-limit)
532                 (progn                 (progn
533                   (message "Not omitting: directory larger than %d characters."                   (message "Not omitting: directory larger than %d characters."
534                            dired-omit-size-limit)                            dired-omit-size-limit)
535                   (setq dired-omit-files-p nil)                   (setq dired-omit-mode nil)
536                   nil)))                   nil)))
537        (let ((omit-re (or regexp (dired-omit-regexp)))        (let ((omit-re (or regexp (dired-omit-regexp)))
538              (old-modified-p (buffer-modified-p))              (old-modified-p (buffer-modified-p))
# Line 589  Second optional argument LOCALP is as in Line 585  Second optional argument LOCALP is as in
585  (defun dired-omit-new-add-entry (filename &optional marker-char relative)  (defun dired-omit-new-add-entry (filename &optional marker-char relative)
586    ;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for    ;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for
587    ;; files that are going to be omitted anyway.    ;; files that are going to be omitted anyway.
588    (if dired-omit-files-p    (if dired-omit-mode
589        ;; perhaps return t without calling ls        ;; perhaps return t without calling ls
590        (let ((omit-re (dired-omit-regexp)))        (let ((omit-re (dired-omit-regexp)))
591          (if (or (string= omit-re "")          (if (or (string= omit-re "")
# Line 842  dired." Line 838  dired."
838      (save-excursion      (save-excursion
839        (set-buffer (get-buffer-create " *dot-dired*"))        (set-buffer (get-buffer-create " *dot-dired*"))
840        (erase-buffer)        (erase-buffer)
841        (insert "Local Variables:\ndired-omit-files-p: t\nEnd:\n")        (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
842        (write-file dired-local-variables-file)        (write-file dired-local-variables-file)
843        (kill-buffer (current-buffer)))        (kill-buffer (current-buffer)))
844    
# Line 1692  If `current-prefix-arg' is non-nil, uses Line 1688  If `current-prefix-arg' is non-nil, uses
1688     'dired-guess-shell-znew-switches     'dired-guess-shell-znew-switches
1689     'dired-guess-shell-alist-user     'dired-guess-shell-alist-user
1690     'dired-clean-up-buffers-too     'dired-clean-up-buffers-too
1691     'dired-omit-files-p     'dired-omit-mode
1692     'dired-omit-files     'dired-omit-files
1693     'dired-omit-extensions     'dired-omit-extensions
1694     )     )

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26