;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
;; Lawrence R. Dodd <dodd@roebling.poly.edu>
;; Maintainer: Lawrence R. Dodd <dodd@roebling.poly.edu>
-;; Version: 2.37
-;; Date: 1994/06/28 15:53:34
+;; Version: 2.37+
+;; Date: 1994/08/18 19:27:42
;; Keywords: dired extensions
;; Copyright (C) 1993, 1994 Free Software Foundation
;;; (add-hook 'dired-load-hook
;;; (function (lambda ()
;;; (load "dired-x")
-;;; ;; Set variables here. For example:
+;;; ;; Set global variables here. For example:
;;; ;; (setq dired-guess-shell-gnutar "gtar")
+;;; )))
+;;; (add-hook 'dired-mode-hook
+;;; (function (lambda ()
+;;; ;; Set buffer-local variables here. For example:
;;; ;; (setq dired-omit-files-p t)
;;; )))
;;;
;;; dired-clean-up-after-deletion ../lisp/dired.el
;;; dired-find-buffer-nocreate ../lisp/dired.el
;;; dired-initial-position ../lisp/dired.el
-;;; dired-up-directory ../lisp/dired.el
;;;
;;; dired-add-entry ../lisp/dired-aux.el
;;; dired-read-shell-command ../lisp/dired-aux.el
Use \\[dired-omit-toggle] to toggle its value.
Uninteresting files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'.")
+(make-variable-buffer-local 'dired-omit-files-p)
(defvar dired-omit-files "^#\\|^\\.$\\|^\\.\\.$"
- "*Filenames matching this regexp will not be displayed \(buffer-local\).
+ "*Filenames matching this regexp will not be displayed.
This only has effect when `dired-omit-files-p' is t. See interactive function
`dired-omit-toggle' \(\\[dired-omit-toggle]\) and variable
`dired-omit-extensions'. The default is to omit `.', `..', and auto-save
files.")
(defvar dired-find-subdir nil ; t is pretty near to DWIM...
- "*If non-nil, Dired does not make a new buffer for a directory if it
-can be found (perhaps as subdir) in some existing Dired buffer.
+ "*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
+if it is present as one.
If there are several Dired buffers for a directory, the most recently
used is chosen.
(file-name-nondirectory fn)))
(save-excursion ; you never know where kill-buffer leaves you
(kill-buffer buf))))
- (let ((buf-list (dired-buffers-for-dir fn))
+ (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))
(buf nil))
(and buf-list
(y-or-n-p (format "Kill dired buffer%s of %s, too? "
"Like \\[dired-jump] (dired-jump) but in other window."
(interactive)
(dired-jump t))
-
-;;; REDEFINE.
-;;; This replaces the version in dired.el
-;;; It simply adds the OTHER-WINDOW option to the one in dired.el.
-(defun dired-up-directory (&optional other-window)
- "Run dired on parent directory of current directory.
-Find the parent directory either in this buffer or another buffer.
-Finds in current window or in other window with optional OTHER-WINDOW.
-Creates a buffer if necessary."
- (interactive "P")
- (let* ((dir (dired-current-directory))
- (up (file-name-directory (directory-file-name dir))))
- (or (dired-goto-file (directory-file-name dir))
- ;; Only try dired-goto-subdir if buffer has more than one dir.
- (and (cdr dired-subdir-alist)
- (dired-goto-subdir up))
- (progn
- (if other-window
- (dired-other-window up)
- (dired up))
- (dired-goto-file dir)))))
-
\f
;;;; TOGGLE.
;;; Toggle marked files with unmarked files.
Should never be used as marker by the user or other packages.")
(defun dired-omit-startup ()
- (make-local-variable 'dired-omit-files-p)
(or (assq 'dired-omit-files-p minor-mode-alist)
(setq minor-mode-alist
(append '((dired-omit-files-p " Omit")) minor-mode-alist))))
(interactive "sOmit files (regexp): ")
(if dired-omit-files-p
(let ((omit-re (or regexp (dired-omit-regexp)))
+ (old-modified-p (buffer-modified-p))
count)
(or (string= omit-re "")
(let ((dired-marker-char dired-omit-marker-char))
(if (dired-mark-unmarked-files omit-re nil nil dired-omit-localp)
(progn
(setq count (dired-do-kill-lines nil "Omitted %d line%s."))
- ;; Force an update of modeline.
- (set-buffer-modified-p (buffer-modified-p)))
+ (force-mode-line-update))
(message "(Nothing to omit)"))))
+ ;; Try to preserve modified state of buffer. So `%*' doesn't appear
+ ;; in mode-line of omitted buffers.
+ (set-buffer-modified-p (and old-modified-p
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward dired-re-mark nil t))))
count)))
(defun dired-omit-regexp ()
Also useful for `auto-mode-alist' (which see) like this:
- \(setq auto-mode-alist (cons '(\"[^/]\\.dired$\" . dired-virtual-mode)
+ \(setq auto-mode-alist (cons '(\"[^/]\\.dired\\'\" . dired-virtual-mode)
auto-mode-alist)\)"
(interactive)
(dired-virtual (dired-virtual-guess-dir)))
;;; that matches the first file in the file list.
;;;
;;; * If the REGEXP matches all the entries of the file list then evaluate
-;;; COMMAND, which is either a string or an elisp expression returning a
+;;; COMMAND, which is either a string or a Lisp expression returning a
;;; string. COMMAND may be a list of commands.
;;;
;;; * Return this command to `dired-guess-shell-command' which prompts user
(interactive)
(require 'man)
(let ((file (dired-get-filename))
- (manual-program "nroff -man -h"))
+ (manual-program "nroff -man -h"))
(Man-getpage-in-background file)))
;;; Run Info on files.
;;; REDEFINE.
;;; Redefines dired.el's version of `dired-find-buffer-nocreate'
-(defun dired-find-buffer-nocreate (dirname)
- (if dired-find-subdir
+(defun dired-find-buffer-nocreate (dirname &optional mode)
+ (if (and dired-find-subdir
+ ;; don't try to find a wildcard as a subdirectory
+ (string-equal dirname (file-name-directory dirname)))
(let* ((cur-buf (current-buffer))
- (buffers (nreverse (dired-buffers-for-dir dirname)))
- (cur-buf-matches (and (memq cur-buf buffers)
- ;; wildcards must match, too:
- (equal dired-directory dirname))))
- ;; We don't want to switch to the same buffer---
- (setq buffers (delq cur-buf buffers));;need setq with delq
- (or (car (sort buffers (function dired-buffer-more-recently-used-p)))
- ;; ---unless it's the only possibility:
- (and cur-buf-matches cur-buf)))
- (dired-old-find-buffer-nocreate dirname)))
+ (buffers (nreverse
+ (dired-buffers-for-dir (expand-file-name dirname))))
+ (cur-buf-matches (and (memq cur-buf buffers)
+ ;; wildcards must match, too:
+ (equal dired-directory dirname))))
+ ;; We don't want to switch to the same buffer---
+ (setq buffers (delq cur-buf buffers));;need setq with delq
+ (or (car (sort buffers (function dired-buffer-more-recently-used-p)))
+ ;; ---unless it's the only possibility:
+ (and cur-buf-matches cur-buf)))
+ (dired-old-find-buffer-nocreate dirname mode)))
;; This should be a builtin
(defun dired-buffer-more-recently-used-p (buffer1 buffer2)