2009-09-11 06:50:14 +00:00
|
|
|
|
;;; dired-x.el --- extra Dired functionality
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2012-01-05 09:46:05 +00:00
|
|
|
|
;; Copyright (C) 1993-1994, 1997, 2001-2012 Free Software Foundation, Inc.
|
2007-11-28 03:57:08 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
|
|
|
|
|
;; Lawrence R. Dodd <dodd@roebling.poly.edu>
|
2005-10-27 06:34:30 +00:00
|
|
|
|
;; Maintainer: Romain Francoise <rfrancoise@gnu.org>
|
2001-08-29 15:00:34 +00:00
|
|
|
|
;; Keywords: dired extensions files
|
2010-08-29 16:17:13 +00:00
|
|
|
|
;; Package: emacs
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;; Commentary:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; This is based on Sebastian Kremer's excellent dired-x.el (Dired Extra),
|
|
|
|
|
;; version 1.191, adapted for GNU Emacs. See the `dired-x' info pages.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; USAGE: In your ~/.emacs,
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; (add-hook 'dired-load-hook
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; (lambda ()
|
2011-02-16 08:32:30 +00:00
|
|
|
|
;; (load "dired-x")
|
2007-05-01 09:33:51 +00:00
|
|
|
|
;; ;; Set global variables here. For example:
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; ;; (setq dired-guess-shell-gnutar "gtar")
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; ))
|
2007-05-01 09:33:51 +00:00
|
|
|
|
;; (add-hook 'dired-mode-hook
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; (lambda ()
|
2007-05-01 09:33:51 +00:00
|
|
|
|
;; ;; Set buffer-local variables here. For example:
|
2004-06-05 17:53:03 +00:00
|
|
|
|
;; ;; (dired-omit-mode 1)
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; ))
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
2011-02-19 20:36:54 +00:00
|
|
|
|
;; At load time dired-x.el will install itself and bind some dired keys.
|
|
|
|
|
;; Some dired.el and dired-aux.el functions have extra features if
|
|
|
|
|
;; dired-x is loaded.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; User customization: M-x customize-group RET dired-x RET.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; *Please* see the `dired-x' info pages for more details.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; Code:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
;; This is a no-op if dired-x is being loaded via `dired-load-hook',
|
|
|
|
|
;; but maybe not if a dired-x function is being autoloaded.
|
1994-06-10 21:20:25 +00:00
|
|
|
|
(require 'dired)
|
1994-04-06 00:51:43 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; User-defined variables.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1997-05-25 18:08:23 +00:00
|
|
|
|
(defgroup dired-x nil
|
|
|
|
|
"Extended directory editing (dired-x)."
|
|
|
|
|
:group 'dired)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1997-05-25 18:08:23 +00:00
|
|
|
|
(defgroup dired-keys nil
|
|
|
|
|
"Dired keys customizations."
|
|
|
|
|
:prefix "dired-"
|
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1997-05-25 18:08:23 +00:00
|
|
|
|
(defcustom dired-bind-vm nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means \"V\" runs `dired-vm', otherwise \"V\" runs `dired-rmail'.
|
2009-01-27 03:45:06 +00:00
|
|
|
|
RMAIL files in the old Babyl format (used before before Emacs 23.1)
|
|
|
|
|
contain \"-*- rmail -*-\" at the top, so `dired-find-file'
|
|
|
|
|
will run `rmail' on these files. New RMAIL files use the standard
|
|
|
|
|
mbox format, and so cannot be distinguished in this way."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'dired-keys)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-bind-jump t
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Non-nil means bind `dired-jump' to C-x C-j, otherwise do not.
|
|
|
|
|
Setting this variable directly after dired-x is loaded has no effect -
|
|
|
|
|
use \\[customize]."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
2011-02-16 08:32:30 +00:00
|
|
|
|
:set (lambda (sym val)
|
|
|
|
|
(if (set sym val)
|
|
|
|
|
(progn
|
2012-01-26 02:32:56 +00:00
|
|
|
|
(define-key ctl-x-map "\C-j" 'dired-jump)
|
|
|
|
|
(define-key ctl-x-4-map "\C-j" 'dired-jump-other-window))
|
|
|
|
|
(if (eq 'dired-jump (lookup-key ctl-x-map "\C-j"))
|
|
|
|
|
(define-key ctl-x-map "\C-j" nil))
|
|
|
|
|
(if (eq 'dired-jump-other-window (lookup-key ctl-x-4-map "\C-j"))
|
|
|
|
|
(define-key ctl-x-4-map "\C-j" nil))))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-keys)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-bind-man t
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not.
|
|
|
|
|
Setting this variable directly after dired-x is loaded has no effect -
|
|
|
|
|
use \\[customize]."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
2011-02-16 08:32:30 +00:00
|
|
|
|
:set (lambda (sym val)
|
|
|
|
|
(if (set sym val)
|
|
|
|
|
(define-key dired-mode-map "N" 'dired-man)
|
|
|
|
|
(if (eq 'dired-man (lookup-key dired-mode-map "N"))
|
|
|
|
|
(define-key dired-mode-map "N" nil))))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-keys)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-bind-info t
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not.
|
|
|
|
|
Setting this variable directly after dired-x is loaded has no effect -
|
|
|
|
|
use \\[customize]."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
2011-02-16 08:32:30 +00:00
|
|
|
|
:set (lambda (sym val)
|
|
|
|
|
(if (set sym val)
|
|
|
|
|
(define-key dired-mode-map "I" 'dired-info)
|
|
|
|
|
(if (eq 'dired-info (lookup-key dired-mode-map "I"))
|
|
|
|
|
(define-key dired-mode-map "I" nil))))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-keys)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-vm-read-only-folders nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"If non-nil, \\[dired-vm] will visit all folders read-only.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
If neither nil nor t, e.g. the symbol `if-file-read-only', only
|
2011-02-16 08:32:30 +00:00
|
|
|
|
files not writable by you are visited read-only."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type '(choice (const :tag "off" nil)
|
|
|
|
|
(const :tag "on" t)
|
1998-06-24 08:56:46 +00:00
|
|
|
|
(other :tag "non-writable only" if-file-read-only))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defcustom dired-omit-size-limit 30000
|
|
|
|
|
"Maximum size for the \"omitting\" feature.
|
|
|
|
|
If nil, there is no maximum size."
|
|
|
|
|
:type '(choice (const :tag "no maximum" nil) integer)
|
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
2012-05-13 03:05:06 +00:00
|
|
|
|
;; For backward compatibility
|
|
|
|
|
(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1")
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(define-minor-mode dired-omit-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
"Toggle omission of uninteresting files in Dired (Dired-Omit mode).
|
|
|
|
|
With a prefix argument ARG, enable Dired-Omit mode if ARG is
|
|
|
|
|
positive, and disable it otherwise. If called from Lisp, enable
|
|
|
|
|
the mode if ARG is omitted or nil.
|
2010-03-30 16:10:14 +00:00
|
|
|
|
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
Dired-Omit mode is a buffer-local minor mode. When enabled in a
|
|
|
|
|
Dired buffer, Dired does not list files whose filenames match
|
|
|
|
|
regexp `dired-omit-files', nor files ending with extensions in
|
|
|
|
|
`dired-omit-extensions'.
|
2010-03-30 16:10:14 +00:00
|
|
|
|
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
To enable omitting in every Dired buffer, you can put this in
|
|
|
|
|
your init file:
|
|
|
|
|
|
|
|
|
|
(add-hook 'dired-mode-hook (lambda () (dired-omit-mode)))
|
2010-03-30 16:10:14 +00:00
|
|
|
|
|
|
|
|
|
See Info node `(dired-x) Omitting Variables' for more information."
|
2004-06-05 17:53:03 +00:00
|
|
|
|
:group 'dired-x
|
|
|
|
|
(if dired-omit-mode
|
|
|
|
|
;; This will mention how many lines were omitted:
|
|
|
|
|
(let ((dired-omit-size-limit nil)) (dired-omit-expunge))
|
|
|
|
|
(revert-buffer)))
|
|
|
|
|
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(put 'dired-omit-mode 'safe-local-variable 'booleanp)
|
|
|
|
|
|
1997-07-17 19:15:13 +00:00
|
|
|
|
(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Filenames matching this regexp will not be displayed.
|
2004-06-05 17:53:03 +00:00
|
|
|
|
This only has effect when `dired-omit-mode' is t. See interactive function
|
|
|
|
|
`dired-omit-mode' \(\\[dired-omit-mode]\) and variable
|
1997-07-17 19:15:13 +00:00
|
|
|
|
`dired-omit-extensions'. The default is to omit `.', `..', auto-save
|
|
|
|
|
files and lock files."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'regexp
|
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-01-13 15:44:41 +00:00
|
|
|
|
(defcustom dired-omit-verbose t
|
|
|
|
|
"When non-nil, show messages when omitting files.
|
|
|
|
|
When nil, don't show messages."
|
Add missing :version tags to new defgroups and defcustoms
* window.el (window-sides-slots):
* tool-bar.el (tool-bar-position):
* term/xterm.el (xterm-extra-capabilities):
* ses.el (ses-self-reference-early-detection):
* progmodes/verilog-mode.el (verilog-auto-declare-nettype)
(verilog-auto-wire-type)
(verilog-auto-delete-trailing-whitespace)
(verilog-auto-reset-blocking-in-non, verilog-auto-inst-sort)
(verilog-auto-tieoff-declaration):
* progmodes/sql.el (sql-login-hook, sql-ansi-statement-starters)
(sql-oracle-statement-starters, sql-oracle-scan-on):
* progmodes/prolog.el (prolog-align-comments-flag)
(prolog-indent-mline-comments-flag, prolog-object-end-to-0-flag)
(prolog-left-indent-regexp, prolog-paren-indent-p)
(prolog-paren-indent, prolog-parse-mode, prolog-keywords)
(prolog-types, prolog-mode-specificators)
(prolog-determinism-specificators, prolog-directives)
(prolog-electric-newline-flag, prolog-hungry-delete-key-flag)
(prolog-electric-dot-flag)
(prolog-electric-dot-full-predicate-template)
(prolog-electric-underscore-flag, prolog-electric-tab-flag)
(prolog-electric-if-then-else-flag, prolog-electric-colon-flag)
(prolog-electric-dash-flag, prolog-old-sicstus-keys-flag)
(prolog-program-switches, prolog-prompt-regexp)
(prolog-debug-on-string, prolog-debug-off-string)
(prolog-trace-on-string, prolog-trace-off-string)
(prolog-zip-on-string, prolog-zip-off-string)
(prolog-use-standard-consult-compile-method-flag)
(prolog-use-prolog-tokenizer-flag, prolog-imenu-flag)
(prolog-imenu-max-lines, prolog-info-predicate-index)
(prolog-underscore-wordchar-flag, prolog-use-sicstus-sd)
(prolog-char-quote-workaround):
* progmodes/cc-vars.el (c-defun-tactic):
* net/tramp.el (tramp-encoding-command-interactive)
(tramp-local-end-of-line):
* net/soap-client.el (soap-client):
* net/netrc.el (netrc-file):
* net/gnutls.el (gnutls):
* minibuffer.el (completion-category-overrides)
(completion-cycle-threshold)
(completion-pcm-complete-word-inserts-delimiters):
* man.el (Man-name-local-regexp):
* mail/feedmail.el (feedmail-display-full-frame):
* international/characters.el (glyphless-char-display-control):
* eshell/em-ls.el (eshell-ls-date-format):
* emacs-lisp/cl-indent.el (lisp-lambda-list-keyword-alignment)
(lisp-lambda-list-keyword-parameter-indentation)
(lisp-lambda-list-keyword-parameter-alignment):
* doc-view.el (doc-view-image-width, doc-view-unoconv-program):
* dired-x.el (dired-omit-verbose):
* cus-theme.el (custom-theme-allow-multiple-selections):
* calc/calc.el (calc-highlight-selections-with-faces)
(calc-lu-field-reference, calc-lu-power-reference)
(calc-note-threshold):
* battery.el (battery-mode-line-limit):
* arc-mode.el (archive-7z-extract, archive-7z-expunge)
(archive-7z-update):
* allout.el (allout-prefixed-keybindings)
(allout-unprefixed-keybindings)
(allout-inhibit-auto-fill-on-headline)
(allout-flattened-numbering-abbreviation):
* allout-widgets.el (allout-widgets-auto-activation)
(allout-widgets-icons-dark-subdir)
(allout-widgets-icons-light-subdir, allout-widgets-icon-types)
(allout-widgets-theme-dark-background)
(allout-widgets-theme-light-background)
(allout-widgets-item-image-properties-emacs)
(allout-widgets-item-image-properties-xemacs)
(allout-widgets-run-unit-tests-on-load)
(allout-widgets-time-decoration-activity)
(allout-widgets-hook-error-post-time)
(allout-widgets-track-decoration):
* gnus/sieve-manage.el (sieve-manage-default-stream):
* gnus/shr.el (shr):
* gnus/nnir.el (nnir-ignored-newsgroups, nnir-summary-line-format)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-notmuch-program)
(nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix)
(nnir-method-default-engines):
* gnus/message.el (message-cite-reply-position):
* gnus/gssapi.el (gssapi-program):
* gnus/gravatar.el (gravatar):
* gnus/gnus-sum.el (gnus-refer-thread-use-nnir):
* gnus/gnus-registry.el (gnus-registry-unfollowed-addresses)
(gnus-registry-max-pruned-entries):
* gnus/gnus-picon.el (gnus-picon-inhibit-top-level-domains):
* gnus/gnus-int.el (gnus-after-set-mark-hook)
(gnus-before-update-mark-hook):
* gnus/gnus-async.el (gnus-async-post-fetch-function):
* gnus/auth-source.el (auth-source-cache-expiry):
Add missing :version tags to new defcustoms and defgroups.
2012-02-11 22:13:29 +00:00
|
|
|
|
:version "24.1"
|
2011-01-13 15:44:41 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
1997-05-25 18:08:23 +00:00
|
|
|
|
(defcustom dired-find-subdir nil ; t is pretty near to DWIM...
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"If non-nil, Dired always finds a directory in a buffer of its own.
|
1994-10-26 09:32:58 +00:00
|
|
|
|
If nil, Dired finds the directory as a subdirectory in some other buffer
|
|
|
|
|
if it is present as one.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
If there are several dired buffers for a directory, the most recently
|
1994-01-03 16:56:13 +00:00
|
|
|
|
used is chosen.
|
|
|
|
|
|
|
|
|
|
Dired avoids switching to the current buffer, so that if you have
|
2001-01-03 21:21:20 +00:00
|
|
|
|
a normal and a wildcard buffer for the same directory, \\[dired] will
|
1997-05-25 18:08:23 +00:00
|
|
|
|
toggle between those two."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-enable-local-variables t
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Control use of local-variables lists in Dired.
|
2009-09-24 01:37:14 +00:00
|
|
|
|
This temporarily overrides the value of `enable-local-variables' when
|
|
|
|
|
listing a directory. See also `dired-local-variables-file'."
|
2011-02-23 03:44:13 +00:00
|
|
|
|
:risky t
|
|
|
|
|
:type '(choice (const :tag "Query Unsafe" t)
|
|
|
|
|
(const :tag "Safe Only" :safe)
|
|
|
|
|
(const :tag "Do all" :all)
|
|
|
|
|
(const :tag "Ignore" nil)
|
|
|
|
|
(other :tag "Query" other))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(make-obsolete-variable 'dired-enable-local-variables
|
|
|
|
|
"use a standard `dir-locals-file' instead." "24.1")
|
|
|
|
|
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(defcustom dired-guess-shell-gnutar
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (exe '("tar" "gtar"))
|
|
|
|
|
(if (with-temp-buffer
|
|
|
|
|
(ignore-errors (call-process exe nil t nil "--version"))
|
|
|
|
|
(and (re-search-backward "GNU tar" nil t) t))
|
|
|
|
|
(throw 'found exe))))
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"If non-nil, name of GNU tar executable.
|
2001-01-03 21:21:20 +00:00
|
|
|
|
\(E.g., \"tar\" or \"gtar\"). The `z' switch will be used with it for
|
|
|
|
|
compressed or gzip'ed tar files. If you don't have GNU tar, set this
|
1997-05-25 18:08:23 +00:00
|
|
|
|
to nil: a pipe using `zcat' or `gunzip -c' will be used."
|
2011-02-16 08:32:30 +00:00
|
|
|
|
;; Changed from system-type test to testing --version output.
|
|
|
|
|
;; Maybe test --help for -z instead?
|
|
|
|
|
:version "24.1"
|
2001-01-03 21:21:20 +00:00
|
|
|
|
:type '(choice (const :tag "Not GNU tar" nil)
|
|
|
|
|
(string :tag "Command name"))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-guess-shell-gzip-quiet t
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil says pass -q to gzip overriding verbose GZIP environment."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-guess-shell-znew-switches nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"If non-nil, then string of switches passed to `znew', example: \"-K\"."
|
2001-01-03 21:21:20 +00:00
|
|
|
|
:type '(choice (const :tag "None" nil)
|
|
|
|
|
(string :tag "Switches"))
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:group 'dired-x)
|
|
|
|
|
|
|
|
|
|
(defcustom dired-clean-up-buffers-too t
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means offer to kill buffers visiting files and dirs deleted in Dired."
|
1997-05-25 18:08:23 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; KEY BINDINGS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(define-key dired-mode-map "\M-o" 'dired-omit-mode)
|
2004-06-13 13:38:14 +00:00
|
|
|
|
(define-key dired-mode-map "*O" 'dired-mark-omitted)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(define-key dired-mode-map "\M-(" 'dired-mark-sexp)
|
1996-11-02 07:56:36 +00:00
|
|
|
|
(define-key dired-mode-map "*(" 'dired-mark-sexp)
|
|
|
|
|
(define-key dired-mode-map "*." 'dired-mark-extension)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(define-key dired-mode-map "\M-!" 'dired-smart-shell-command)
|
|
|
|
|
(define-key dired-mode-map "\M-G" 'dired-goto-subdir)
|
|
|
|
|
(define-key dired-mode-map "F" 'dired-do-find-marked-files)
|
|
|
|
|
(define-key dired-mode-map "Y" 'dired-do-relsymlink)
|
|
|
|
|
(define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)
|
|
|
|
|
(define-key dired-mode-map "V" 'dired-do-run-mail)
|
|
|
|
|
|
2005-11-03 19:40:39 +00:00
|
|
|
|
;;; MENU BINDINGS
|
|
|
|
|
|
2011-02-15 05:09:54 +00:00
|
|
|
|
(require 'easymenu)
|
|
|
|
|
|
|
|
|
|
(let ((menu (lookup-key dired-mode-map [menu-bar])))
|
|
|
|
|
(easy-menu-add-item menu '("Operate")
|
|
|
|
|
["Find Files" dired-do-find-marked-files
|
|
|
|
|
:help "Find current or marked files"]
|
|
|
|
|
"Shell Command...")
|
|
|
|
|
(easy-menu-add-item menu '("Operate")
|
|
|
|
|
["Relative Symlink to..." dired-do-relsymlink
|
|
|
|
|
:visible (fboundp 'make-symbolic-link)
|
|
|
|
|
:help "Make relative symbolic links for current or \
|
|
|
|
|
marked files"]
|
|
|
|
|
"Hardlink to...")
|
|
|
|
|
(easy-menu-add-item menu '("Mark")
|
|
|
|
|
["Flag Extension..." dired-flag-extension
|
|
|
|
|
:help "Flag files with a certain extension for deletion"]
|
|
|
|
|
"Mark Executables")
|
|
|
|
|
(easy-menu-add-item menu '("Mark")
|
|
|
|
|
["Mark Extension..." dired-mark-extension
|
|
|
|
|
:help "Mark files with a certain extension"]
|
|
|
|
|
"Unmark All")
|
|
|
|
|
(easy-menu-add-item menu '("Mark")
|
|
|
|
|
["Mark Omitted" dired-mark-omitted
|
|
|
|
|
:help "Mark files matching `dired-omit-files' \
|
|
|
|
|
and `dired-omit-extensions'"]
|
|
|
|
|
"Unmark All")
|
|
|
|
|
(easy-menu-add-item menu '("Regexp")
|
|
|
|
|
["Relative Symlink..." dired-do-relsymlink-regexp
|
|
|
|
|
:visible (fboundp 'make-symbolic-link)
|
|
|
|
|
:help "Make relative symbolic links for files \
|
|
|
|
|
matching regexp"]
|
|
|
|
|
"Hardlink...")
|
|
|
|
|
(easy-menu-add-item menu '("Immediate")
|
|
|
|
|
["Omit Mode" dired-omit-mode
|
|
|
|
|
:style toggle :selected dired-omit-mode
|
|
|
|
|
:help "Enable or disable omitting \"uninteresting\" \
|
|
|
|
|
files"]
|
|
|
|
|
"Refresh"))
|
2005-11-03 19:40:39 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Install into appropriate hooks.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'dired-mode-hook 'dired-extra-startup)
|
|
|
|
|
(add-hook 'dired-after-readin-hook 'dired-omit-expunge)
|
|
|
|
|
|
|
|
|
|
(defun dired-extra-startup ()
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
"Automatically put on `dired-mode-hook' to get extra Dired features:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
\\<dired-mode-map>
|
|
|
|
|
\\[dired-do-run-mail]\t-- run mail on folder (see `dired-bind-vm')
|
|
|
|
|
\\[dired-info]\t-- run info on file
|
|
|
|
|
\\[dired-man]\t-- run man on file
|
|
|
|
|
\\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
|
2004-06-05 17:53:03 +00:00
|
|
|
|
\\[dired-omit-mode]\t-- toggle omitting of files
|
2001-01-03 21:21:20 +00:00
|
|
|
|
\\[dired-mark-sexp]\t-- mark by Lisp expression
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-16 08:32:30 +00:00
|
|
|
|
To see the options you can set, use M-x customize-group RET dired-x RET.
|
|
|
|
|
See also the functions:
|
2001-01-03 21:21:20 +00:00
|
|
|
|
`dired-flag-extension'
|
|
|
|
|
`dired-virtual'
|
|
|
|
|
`dired-jump'
|
|
|
|
|
`dired-man'
|
|
|
|
|
`dired-vm'
|
|
|
|
|
`dired-rmail'
|
|
|
|
|
`dired-info'
|
|
|
|
|
`dired-do-find-marked-files'"
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
;; These must be done in each new dired buffer.
|
|
|
|
|
(dired-hack-local-variables)
|
|
|
|
|
(dired-omit-startup))
|
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; EXTENSION MARKING FUNCTIONS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Mark files with some extension.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-mark-extension (extension &optional marker-char)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Mark all files with a certain EXTENSION for use in later commands.
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
A `.' is *not* automatically prepended to the string entered."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; EXTENSION may also be a list of extensions instead of a single one.
|
|
|
|
|
;; Optional MARKER-CHAR is marker to use.
|
|
|
|
|
(interactive "sMarking extension: \nP")
|
|
|
|
|
(or (listp extension)
|
|
|
|
|
(setq extension (list extension)))
|
|
|
|
|
(dired-mark-files-regexp
|
|
|
|
|
(concat ".";; don't match names with nothing but an extension
|
|
|
|
|
"\\("
|
|
|
|
|
(mapconcat 'regexp-quote extension "\\|")
|
|
|
|
|
"\\)$")
|
|
|
|
|
marker-char))
|
|
|
|
|
|
|
|
|
|
(defun dired-flag-extension (extension)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"In dired, flag all files with a certain EXTENSION for deletion.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
A `.' is *not* automatically prepended to the string entered."
|
|
|
|
|
(interactive "sFlagging extension: ")
|
|
|
|
|
(dired-mark-extension extension dired-del-marker))
|
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Define some unpopular file extensions. Used for cleaning and omitting.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(defvar dired-patch-unclean-extensions
|
|
|
|
|
'(".rej" ".orig")
|
|
|
|
|
"List of extensions of dispensable files created by the `patch' program.")
|
|
|
|
|
|
|
|
|
|
(defvar dired-tex-unclean-extensions
|
|
|
|
|
'(".toc" ".log" ".aux");; these are already in completion-ignored-extensions
|
|
|
|
|
"List of extensions of dispensable files created by TeX.")
|
|
|
|
|
|
|
|
|
|
(defvar dired-latex-unclean-extensions
|
|
|
|
|
'(".idx" ".lof" ".lot" ".glo")
|
|
|
|
|
"List of extensions of dispensable files created by LaTeX.")
|
|
|
|
|
|
|
|
|
|
(defvar dired-bibtex-unclean-extensions
|
|
|
|
|
'(".blg" ".bbl")
|
|
|
|
|
"List of extensions of dispensable files created by BibTeX.")
|
|
|
|
|
|
|
|
|
|
(defvar dired-texinfo-unclean-extensions
|
|
|
|
|
'(".cp" ".cps" ".fn" ".fns" ".ky" ".kys" ".pg" ".pgs"
|
|
|
|
|
".tp" ".tps" ".vr" ".vrs")
|
|
|
|
|
"List of extensions of dispensable files created by texinfo.")
|
|
|
|
|
|
|
|
|
|
(defun dired-clean-patch ()
|
|
|
|
|
"Flag dispensable files created by patch for deletion.
|
|
|
|
|
See variable `dired-patch-unclean-extensions'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(dired-flag-extension dired-patch-unclean-extensions))
|
|
|
|
|
|
|
|
|
|
(defun dired-clean-tex ()
|
1994-04-06 00:51:43 +00:00
|
|
|
|
"Flag dispensable files created by [La]TeX etc. for deletion.
|
2003-09-28 09:05:31 +00:00
|
|
|
|
See variables `dired-tex-unclean-extensions',
|
1994-04-06 00:51:43 +00:00
|
|
|
|
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
|
|
|
|
|
`dired-texinfo-unclean-extensions'."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(dired-flag-extension (append dired-texinfo-unclean-extensions
|
|
|
|
|
dired-latex-unclean-extensions
|
|
|
|
|
dired-bibtex-unclean-extensions
|
|
|
|
|
dired-tex-unclean-extensions)))
|
|
|
|
|
|
1994-04-06 00:51:43 +00:00
|
|
|
|
(defun dired-very-clean-tex ()
|
|
|
|
|
"Flag dispensable files created by [La]TeX *and* \".dvi\" for deletion.
|
|
|
|
|
See variables `dired-texinfo-unclean-extensions',
|
|
|
|
|
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
|
|
|
|
|
`dired-texinfo-unclean-extensions'."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
1994-04-06 00:51:43 +00:00
|
|
|
|
(dired-flag-extension (append dired-texinfo-unclean-extensions
|
|
|
|
|
dired-latex-unclean-extensions
|
|
|
|
|
dired-bibtex-unclean-extensions
|
|
|
|
|
dired-tex-unclean-extensions
|
|
|
|
|
(list ".dvi"))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; JUMP.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1994-05-27 06:38:40 +00:00
|
|
|
|
;;;###autoload
|
2010-05-20 21:33:58 +00:00
|
|
|
|
(defun dired-jump (&optional other-window file-name)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
"Jump to dired buffer corresponding to current buffer.
|
|
|
|
|
If in a file, dired the current directory and move to file's line.
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
If in Dired already, pop up a level and goto old directory's line.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
In case the proper dired file line cannot be found, refresh the dired
|
2010-05-20 21:33:58 +00:00
|
|
|
|
buffer and try again.
|
|
|
|
|
When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
|
|
|
|
|
Interactively with prefix argument, read FILE-NAME and
|
|
|
|
|
move to its line in dired."
|
|
|
|
|
(interactive
|
|
|
|
|
(list nil (and current-prefix-arg
|
|
|
|
|
(read-file-name "Jump to dired file: "))))
|
|
|
|
|
(let* ((file (or file-name buffer-file-name))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(dir (if file (file-name-directory file) default-directory)))
|
2010-05-20 21:33:58 +00:00
|
|
|
|
(if (and (eq major-mode 'dired-mode) (null file-name))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq dir (dired-current-directory))
|
|
|
|
|
(dired-up-directory other-window)
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(unless (dired-goto-file dir)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; refresh and try again
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(dired-insert-subdir (file-name-directory dir))
|
|
|
|
|
(dired-goto-file dir)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if other-window
|
|
|
|
|
(dired-other-window dir)
|
|
|
|
|
(dired dir))
|
|
|
|
|
(if file
|
|
|
|
|
(or (dired-goto-file file)
|
|
|
|
|
;; refresh and try again
|
1994-04-06 00:51:43 +00:00
|
|
|
|
(progn
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(dired-insert-subdir (file-name-directory file))
|
1996-11-10 23:41:13 +00:00
|
|
|
|
(dired-goto-file file))
|
|
|
|
|
;; Toggle omitting, if it is on, and try again.
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(when dired-omit-mode
|
|
|
|
|
(dired-omit-mode)
|
|
|
|
|
(dired-goto-file file)))))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-03-02 07:44:33 +00:00
|
|
|
|
;;;###autoload
|
2010-05-20 21:33:58 +00:00
|
|
|
|
(defun dired-jump-other-window (&optional file-name)
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
"Like \\[dired-jump] (`dired-jump') but in other window."
|
2010-05-20 21:33:58 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list (and current-prefix-arg
|
|
|
|
|
(read-file-name "Jump to dired file: "))))
|
|
|
|
|
(dired-jump t file-name))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; OMITTING.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Enhanced omitting of lines from directory listings.
|
|
|
|
|
;; Marked files are never omitted.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; should probably get rid of this and always use 'no-dir.
|
|
|
|
|
;; sk 28-Aug-1991 09:37
|
|
|
|
|
(defvar dired-omit-localp 'no-dir
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"The LOCALP argument `dired-omit-expunge' passes to `dired-get-filename'.
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
If it is `no-dir', omitting is much faster, but you can only match
|
2003-01-14 23:11:19 +00:00
|
|
|
|
against the non-directory part of the file name. Set it to nil if you
|
|
|
|
|
need to match the entire file name.")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; \017=^O for Omit - other packages can chose other control characters.
|
|
|
|
|
(defvar dired-omit-marker-char ?\017
|
2009-09-24 01:37:14 +00:00
|
|
|
|
"Temporary marker used by Dired-Omit.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
Should never be used as marker by the user or other packages.")
|
|
|
|
|
|
|
|
|
|
(defun dired-omit-startup ()
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(or (assq 'dired-omit-mode minor-mode-alist)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(setq minor-mode-alist
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(append '((dired-omit-mode
|
2001-10-29 11:39:24 +00:00
|
|
|
|
(:eval (if (eq major-mode 'dired-mode)
|
|
|
|
|
" Omit" ""))))
|
|
|
|
|
minor-mode-alist))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(defun dired-mark-omitted ()
|
|
|
|
|
"Mark files matching `dired-omit-files' and `dired-omit-extensions'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
|
|
|
|
|
(dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(defcustom dired-omit-extensions
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(append completion-ignored-extensions
|
|
|
|
|
dired-latex-unclean-extensions
|
|
|
|
|
dired-bibtex-unclean-extensions
|
|
|
|
|
dired-texinfo-unclean-extensions)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"If non-nil, a list of extensions \(strings\) to omit from Dired listings.
|
1994-06-13 19:34:21 +00:00
|
|
|
|
Defaults to elements of `completion-ignored-extensions',
|
|
|
|
|
`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and
|
2001-01-03 21:21:20 +00:00
|
|
|
|
`dired-texinfo-unclean-extensions'.
|
1994-06-13 19:34:21 +00:00
|
|
|
|
|
2004-06-05 17:53:03 +00:00
|
|
|
|
See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and
|
2011-02-14 01:27:56 +00:00
|
|
|
|
variables `dired-omit-mode' and `dired-omit-files'."
|
|
|
|
|
:type '(repeat string)
|
|
|
|
|
:group 'dired-x)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(defun dired-omit-expunge (&optional regexp)
|
|
|
|
|
"Erases all unmarked files matching REGEXP.
|
2004-06-05 17:53:03 +00:00
|
|
|
|
Does nothing if global variable `dired-omit-mode' is nil, or if called
|
1996-12-07 20:15:18 +00:00
|
|
|
|
non-interactively and buffer is bigger than `dired-omit-size-limit'.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
This functions works by temporarily binding `dired-marker-char' to
|
|
|
|
|
`dired-omit-marker-char' and calling `dired-do-kill-lines'."
|
|
|
|
|
(interactive "sOmit files (regexp): ")
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(if (and dired-omit-mode
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(or (called-interactively-p 'interactive)
|
1996-12-07 20:15:18 +00:00
|
|
|
|
(not dired-omit-size-limit)
|
1998-07-04 21:09:49 +00:00
|
|
|
|
(< (buffer-size) dired-omit-size-limit)
|
|
|
|
|
(progn
|
2011-01-13 15:44:41 +00:00
|
|
|
|
(when dired-omit-verbose
|
|
|
|
|
(message "Not omitting: directory larger than %d characters."
|
|
|
|
|
dired-omit-size-limit))
|
2004-06-05 17:53:03 +00:00
|
|
|
|
(setq dired-omit-mode nil)
|
1998-07-04 21:09:49 +00:00
|
|
|
|
nil)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(let ((omit-re (or regexp (dired-omit-regexp)))
|
1994-09-06 06:56:47 +00:00
|
|
|
|
(old-modified-p (buffer-modified-p))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
count)
|
|
|
|
|
(or (string= omit-re "")
|
|
|
|
|
(let ((dired-marker-char dired-omit-marker-char))
|
2011-01-13 15:44:41 +00:00
|
|
|
|
(when dired-omit-verbose (message "Omitting..."))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (dired-mark-unmarked-files omit-re nil nil dired-omit-localp)
|
|
|
|
|
(progn
|
2011-01-13 15:44:41 +00:00
|
|
|
|
(setq count (dired-do-kill-lines
|
|
|
|
|
nil
|
|
|
|
|
(if dired-omit-verbose "Omitted %d line%s." "")))
|
1995-04-25 22:32:18 +00:00
|
|
|
|
(force-mode-line-update))
|
2011-01-13 15:44:41 +00:00
|
|
|
|
(when dired-omit-verbose (message "(Nothing to omit)")))))
|
1994-09-06 06:56:47 +00:00
|
|
|
|
;; Try to preserve modified state of buffer. So `%*' doesn't appear
|
|
|
|
|
;; in mode-line of omitted buffers.
|
2001-01-03 21:21:20 +00:00
|
|
|
|
(set-buffer-modified-p (and old-modified-p
|
1994-09-06 06:56:47 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward dired-re-mark nil t))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
count)))
|
|
|
|
|
|
|
|
|
|
(defun dired-omit-regexp ()
|
|
|
|
|
(concat (if dired-omit-files (concat "\\(" dired-omit-files "\\)") "")
|
|
|
|
|
(if (and dired-omit-files dired-omit-extensions) "\\|" "")
|
|
|
|
|
(if dired-omit-extensions
|
|
|
|
|
(concat ".";; a non-extension part should exist
|
|
|
|
|
"\\("
|
|
|
|
|
(mapconcat 'regexp-quote dired-omit-extensions "\\|")
|
|
|
|
|
"\\)$")
|
|
|
|
|
"")))
|
|
|
|
|
|
|
|
|
|
;; Returns t if any work was done, nil otherwise.
|
|
|
|
|
(defun dired-mark-unmarked-files (regexp msg &optional unflag-p localp)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Mark unmarked files matching REGEXP, displaying MSG.
|
2011-06-18 20:17:30 +00:00
|
|
|
|
REGEXP is matched against the entire file name. When called
|
|
|
|
|
interactively, prompt for REGEXP.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
With prefix argument, unflag all those files.
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
Optional fourth argument LOCALP is as in `dired-get-filename'."
|
2011-06-18 20:17:30 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list (dired-read-regexp
|
|
|
|
|
"Mark unmarked files matching regexp (default all): ")
|
|
|
|
|
nil current-prefix-arg nil))
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
(let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(dired-mark-if
|
|
|
|
|
(and
|
|
|
|
|
;; not already marked
|
|
|
|
|
(looking-at " ")
|
|
|
|
|
;; uninteresting
|
|
|
|
|
(let ((fn (dired-get-filename localp t)))
|
|
|
|
|
(and fn (string-match regexp fn))))
|
|
|
|
|
msg)))
|
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; VIRTUAL DIRED MODE.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; For browsing `ls -lR' listings in a dired-like fashion.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
(defalias 'virtual-dired 'dired-virtual)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-virtual (dirname &optional switches)
|
|
|
|
|
"Put this buffer into Virtual Dired mode.
|
|
|
|
|
|
|
|
|
|
In Virtual Dired mode, all commands that do not actually consult the
|
|
|
|
|
filesystem will work.
|
|
|
|
|
|
|
|
|
|
This is useful if you want to peruse and move around in an ls -lR
|
|
|
|
|
output file, for example one you got from an ftp server. With
|
|
|
|
|
ange-ftp, you can even dired a directory containing an ls-lR file,
|
|
|
|
|
visit that file and turn on virtual dired mode. But don't try to save
|
|
|
|
|
this file, as dired-virtual indents the listing and thus changes the
|
|
|
|
|
buffer.
|
|
|
|
|
|
|
|
|
|
If you have save a Dired buffer in a file you can use \\[dired-virtual] to
|
|
|
|
|
resume it in a later session.
|
|
|
|
|
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
Type \\<dired-mode-map>\\[revert-buffer] \
|
|
|
|
|
in the Virtual Dired buffer and answer `y' to convert
|
|
|
|
|
the virtual to a real dired buffer again. You don't have to do this, though:
|
|
|
|
|
you can relist single subdirs using \\[dired-do-redisplay]."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; DIRNAME is the top level directory of the buffer. It will become
|
|
|
|
|
;; its `default-directory'. If nil, the old value of
|
|
|
|
|
;; default-directory is used.
|
|
|
|
|
|
|
|
|
|
;; Optional SWITCHES are the ls switches to use.
|
|
|
|
|
|
|
|
|
|
;; Shell wildcards will be used if there already is a `wildcard'
|
|
|
|
|
;; line in the buffer (thus it is a saved Dired buffer), but there
|
|
|
|
|
;; is no other way to get wildcards. Insert a `wildcard' line by
|
|
|
|
|
;; hand if you want them.
|
|
|
|
|
|
|
|
|
|
(interactive
|
|
|
|
|
(list (read-string "Virtual Dired directory: " (dired-virtual-guess-dir))))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(or (looking-at " ")
|
|
|
|
|
;; if not already indented, do it now:
|
|
|
|
|
(indent-region (point-min) (point-max) 2))
|
|
|
|
|
(or dirname (setq dirname default-directory))
|
|
|
|
|
(setq dirname (expand-file-name (file-name-as-directory dirname)))
|
|
|
|
|
(setq default-directory dirname) ; contains no wildcards
|
|
|
|
|
(let ((wildcard (save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(and (looking-at "^ wildcard ")
|
|
|
|
|
(buffer-substring (match-end 0)
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(line-end-position))))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if wildcard
|
|
|
|
|
(setq dirname (expand-file-name wildcard default-directory))))
|
|
|
|
|
;; If raw ls listing (not a saved old dired buffer), give it a
|
|
|
|
|
;; decent subdir headerline:
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(or (looking-at dired-subdir-regexp)
|
2007-11-22 13:50:06 +00:00
|
|
|
|
(insert " "
|
2005-10-25 12:02:47 +00:00
|
|
|
|
(directory-file-name (file-name-directory default-directory))
|
|
|
|
|
":\n"))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(dired-mode dirname (or switches dired-listing-switches))
|
|
|
|
|
(setq mode-name "Virtual Dired"
|
|
|
|
|
revert-buffer-function 'dired-virtual-revert)
|
|
|
|
|
(set (make-local-variable 'dired-subdir-alist) nil)
|
|
|
|
|
(dired-build-subdir-alist)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(dired-initial-position dirname))
|
|
|
|
|
|
|
|
|
|
(defun dired-virtual-guess-dir ()
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Guess and return appropriate working directory of this buffer.
|
2001-01-06 18:52:57 +00:00
|
|
|
|
The buffer is assumed to be in Dired or ls -lR format. The guess is
|
2001-01-03 21:21:20 +00:00
|
|
|
|
based upon buffer contents. If nothing could be guessed, returns
|
|
|
|
|
nil."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(let ((regexp "^\\( \\)?\\([^ \n\r]*\\)\\(:\\)[\n\r]")
|
|
|
|
|
(subexpr 2))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(cond ((looking-at regexp)
|
|
|
|
|
;; If a saved dired buffer, look to which dir and
|
|
|
|
|
;; perhaps wildcard it belongs:
|
|
|
|
|
(let ((dir (buffer-substring (match-beginning subexpr)
|
|
|
|
|
(match-end subexpr))))
|
|
|
|
|
(file-name-as-directory dir)))
|
|
|
|
|
;; Else no match for headerline found. It's a raw ls listing.
|
|
|
|
|
;; In raw ls listings the directory does not have a headerline
|
|
|
|
|
;; try parent of first subdir, if any
|
|
|
|
|
((re-search-forward regexp nil t)
|
|
|
|
|
(file-name-directory
|
|
|
|
|
(directory-file-name
|
|
|
|
|
(file-name-as-directory
|
|
|
|
|
(buffer-substring (match-beginning subexpr)
|
|
|
|
|
(match-end subexpr))))))
|
|
|
|
|
(t ; if all else fails
|
|
|
|
|
nil))))
|
|
|
|
|
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun dired-virtual-revert (&optional _arg _noconfirm)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (not
|
|
|
|
|
(y-or-n-p "Cannot revert a Virtual Dired buffer - switch to Real Dired mode? "))
|
2001-01-03 21:21:20 +00:00
|
|
|
|
(error "Cannot revert a Virtual Dired buffer")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(setq mode-name "Dired"
|
|
|
|
|
revert-buffer-function 'dired-revert)
|
|
|
|
|
(revert-buffer)))
|
|
|
|
|
|
|
|
|
|
;; A zero-arg version of dired-virtual.
|
|
|
|
|
(defun dired-virtual-mode ()
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
"Put current buffer into Virtual Dired mode (see `dired-virtual').
|
2007-04-21 19:49:03 +00:00
|
|
|
|
Useful on `magic-mode-alist' with the regexp
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-04-21 19:49:03 +00:00
|
|
|
|
\"^ \\\\(/[^ /]+\\\\)+/?:$\"
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
to put saved dired buffers automatically into Virtual Dired mode.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-04-21 19:49:03 +00:00
|
|
|
|
Also useful for `auto-mode-alist' like this:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-04-21 19:49:03 +00:00
|
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
|
'(\"[^/]\\\\.dired\\\\'\" . dired-virtual-mode))"
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(dired-virtual (dired-virtual-guess-dir)))
|
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; SMART SHELL.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; An Emacs buffer can have but one working directory, stored in the
|
|
|
|
|
;; buffer-local variable `default-directory'. A Dired buffer may have
|
|
|
|
|
;; several subdirectories inserted, but still has but one working directory:
|
|
|
|
|
;; that of the top level Dired directory in that buffer. For some commands
|
|
|
|
|
;; it is appropriate that they use the current Dired directory instead of
|
|
|
|
|
;; `default-directory', e.g., `find-file' and `compile'. This is a general
|
|
|
|
|
;; mechanism is provided for special handling of the working directory in
|
|
|
|
|
;; special major modes.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(define-obsolete-variable-alias 'default-directory-alist
|
|
|
|
|
'dired-default-directory-alist "24.1")
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; It's easier to add to this alist than redefine function
|
|
|
|
|
;; default-directory while keeping the old information.
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(defconst dired-default-directory-alist
|
1994-01-03 16:56:13 +00:00
|
|
|
|
'((dired-mode . (if (fboundp 'dired-current-directory)
|
|
|
|
|
(dired-current-directory)
|
|
|
|
|
default-directory)))
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Alist of major modes and their opinion on `default-directory'.
|
2011-03-02 07:44:33 +00:00
|
|
|
|
Each element has the form (MAJOR . EXPRESSION).
|
|
|
|
|
The function `dired-default-directory' evaluates EXPRESSION to
|
|
|
|
|
determine a default directory.")
|
|
|
|
|
|
|
|
|
|
(put 'dired-default-directory-alist 'risky-local-variable t) ; gets eval'd
|
2011-03-02 07:59:02 +00:00
|
|
|
|
(make-obsolete-variable 'dired-default-directory-alist
|
|
|
|
|
"this feature is due to be removed." "24.1")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2001-01-03 21:21:20 +00:00
|
|
|
|
(defun dired-default-directory ()
|
2011-03-02 07:44:33 +00:00
|
|
|
|
"Return the `dired-default-directory-alist' entry for the current major-mode.
|
|
|
|
|
If none, return `default-directory'."
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(or (eval (cdr (assq major-mode dired-default-directory-alist)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
default-directory))
|
|
|
|
|
|
2011-03-02 07:59:02 +00:00
|
|
|
|
;; It looks like this was intended to be something of a "general" feature,
|
|
|
|
|
;; but it only ever seems to have been used in dired-smart-shell-command,
|
|
|
|
|
;; and does not seem worth keeping around (?).
|
|
|
|
|
(make-obsolete 'dired-default-directory
|
|
|
|
|
"this feature is due to be removed." "24.1")
|
|
|
|
|
|
2008-04-22 19:54:27 +00:00
|
|
|
|
(defun dired-smart-shell-command (command &optional output-buffer error-buffer)
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
"Like function `shell-command', but in the current Virtual Dired directory."
|
2008-04-22 19:54:27 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list
|
2009-02-22 21:52:14 +00:00
|
|
|
|
(read-shell-command "Shell command: " nil nil
|
|
|
|
|
(cond
|
|
|
|
|
(buffer-file-name (file-relative-name buffer-file-name))
|
|
|
|
|
((eq major-mode 'dired-mode) (dired-get-filename t t))))
|
2008-04-22 19:54:27 +00:00
|
|
|
|
current-prefix-arg
|
|
|
|
|
shell-command-default-error-buffer))
|
2011-03-02 17:12:43 +00:00
|
|
|
|
(let ((default-directory (or (and (eq major-mode 'dired-mode)
|
|
|
|
|
(dired-current-directory))
|
|
|
|
|
default-directory)))
|
2008-04-22 19:54:27 +00:00
|
|
|
|
(shell-command command output-buffer error-buffer)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; LOCAL VARIABLES FOR DIRED BUFFERS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;; Brief Description (This feature is obsolete as of Emacs 24.1)
|
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * `dired-extra-startup' is part of the `dired-mode-hook'.
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * `dired-extra-startup' calls `dired-hack-local-variables'
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * `dired-hack-local-variables' checks the value of
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;; `dired-local-variables-file'
|
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Check if `dired-local-variables-file' is a non-nil string and is a
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;; filename found in the directory of the Dired Buffer being created.
|
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * If `dired-local-variables-file' satisfies the above, then temporarily
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;; include it in the Dired Buffer at the bottom.
|
|
|
|
|
;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Set `enable-local-variables' temporarily to the user variable
|
2011-02-23 03:44:13 +00:00
|
|
|
|
;; `dired-enable-local-variables' and run `hack-local-variables' on the
|
|
|
|
|
;; Dired Buffer.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(defcustom dired-local-variables-file (convert-standard-filename ".dired")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
"Filename, as string, containing local dired buffer variables to be hacked.
|
|
|
|
|
If this file found in current directory, then it will be inserted into dired
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
buffer and `hack-local-variables' will be run. See Info node
|
|
|
|
|
`(emacs)File Variables' for more information on local variables.
|
2011-02-14 01:27:56 +00:00
|
|
|
|
See also `dired-enable-local-variables'."
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'dired)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(make-obsolete-variable 'dired-local-variables-file 'dir-locals-file "24.1")
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-hack-local-variables ()
|
|
|
|
|
"Evaluate local variables in `dired-local-variables-file' for dired buffer."
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(and (stringp dired-local-variables-file)
|
|
|
|
|
(file-exists-p dired-local-variables-file)
|
|
|
|
|
(let ((opoint (point-max))
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
;; In case user has `enable-local-variables' set to nil we
|
|
|
|
|
;; override it locally with dired's variable.
|
|
|
|
|
(enable-local-variables dired-enable-local-variables))
|
|
|
|
|
;; Insert 'em.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char opoint)
|
|
|
|
|
(insert "\^L\n")
|
|
|
|
|
(insert-file-contents dired-local-variables-file))
|
|
|
|
|
;; Hack 'em.
|
2011-02-24 03:59:04 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(let ((buffer-file-name dired-local-variables-file))
|
|
|
|
|
(hack-local-variables))
|
|
|
|
|
;; Delete this stuff: `eobp' is used to find last subdir by dired.el.
|
|
|
|
|
(delete-region opoint (point-max)))
|
2012-06-02 10:56:09 +00:00
|
|
|
|
;; Make sure that the mode line shows the proper information.
|
|
|
|
|
(dired-sort-set-mode-line))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(make-obsolete 'dired-hack-local-variables
|
|
|
|
|
'hack-dir-local-variables-non-file-buffer "24.1")
|
|
|
|
|
|
2011-03-02 04:13:57 +00:00
|
|
|
|
;; Does not seem worth a dedicated command.
|
2011-03-01 03:05:28 +00:00
|
|
|
|
;; See the more general features in files-x.el.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
(defun dired-omit-here-always ()
|
2011-02-23 03:44:13 +00:00
|
|
|
|
"Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'.
|
|
|
|
|
If in a Dired buffer, reverts it."
|
1994-04-06 00:51:43 +00:00
|
|
|
|
(interactive)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (file-exists-p dired-local-variables-file)
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(error "Old-style dired-local-variables-file `./%s' found;
|
|
|
|
|
replace it with a dir-locals-file `./%s'"
|
|
|
|
|
dired-local-variables-file
|
|
|
|
|
dir-locals-file))
|
|
|
|
|
(if (file-exists-p dir-locals-file)
|
|
|
|
|
(message "File `./%s' already exists." dir-locals-file)
|
|
|
|
|
(with-temp-buffer
|
2011-03-01 03:05:28 +00:00
|
|
|
|
(insert "\
|
|
|
|
|
\((dired-mode . ((subdirs . nil)
|
|
|
|
|
(dired-omit-mode . t))))\n")
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(write-file dir-locals-file))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; Run extra-hooks and revert directory.
|
2011-02-23 03:44:13 +00:00
|
|
|
|
(when (derived-mode-p 'dired-mode)
|
|
|
|
|
(hack-dir-local-variables-non-file-buffer)
|
|
|
|
|
(dired-extra-startup)
|
|
|
|
|
(dired-revert))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-03-02 04:13:57 +00:00
|
|
|
|
(make-obsolete 'dired-omit-here-always 'add-dir-local-variable "24.1")
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; GUESS SHELL COMMAND.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Brief Description:
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2011-02-19 19:20:38 +00:00
|
|
|
|
;; * `dired-do-shell-command' is bound to `!' by dired.el.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2011-02-19 19:20:38 +00:00
|
|
|
|
;; * `dired-guess-shell-command' provides smarter defaults for
|
|
|
|
|
;;; dired-aux.el's `dired-read-shell-command'.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; marked files.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Parse `dired-guess-shell-alist-user' and
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP
|
|
|
|
|
;;; that matches the first file in the file list.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * If the REGEXP matches all the entries of the file list then evaluate
|
1995-03-16 04:37:48 +00:00
|
|
|
|
;;; COMMAND, which is either a string or a Lisp expression returning a
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; string. COMMAND may be a list of commands.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Return this command to `dired-guess-shell-command' which prompts user
|
2007-10-28 14:48:18 +00:00
|
|
|
|
;;; with it. The list of commands is put into the list of default values.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; If a command is used successfully then it is stored permanently in
|
|
|
|
|
;;; `dired-shell-command-history'.
|
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Guess what shell command to apply to a file.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defvar dired-shell-command-history nil
|
|
|
|
|
"History list for commands that read dired-shell commands.")
|
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Default list of shell commands.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not
|
|
|
|
|
;; install GNU zip's version of zcat.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-03-02 08:31:47 +00:00
|
|
|
|
(autoload 'Man-support-local-filenames "man")
|
2011-02-14 01:27:56 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defvar dired-guess-shell-alist-default
|
|
|
|
|
(list
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.tar\\'"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat dired-guess-shell-gnutar " xvf")
|
|
|
|
|
"tar xvf")
|
|
|
|
|
;; Extract files into a separate subdirectory
|
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; " dired-guess-shell-gnutar " -C "
|
|
|
|
|
(file-name-sans-extension file) " -xvf")
|
|
|
|
|
(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; tar -C " (file-name-sans-extension file) " -xvf"))
|
|
|
|
|
;; List archive contents.
|
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat dired-guess-shell-gnutar " tvf")
|
|
|
|
|
"tar tvf"))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; REGEXPS for compressed archives must come before the .Z rule to
|
|
|
|
|
;; be recognized:
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.tar\\.Z\\'"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Untar it.
|
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat dired-guess-shell-gnutar " zxvf")
|
|
|
|
|
(concat "zcat * | tar xvf -"))
|
|
|
|
|
;; Optional conversion to gzip format.
|
|
|
|
|
'(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" " dired-guess-shell-znew-switches))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; gzip'ed archives
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.t\\(ar\\.\\)?gz\\'"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat dired-guess-shell-gnutar " zxvf")
|
|
|
|
|
(concat "gunzip -qc * | tar xvf -"))
|
|
|
|
|
;; Extract files into a separate subdirectory
|
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; " dired-guess-shell-gnutar " -C "
|
|
|
|
|
(file-name-sans-extension file) " -zxvf")
|
|
|
|
|
(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; gunzip -qc * | tar -C "
|
|
|
|
|
(file-name-sans-extension file) " -xvf -"))
|
|
|
|
|
;; Optional decompression.
|
|
|
|
|
'(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q" ""))
|
|
|
|
|
;; List archive contents.
|
|
|
|
|
'(if dired-guess-shell-gnutar
|
|
|
|
|
(concat dired-guess-shell-gnutar " ztvf")
|
|
|
|
|
(concat "gunzip -qc * | tar tvf -")))
|
2004-03-23 07:38:57 +00:00
|
|
|
|
|
1999-08-28 15:16:55 +00:00
|
|
|
|
;; bzip2'ed archives
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.t\\(ar\\.bz2\\|bz\\)\\'"
|
1999-08-28 15:16:55 +00:00
|
|
|
|
"bunzip2 -c * | tar xvf -"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Extract files into a separate subdirectory
|
|
|
|
|
'(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; bunzip2 -c * | tar -C "
|
|
|
|
|
(file-name-sans-extension file) " -xvf -")
|
1999-08-28 15:16:55 +00:00
|
|
|
|
;; Optional decompression.
|
2006-08-31 19:47:47 +00:00
|
|
|
|
"bunzip2")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2009-11-23 00:32:37 +00:00
|
|
|
|
;; xz'ed archives
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.t\\(ar\\.\\)?xz\\'"
|
2009-11-23 00:32:37 +00:00
|
|
|
|
"unxz -c * | tar xvf -"
|
|
|
|
|
;; Extract files into a separate subdirectory
|
|
|
|
|
'(concat "mkdir " (file-name-sans-extension file)
|
|
|
|
|
"; unxz -c * | tar -C "
|
|
|
|
|
(file-name-sans-extension file) " -xvf -")
|
|
|
|
|
;; Optional decompression.
|
|
|
|
|
"unxz")
|
|
|
|
|
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.shar\\.Z\\'" "zcat * | unshar")
|
|
|
|
|
'("\\.shar\\.g?z\\'" "gunzip -qc * | unshar")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.e?ps\\'" "ghostview" "xloadimage" "lpr")
|
|
|
|
|
(list "\\.e?ps\\.g?z\\'" "gunzip -qc * | ghostview -"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional decompression.
|
|
|
|
|
'(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.e?ps\\.Z\\'" "zcat * | ghostview -"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional conversion to gzip format.
|
|
|
|
|
'(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" " dired-guess-shell-znew-switches))
|
2004-03-23 07:38:57 +00:00
|
|
|
|
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.patch\\'" "cat * | patch")
|
|
|
|
|
(list "\\.patch\\.g?z\\'" "gunzip -qc * | patch"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional decompression.
|
|
|
|
|
'(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.patch\\.Z\\'" "zcat * | patch"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional conversion to gzip format.
|
|
|
|
|
'(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" " dired-guess-shell-znew-switches))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2004-03-23 07:38:57 +00:00
|
|
|
|
;; The following four extensions are useful with dired-man ("N" key)
|
2011-03-02 08:31:47 +00:00
|
|
|
|
;; FIXME "man ./" does not work with dired-do-shell-command,
|
|
|
|
|
;; because there seems to be no way for us to modify the filename,
|
|
|
|
|
;; only the command. Hmph. `dired-man' works though.
|
2012-02-22 04:02:44 +00:00
|
|
|
|
(list "\\.\\(?:[0-9]\\|man\\)\\'"
|
|
|
|
|
'(let ((loc (Man-support-local-filenames)))
|
|
|
|
|
(cond ((eq loc 'man-db) "man -l")
|
|
|
|
|
((eq loc 'man) "man ./")
|
|
|
|
|
(t
|
|
|
|
|
"cat * | tbl | nroff -man -h | col -b"))))
|
2011-03-02 08:31:47 +00:00
|
|
|
|
(list "\\.\\(?:[0-9]\\|man\\)\\.g?z\\'"
|
|
|
|
|
'(let ((loc (Man-support-local-filenames)))
|
|
|
|
|
(cond ((eq loc 'man-db)
|
|
|
|
|
"man -l")
|
|
|
|
|
((eq loc 'man)
|
|
|
|
|
"man ./")
|
2012-02-22 04:02:44 +00:00
|
|
|
|
(t "gunzip -qc * | tbl | nroff -man -h | col -b")))
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional decompression.
|
|
|
|
|
'(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
|
2012-02-22 04:02:44 +00:00
|
|
|
|
(list "\\.[0-9]\\.Z\\'"
|
|
|
|
|
'(let ((loc (Man-support-local-filenames)))
|
|
|
|
|
(cond ((eq loc 'man-db) "man -l")
|
|
|
|
|
((eq loc 'man) "man ./")
|
|
|
|
|
(t "zcat * | tbl | nroff -man -h | col -b")))
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional conversion to gzip format.
|
|
|
|
|
'(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" " dired-guess-shell-znew-switches))
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.pod\\'" "perldoc" "pod2man * | nroff -man")
|
|
|
|
|
|
|
|
|
|
'("\\.dvi\\'" "xdvi" "dvips") ; preview and printing
|
|
|
|
|
'("\\.au\\'" "play") ; play Sun audiofiles
|
|
|
|
|
'("\\.mpe?g\\'\\|\\.avi\\'" "xine -p")
|
|
|
|
|
'("\\.ogg\\'" "ogg123")
|
|
|
|
|
'("\\.mp3\\'" "mpg123")
|
|
|
|
|
'("\\.wav\\'" "play")
|
|
|
|
|
'("\\.uu\\'" "uudecode") ; for uudecoded files
|
|
|
|
|
'("\\.hqx\\'" "mcvert")
|
|
|
|
|
'("\\.sh\\'" "sh") ; execute shell scripts
|
|
|
|
|
'("\\.xbm\\'" "bitmap") ; view X11 bitmaps
|
|
|
|
|
'("\\.gp\\'" "gnuplot")
|
|
|
|
|
'("\\.p[bgpn]m\\'" "xloadimage")
|
|
|
|
|
'("\\.gif\\'" "xloadimage") ; view gif pictures
|
|
|
|
|
'("\\.tif\\'" "xloadimage")
|
|
|
|
|
'("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG
|
|
|
|
|
'("\\.jpe?g\\'" "xloadimage")
|
|
|
|
|
'("\\.fig\\'" "xfig") ; edit fig pictures
|
|
|
|
|
'("\\.out\\'" "xgraph") ; for plotting purposes.
|
|
|
|
|
'("\\.tex\\'" "latex" "tex")
|
|
|
|
|
'("\\.texi\\(nfo\\)?\\'" "makeinfo" "texi2dvi")
|
|
|
|
|
'("\\.pdf\\'" "xpdf")
|
|
|
|
|
'("\\.doc\\'" "antiword" "strings")
|
|
|
|
|
'("\\.rpm\\'" "rpm -qilp" "rpm -ivh")
|
|
|
|
|
'("\\.dia\\'" "dia")
|
|
|
|
|
'("\\.mgp\\'" "mgp")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; Some other popular archivers.
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.zip\\'" "unzip" "unzip -l"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Extract files into a separate subdirectory
|
|
|
|
|
'(concat "unzip" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" -d " (file-name-sans-extension file)))
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.zoo\\'" "zoo x//")
|
|
|
|
|
'("\\.lzh\\'" "lharc x")
|
|
|
|
|
'("\\.arc\\'" "arc x")
|
|
|
|
|
'("\\.shar\\'" "unshar")
|
|
|
|
|
'("\\.rar\\'" "unrar x")
|
|
|
|
|
'("\\.7z\\'" "7z x")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; Compression.
|
2011-02-28 17:42:03 +00:00
|
|
|
|
(list "\\.g?z\\'" '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q")))
|
|
|
|
|
(list "\\.dz\\'" "dictunzip")
|
|
|
|
|
(list "\\.bz2\\'" "bunzip2")
|
|
|
|
|
(list "\\.xz\\'" "unxz")
|
|
|
|
|
(list "\\.Z\\'" "uncompress"
|
2006-08-31 19:47:47 +00:00
|
|
|
|
;; Optional conversion to gzip format.
|
|
|
|
|
'(concat "znew" (if dired-guess-shell-gzip-quiet " -q")
|
|
|
|
|
" " dired-guess-shell-znew-switches))
|
|
|
|
|
|
2011-02-28 17:42:03 +00:00
|
|
|
|
'("\\.sign?\\'" "gpg --verify"))
|
1994-04-06 00:51:43 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
"Default alist used for shell command guessing.
|
2001-01-03 21:21:20 +00:00
|
|
|
|
See `dired-guess-shell-alist-user'.")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2001-01-03 21:21:20 +00:00
|
|
|
|
(defcustom dired-guess-shell-alist-user nil
|
|
|
|
|
"User-defined alist of rules for suggested commands.
|
|
|
|
|
These rules take precedence over the predefined rules in the variable
|
1994-01-03 16:56:13 +00:00
|
|
|
|
`dired-guess-shell-alist-default' (to which they are prepended).
|
|
|
|
|
|
|
|
|
|
Each element of this list looks like
|
|
|
|
|
|
|
|
|
|
\(REGEXP COMMAND...\)
|
|
|
|
|
|
(virtual-dired): Declare with `defalias'.
(dired-mark-unmarked-files, dired-local-variables-file, dired-omit-here-always):
Doc fix.
(dired-omit-mode, dired-find-subdir, dired-enable-local-variables,
dired-clean-up-buffers-too, dired-extra-startup, dired-mark-extension,
dired-jump, dired-jump-other-window, dired-omit-localp, dired-virtual-mode,
dired-smart-shell-command, dired-guess-shell-alist-user, dired-man,
dired-initial-position, dired-x-hands-off-my-keys, dired-x-bind-find-file,
dired-x-submit-report): Fix typos in docstrings.
(dired-mark-unmarked-files): "?\ " -> "?\s".
2005-07-20 14:54:27 +00:00
|
|
|
|
where each COMMAND can either be a string or a Lisp expression that evaluates
|
1994-01-03 16:56:13 +00:00
|
|
|
|
to a string. If several COMMANDs are given, the first one will be the default
|
|
|
|
|
and the rest will be added temporarily to the history and can be retrieved
|
|
|
|
|
with \\[previous-history-element] (M-p) .
|
|
|
|
|
|
2008-08-23 03:16:58 +00:00
|
|
|
|
The variable `dired-guess-shell-case-fold-search' controls whether
|
|
|
|
|
REGEXP is matched case-sensitively.
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
You can set this variable in your ~/.emacs. For example, to add rules for
|
|
|
|
|
`.foo' and `.bar' files, write
|
|
|
|
|
|
|
|
|
|
\(setq dired-guess-shell-alist-user
|
2011-07-11 13:46:46 +00:00
|
|
|
|
'((\"\\\\.foo\\\\'\" \"FOO-COMMAND\")
|
|
|
|
|
(\"\\\\.bar\\\\'\"
|
|
|
|
|
(if condition
|
|
|
|
|
\"BAR-COMMAND-1\"
|
|
|
|
|
\"BAR-COMMAND-2\"))))"
|
2001-01-03 21:21:20 +00:00
|
|
|
|
:group 'dired-x
|
|
|
|
|
:type '(alist :key-type regexp :value-type (repeat sexp)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-05-01 09:33:51 +00:00
|
|
|
|
(defcustom dired-guess-shell-case-fold-search t
|
|
|
|
|
"If non-nil, `dired-guess-shell-alist-default' and
|
|
|
|
|
`dired-guess-shell-alist-user' are matched case-insensitively."
|
|
|
|
|
:group 'dired-x
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-guess-default (files)
|
2011-07-11 13:38:58 +00:00
|
|
|
|
"Return a shell command, or a list of commands, appropriate for FILES.
|
2001-01-03 21:21:20 +00:00
|
|
|
|
See `dired-guess-shell-alist-user'."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-05-01 09:33:51 +00:00
|
|
|
|
(let* ((case-fold-search dired-guess-shell-case-fold-search)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; Prepend the user's alist to the default alist.
|
|
|
|
|
(alist (append dired-guess-shell-alist-user
|
|
|
|
|
dired-guess-shell-alist-default))
|
|
|
|
|
(file (car files))
|
|
|
|
|
(flist (cdr files))
|
|
|
|
|
elt regexp cmds)
|
|
|
|
|
|
|
|
|
|
;; Find the first match in the alist for first file in FILES.
|
|
|
|
|
(while alist
|
|
|
|
|
(setq elt (car alist)
|
|
|
|
|
regexp (car elt)
|
|
|
|
|
alist (cdr alist))
|
|
|
|
|
(if (string-match regexp file)
|
|
|
|
|
(setq cmds (cdr elt)
|
|
|
|
|
alist nil)))
|
|
|
|
|
|
|
|
|
|
;; If more than one file, see if all of FILES match regular expression.
|
|
|
|
|
(while (and flist
|
|
|
|
|
(string-match regexp (car flist)))
|
|
|
|
|
(setq flist (cdr flist)))
|
1994-04-06 00:51:43 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; If flist is still non-nil, then do not guess since this means that not
|
|
|
|
|
;; all the files in FILES were matched by the regexp.
|
|
|
|
|
(setq cmds (and (not flist) cmds))
|
|
|
|
|
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;; Return commands or nil if flist is still non-nil.
|
|
|
|
|
;; Evaluate the commands in order that any logical testing will be done.
|
2011-07-11 13:36:54 +00:00
|
|
|
|
(if (cdr cmds)
|
2011-07-12 07:26:48 +00:00
|
|
|
|
(delete-dups (mapcar #'eval cmds))
|
2011-07-11 13:36:54 +00:00
|
|
|
|
(eval (car cmds))))) ; single command
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(defun dired-guess-shell-command (prompt files)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Ask user with PROMPT for a shell command, guessing a default from FILES."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(let ((default (dired-guess-default files))
|
2007-10-22 00:22:56 +00:00
|
|
|
|
default-list val)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (null default)
|
|
|
|
|
;; Nothing to guess
|
2009-02-22 23:36:46 +00:00
|
|
|
|
(read-shell-command prompt nil 'dired-shell-command-history)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (listp default)
|
|
|
|
|
;; More than one guess
|
|
|
|
|
(setq default-list default
|
|
|
|
|
default (car default)
|
|
|
|
|
prompt (concat
|
|
|
|
|
prompt
|
|
|
|
|
(format "{%d guesses} " (length default-list))))
|
|
|
|
|
;; Just one guess
|
|
|
|
|
(setq default-list (list default)))
|
2007-10-22 00:22:56 +00:00
|
|
|
|
;; Put the first guess in the prompt but not in the initial value.
|
|
|
|
|
(setq prompt (concat prompt (format "[%s] " default)))
|
|
|
|
|
;; All guesses can be retrieved with M-n
|
2009-02-22 23:36:46 +00:00
|
|
|
|
(setq val (read-shell-command prompt nil
|
|
|
|
|
'dired-shell-command-history
|
|
|
|
|
default-list))
|
2007-10-22 00:22:56 +00:00
|
|
|
|
;; If we got a return, then return default.
|
|
|
|
|
(if (equal val "") default val))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; RELATIVE SYMBOLIC LINKS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2007-11-22 13:50:06 +00:00
|
|
|
|
(declare-function make-symbolic-link "fileio.c")
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defvar dired-keep-marker-relsymlink ?S
|
|
|
|
|
"See variable `dired-keep-marker-move'.")
|
|
|
|
|
|
|
|
|
|
(defun dired-make-relative-symlink (file1 file2 &optional ok-if-already-exists)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Make a symbolic link (pointing to FILE1) in FILE2.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
The link is relative (if possible), for example
|
|
|
|
|
|
|
|
|
|
\"/vol/tex/bin/foo\" \"/vol/local/bin/foo\"
|
|
|
|
|
|
|
|
|
|
results in
|
|
|
|
|
|
2001-01-03 21:21:20 +00:00
|
|
|
|
\"../../tex/bin/foo\" \"/vol/local/bin/foo\""
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive "FRelSymLink: \nFRelSymLink %s: \np")
|
|
|
|
|
(let (name1 name2 len1 len2 (index 0) sub)
|
|
|
|
|
(setq file1 (expand-file-name file1)
|
|
|
|
|
file2 (expand-file-name file2)
|
|
|
|
|
len1 (length file1)
|
|
|
|
|
len2 (length file2))
|
2003-01-14 23:11:19 +00:00
|
|
|
|
;; Find common initial file name components:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(let (next)
|
|
|
|
|
(while (and (setq next (string-match "/" file1 index))
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(< (setq next (1+ next)) (min len1 len2))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; For the comparison, both substrings must end in
|
|
|
|
|
;; `/', so NEXT is *one plus* the result of the
|
|
|
|
|
;; string-match.
|
|
|
|
|
;; E.g., consider the case of linking "/tmp/a/abc"
|
1996-01-04 23:32:11 +00:00
|
|
|
|
;; to "/tmp/abc" erroneously giving "/tmp/a" instead
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; of "/tmp/" as common initial component
|
|
|
|
|
(string-equal (substring file1 0 next)
|
|
|
|
|
(substring file2 0 next)))
|
|
|
|
|
(setq index next))
|
|
|
|
|
(setq name2 file2
|
|
|
|
|
sub (substring file1 0 index)
|
|
|
|
|
name1 (substring file1 index)))
|
|
|
|
|
(if (string-equal sub "/")
|
2003-01-14 23:11:19 +00:00
|
|
|
|
;; No common initial file name found
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(setq name1 file1)
|
|
|
|
|
;; Else they have a common parent directory
|
|
|
|
|
(let ((tem (substring file2 index))
|
|
|
|
|
(start 0)
|
|
|
|
|
(count 0))
|
|
|
|
|
;; Count number of slashes we must compensate for ...
|
|
|
|
|
(while (setq start (string-match "/" tem start))
|
|
|
|
|
(setq count (1+ count)
|
|
|
|
|
start (1+ start)))
|
|
|
|
|
;; ... and prepend a "../" for each slash found:
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(dotimes (_n count)
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(setq name1 (concat "../" name1)))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(make-symbolic-link
|
|
|
|
|
(directory-file-name name1) ; must not link to foo/
|
|
|
|
|
; (trailing slash!)
|
|
|
|
|
name2 ok-if-already-exists)))
|
|
|
|
|
|
2011-02-19 20:44:34 +00:00
|
|
|
|
(autoload 'dired-do-create-files "dired-aux")
|
|
|
|
|
|
2007-02-02 18:27:09 +00:00
|
|
|
|
;;;###autoload
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-do-relsymlink (&optional arg)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Relative symlink all marked (or next ARG) files into a directory.
|
|
|
|
|
Otherwise make a relative symbolic link to the current file.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
This creates relative symbolic links like
|
|
|
|
|
|
|
|
|
|
foo -> ../bar/foo
|
|
|
|
|
|
|
|
|
|
not absolute ones like
|
|
|
|
|
|
2007-02-02 14:51:30 +00:00
|
|
|
|
foo -> /ugly/file/name/that/may/change/any/day/bar/foo
|
|
|
|
|
|
2007-02-02 18:23:04 +00:00
|
|
|
|
For absolute symlinks, use \\[dired-do-symlink]."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive "P")
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(dired-do-create-files 'relsymlink #'dired-make-relative-symlink
|
1994-01-03 16:56:13 +00:00
|
|
|
|
"RelSymLink" arg dired-keep-marker-relsymlink))
|
|
|
|
|
|
2011-02-19 20:44:34 +00:00
|
|
|
|
(autoload 'dired-mark-read-regexp "dired-aux")
|
|
|
|
|
(autoload 'dired-do-create-files-regexp "dired-aux")
|
|
|
|
|
|
2005-07-16 11:40:58 +00:00
|
|
|
|
(defun dired-do-relsymlink-regexp (regexp newname &optional arg whole-name)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
"RelSymlink all marked files containing REGEXP to NEWNAME.
|
|
|
|
|
See functions `dired-do-rename-regexp' and `dired-do-relsymlink'
|
|
|
|
|
for more info."
|
|
|
|
|
(interactive (dired-mark-read-regexp "RelSymLink"))
|
|
|
|
|
(dired-do-create-files-regexp
|
2011-02-18 07:48:40 +00:00
|
|
|
|
#'dired-make-relative-symlink
|
2005-07-16 11:40:58 +00:00
|
|
|
|
"RelSymLink" arg regexp newname whole-name dired-keep-marker-relsymlink))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; VISIT ALL MARKED FILES SIMULTANEOUSLY.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Brief Description:
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; `dired-do-find-marked-files' is bound to `F' by dired-x.el.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Use `dired-get-marked-files' to collect the marked files in the current
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;; Dired Buffer into a list of filenames `FILE-LIST'.
|
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; `dired-do-find-marked-files''s prefix argument NOSELECT.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; list each time.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2009-09-24 01:37:14 +00:00
|
|
|
|
;; * If NOSELECT is non-nil then just run `find-file-noselect' on each
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; element of FILE-LIST.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * If NOSELECT is nil then calculate the `size' of the window for each file
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is
|
|
|
|
|
;;; cognizant of the window-configuration.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;;;
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; * If `size' is too small abort, otherwise run `find-file' on each element
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; of FILE-LIST giving each a window of height `size'.
|
|
|
|
|
|
|
|
|
|
(defun dired-do-find-marked-files (&optional noselect)
|
|
|
|
|
"Find all marked files displaying all of them simultaneously.
|
|
|
|
|
With optional NOSELECT just find files but do not select them.
|
|
|
|
|
|
|
|
|
|
The current window is split across all files marked, as evenly as possible.
|
|
|
|
|
Remaining lines go to bottom-most window. The number of files that can be
|
|
|
|
|
displayed this way is restricted by the height of the current window and
|
|
|
|
|
`window-min-height'.
|
|
|
|
|
|
2011-10-30 01:56:03 +00:00
|
|
|
|
To keep dired buffer displayed, type \\[split-window-below] first.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
To display just marked files, type \\[delete-other-windows] first."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(dired-simultaneous-find-file (dired-get-marked-files) noselect))
|
|
|
|
|
|
|
|
|
|
(defun dired-simultaneous-find-file (file-list noselect)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Visit all files in FILE-LIST and display them simultaneously.
|
|
|
|
|
The current window is split across all files in FILE-LIST, as evenly as
|
|
|
|
|
possible. Remaining lines go to the bottom-most window. The number of
|
|
|
|
|
files that can be displayed this way is restricted by the height of the
|
|
|
|
|
current window and the variable `window-min-height'. With non-nil
|
|
|
|
|
NOSELECT the files are merely found but not selected."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; We don't make this function interactive because it is usually too clumsy
|
|
|
|
|
;; to specify FILE-LIST interactively unless via dired.
|
|
|
|
|
(let (size)
|
|
|
|
|
(if noselect
|
|
|
|
|
;; Do not select the buffer.
|
|
|
|
|
(find-file-noselect (car file-list))
|
|
|
|
|
;; We will have to select the buffer. Calculate and check window size.
|
|
|
|
|
(setq size (/ (window-height) (length file-list)))
|
|
|
|
|
(or (<= window-min-height size)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
(error "Too many files to visit simultaneously. Try C-u prefix"))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(find-file (car file-list)))
|
|
|
|
|
;; Decrement.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(dolist (file (cdr file-list))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if noselect
|
|
|
|
|
;; Do not select the buffer.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(find-file-noselect file)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;; Vertically split off a window of desired size. Upper window will
|
|
|
|
|
;; have SIZE lines. Select lower (larger) window. We split it again.
|
|
|
|
|
(select-window (split-window nil size))
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(find-file file)))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; MISCELLANEOUS COMMANDS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Run man on files.
|
1994-04-06 00:51:43 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(declare-function Man-getpage-in-background "man" (topic))
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defvar manual-program) ; from man.el
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-man ()
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Run `man' on this file."
|
|
|
|
|
;; Used also to say: "Display old buffer if buffer name matches filename."
|
|
|
|
|
;; but I have no idea what that means.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
1994-06-13 19:34:21 +00:00
|
|
|
|
(require 'man)
|
2004-03-23 07:38:57 +00:00
|
|
|
|
(let* ((file (dired-get-filename))
|
|
|
|
|
(manual-program (replace-regexp-in-string "\\*" "%s"
|
|
|
|
|
(dired-guess-shell-command
|
|
|
|
|
"Man command: " (list file)))))
|
1994-06-13 19:34:21 +00:00
|
|
|
|
(Man-getpage-in-background file)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Run Info on files.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
(defun dired-info ()
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Run `info' on this file."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(info (dired-get-filename)))
|
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Run mail on mail folders.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(declare-function vm-visit-folder "ext:vm" (folder &optional read-only))
|
|
|
|
|
(defvar vm-folder-directory)
|
1994-04-06 00:51:43 +00:00
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-vm (&optional read-only)
|
|
|
|
|
"Run VM on this file.
|
2011-02-16 08:32:30 +00:00
|
|
|
|
With optional prefix argument, visits the folder read-only.
|
|
|
|
|
Otherwise obeys the value of `dired-vm-read-only-folders'."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((dir (dired-current-directory))
|
|
|
|
|
(fil (dired-get-filename)))
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(vm-visit-folder fil (or read-only
|
|
|
|
|
(eq t dired-vm-read-only-folders)
|
|
|
|
|
(and dired-vm-read-only-folders
|
|
|
|
|
(not (file-writable-p fil)))))
|
|
|
|
|
;; So that pressing `v' inside VM does prompt within current directory:
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(set (make-local-variable 'vm-folder-directory) dir)))
|
|
|
|
|
|
|
|
|
|
(defun dired-rmail ()
|
|
|
|
|
"Run RMAIL on this file."
|
|
|
|
|
(interactive)
|
|
|
|
|
(rmail (dired-get-filename)))
|
|
|
|
|
|
|
|
|
|
(defun dired-do-run-mail ()
|
2011-02-17 04:50:47 +00:00
|
|
|
|
"If `dired-bind-vm' is non-nil, call `dired-vm', else call `dired-rmail'."
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if dired-bind-vm
|
|
|
|
|
;; Read mail folder using vm.
|
|
|
|
|
(dired-vm)
|
|
|
|
|
;; Read mail folder using rmail.
|
|
|
|
|
(dired-rmail)))
|
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; MISCELLANEOUS INTERNAL FUNCTIONS.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; This should be a builtin
|
|
|
|
|
(defun dired-buffer-more-recently-used-p (buffer1 buffer2)
|
2011-02-16 08:32:30 +00:00
|
|
|
|
"Return t if BUFFER1 is more recently used than BUFFER2.
|
|
|
|
|
Considers buffers closer to the car of `buffer-list' to be more recent."
|
|
|
|
|
(and (not (equal buffer1 buffer2))
|
|
|
|
|
(memq buffer1 (buffer-list))
|
|
|
|
|
(not (memq buffer1 (memq buffer2 (buffer-list))))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2008-05-08 14:46:34 +00:00
|
|
|
|
;; Same thing as `dired-buffers-for-dir' of dired.el? - lrd 11/23/93
|
|
|
|
|
;; (defun dired-buffers-for-dir-exact (dir)
|
|
|
|
|
;; ;; Return a list of buffers that dired DIR (a directory or wildcard)
|
|
|
|
|
;; ;; at top level, or as subdirectory.
|
|
|
|
|
;; ;; Top level matches must match the wildcard part too, if any.
|
|
|
|
|
;; ;; The list is in reverse order of buffer creation, most recent last.
|
|
|
|
|
;; ;; As a side effect, killed dired buffers for DIR are removed from
|
|
|
|
|
;; ;; dired-buffers.
|
|
|
|
|
;; (let ((alist dired-buffers) result elt)
|
|
|
|
|
;; (while alist
|
|
|
|
|
;; (setq elt (car alist)
|
|
|
|
|
;; alist (cdr alist))
|
|
|
|
|
;; (let ((buf (cdr elt)))
|
|
|
|
|
;; (if (buffer-name buf)
|
|
|
|
|
;; ;; Top level must match exactly against dired-directory in
|
|
|
|
|
;; ;; case one of them is a wildcard.
|
|
|
|
|
;; (if (or (equal dir (with-current-buffer buf dired-directory))
|
|
|
|
|
;; (assoc dir (with-current-buffer buf dired-subdir-alist)))
|
|
|
|
|
;; (setq result (cons buf result)))
|
|
|
|
|
;; ;; else buffer is killed - clean up:
|
|
|
|
|
;; (setq dired-buffers (delq elt dired-buffers)))))
|
|
|
|
|
;; result))
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
;; Does anyone use this? - lrd 6/29/93.
|
1997-12-22 22:09:22 +00:00
|
|
|
|
;; Apparently people do use it. - lrd 12/22/97.
|
2011-04-19 13:44:55 +00:00
|
|
|
|
|
|
|
|
|
(with-no-warnings
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; Warnings are suppressed to avoid "global/dynamic var `X' lacks a prefix".
|
2011-04-19 13:44:55 +00:00
|
|
|
|
;; This is unbearably ugly, but not more than having global variables
|
|
|
|
|
;; named size, time, name or s, however practical it can be while writing
|
|
|
|
|
;; `dired-mark-sexp' predicates.
|
|
|
|
|
(defvar inode)
|
|
|
|
|
(defvar s)
|
|
|
|
|
(defvar mode)
|
|
|
|
|
(defvar nlink)
|
|
|
|
|
(defvar uid)
|
|
|
|
|
(defvar gid)
|
|
|
|
|
(defvar size)
|
|
|
|
|
(defvar time)
|
|
|
|
|
(defvar name)
|
|
|
|
|
(defvar sym))
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(defun dired-mark-sexp (predicate &optional unflag-p)
|
|
|
|
|
"Mark files for which PREDICATE returns non-nil.
|
2011-07-06 17:10:36 +00:00
|
|
|
|
With a prefix arg, unmark or unflag those files instead.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
PREDICATE is a lisp expression that can refer to the following symbols:
|
|
|
|
|
|
|
|
|
|
inode [integer] the inode of the file (only for ls -i output)
|
|
|
|
|
s [integer] the size of the file for ls -s output
|
1996-01-04 23:32:11 +00:00
|
|
|
|
(usually in blocks or, with -k, in KByte)
|
1994-01-03 16:56:13 +00:00
|
|
|
|
mode [string] file permission bits, e.g. \"-rw-r--r--\"
|
|
|
|
|
nlink [integer] number of links to file
|
|
|
|
|
uid [string] owner
|
|
|
|
|
gid [string] group (If the gid is not displayed by ls,
|
|
|
|
|
this will still be set (to the same as uid))
|
|
|
|
|
size [integer] file size in bytes
|
|
|
|
|
time [string] the time that ls displays, e.g. \"Feb 12 14:17\"
|
|
|
|
|
name [string] the name of the file
|
|
|
|
|
sym [string] if file is a symbolic link, the linked-to name, else \"\"
|
|
|
|
|
|
|
|
|
|
For example, use
|
|
|
|
|
|
|
|
|
|
(equal 0 size)
|
|
|
|
|
|
|
|
|
|
to mark all zero length files."
|
|
|
|
|
;; Using sym="" instead of nil avoids the trap of
|
|
|
|
|
;; (string-match "foo" sym) into which a user would soon fall.
|
|
|
|
|
;; Give `equal' instead of `=' in the example, as this works on
|
|
|
|
|
;; integers and strings.
|
|
|
|
|
(interactive "xMark if (lisp expr): \nP")
|
|
|
|
|
(message "%s" predicate)
|
|
|
|
|
(let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))
|
|
|
|
|
inode s mode nlink uid gid size time name sym)
|
|
|
|
|
(dired-mark-if
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and
|
|
|
|
|
;; Sets vars
|
|
|
|
|
;; inode s mode nlink uid gid size time name sym
|
|
|
|
|
|
|
|
|
|
;; according to current file line. Returns t for success, nil if
|
|
|
|
|
;; there is no file line. Upon success, all variables are set, either
|
|
|
|
|
;; to nil or the appropriate value, so they need not be initialized.
|
|
|
|
|
;; Moves point within the current line.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(dired-move-to-filename)
|
|
|
|
|
(let (pos
|
|
|
|
|
(mode-len 10) ; length of mode string
|
|
|
|
|
;; like in dired.el, but with subexpressions \1=inode, \2=s:
|
|
|
|
|
(dired-re-inode-size "\\s *\\([0-9]*\\)\\s *\\([0-9]*\\) ?"))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(forward-char 2)
|
|
|
|
|
(if (looking-at dired-re-inode-size)
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(setq inode (string-to-number
|
|
|
|
|
(buffer-substring (match-beginning 1)
|
|
|
|
|
(match-end 1)))
|
|
|
|
|
s (string-to-number
|
|
|
|
|
(buffer-substring (match-beginning 2)
|
|
|
|
|
(match-end 2)))))
|
|
|
|
|
(setq inode nil
|
|
|
|
|
s nil))
|
|
|
|
|
(setq mode (buffer-substring (point) (+ mode-len (point))))
|
|
|
|
|
(forward-char mode-len)
|
|
|
|
|
(setq nlink (read (current-buffer)))
|
|
|
|
|
;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid.
|
|
|
|
|
(setq uid (buffer-substring (1+ (point))
|
|
|
|
|
(progn (forward-word 1) (point))))
|
|
|
|
|
(re-search-forward directory-listing-before-filename-regexp)
|
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
(setq size (string-to-number
|
|
|
|
|
(buffer-substring (save-excursion
|
|
|
|
|
(backward-word 1)
|
|
|
|
|
(setq pos (point)))
|
|
|
|
|
(point))))
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(backward-word 1)
|
|
|
|
|
;; if no gid is displayed, gid will be set to uid
|
|
|
|
|
;; but user will then not reference it anyway in PREDICATE.
|
|
|
|
|
(setq gid (buffer-substring (save-excursion
|
|
|
|
|
(forward-word 1) (point))
|
|
|
|
|
(point))
|
|
|
|
|
time (buffer-substring (match-beginning 1)
|
|
|
|
|
(1- (dired-move-to-filename)))
|
|
|
|
|
name (buffer-substring (point)
|
|
|
|
|
(or
|
|
|
|
|
(dired-move-to-end-of-filename t)
|
|
|
|
|
(point)))
|
|
|
|
|
sym (if (looking-at " -> ")
|
|
|
|
|
(buffer-substring (progn (forward-char 4) (point))
|
|
|
|
|
(line-end-position))
|
|
|
|
|
""))
|
|
|
|
|
t)
|
|
|
|
|
(eval predicate)))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(format "'%s file" predicate))))
|
|
|
|
|
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; FIND FILE AT POINT.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(defcustom dired-x-hands-off-my-keys t
|
2011-02-18 07:48:40 +00:00
|
|
|
|
"Non-nil means don't remap `find-file' to `dired-x-find-file'.
|
|
|
|
|
Similarly for `find-file-other-window' and `dired-x-find-file-other-window'.
|
2011-02-14 01:27:56 +00:00
|
|
|
|
If you change this variable without using \\[customize] after `dired-x.el'
|
|
|
|
|
is loaded then call \\[dired-x-bind-find-file]."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:initialize 'custom-initialize-default
|
2011-04-19 13:44:55 +00:00
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(set symbol value)
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(dired-x-bind-find-file))
|
|
|
|
|
:group 'dired-x)
|
1994-06-28 18:41:05 +00:00
|
|
|
|
|
|
|
|
|
(defun dired-x-bind-find-file ()
|
2011-02-18 07:48:40 +00:00
|
|
|
|
"Bind `dired-x-find-file' in place of `find-file' (or vice-versa).
|
1994-06-28 18:41:05 +00:00
|
|
|
|
Similarly for `dired-x-find-file-other-window' and `find-file-other-window'.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
Binding direction based on `dired-x-hands-off-my-keys'."
|
1994-06-28 18:41:05 +00:00
|
|
|
|
(interactive)
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
1994-06-28 18:41:05 +00:00
|
|
|
|
(setq dired-x-hands-off-my-keys
|
|
|
|
|
(not (y-or-n-p "Bind dired-x-find-file over find-file? "))))
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(define-key (current-global-map) [remap find-file]
|
|
|
|
|
(if (not dired-x-hands-off-my-keys) 'dired-x-find-file))
|
|
|
|
|
(define-key (current-global-map) [remap find-file-other-window]
|
|
|
|
|
(if (not dired-x-hands-off-my-keys) 'dired-x-find-file-other-window)))
|
|
|
|
|
|
|
|
|
|
;; Now call it so binding is correct. This could go in the :initialize
|
|
|
|
|
;; slot, but then dired-x-bind-find-file has to be defined before the
|
|
|
|
|
;; defcustom, and we get free variable warnings.
|
1994-06-28 18:41:05 +00:00
|
|
|
|
(dired-x-bind-find-file)
|
|
|
|
|
|
|
|
|
|
(defun dired-x-find-file (filename)
|
|
|
|
|
"Edit file FILENAME.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
Like `find-file', except that when called interactively with a
|
|
|
|
|
prefix argument, it offers the filename near point as a default."
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(interactive (list (dired-x-read-filename-at-point "Find file: ")))
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(find-file filename))
|
1994-06-28 18:41:05 +00:00
|
|
|
|
|
|
|
|
|
(defun dired-x-find-file-other-window (filename)
|
|
|
|
|
"Edit file FILENAME, in another window.
|
2011-02-18 07:48:40 +00:00
|
|
|
|
Like `find-file-other-window', except that when called interactively with
|
|
|
|
|
a prefix argument, when it offers the filename near point as a default."
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(interactive (list (dired-x-read-filename-at-point "Find file: ")))
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(find-file-other-window filename))
|
1994-06-28 18:41:05 +00:00
|
|
|
|
|
|
|
|
|
;;; Internal functions.
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2003-01-27 11:36:08 +00:00
|
|
|
|
;; Fixme: This should probably use `thing-at-point'. -- fx
|
2003-01-15 19:46:07 +00:00
|
|
|
|
(defun dired-filename-at-point ()
|
2011-02-17 04:50:47 +00:00
|
|
|
|
"Return the filename closest to point, expanded.
|
|
|
|
|
Point should be in or after a filename."
|
2011-02-18 07:48:40 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
;; First see if just past a filename.
|
|
|
|
|
(or (eobp) ; why?
|
|
|
|
|
(when (looking-at "[] \t\n[{}()]") ; whitespace or some parens
|
|
|
|
|
(skip-chars-backward " \n\t\r({[]})")
|
|
|
|
|
(or (bobp) (backward-char 1))))
|
|
|
|
|
(let ((filename-chars "-.[:alnum:]_/:$+@")
|
|
|
|
|
start prefix)
|
2011-02-17 04:50:47 +00:00
|
|
|
|
(if (looking-at (format "[%s]" filename-chars))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(progn
|
2011-02-17 04:50:47 +00:00
|
|
|
|
(skip-chars-backward filename-chars)
|
|
|
|
|
(setq start (point)
|
|
|
|
|
prefix
|
|
|
|
|
;; This is something to do with ange-ftp filenames.
|
|
|
|
|
;; It convert foo@bar to /foo@bar.
|
|
|
|
|
;; But when does the former occur in dired buffers?
|
2003-01-27 11:36:08 +00:00
|
|
|
|
(and (string-match
|
|
|
|
|
"^\\w+@"
|
2011-02-17 04:38:23 +00:00
|
|
|
|
(buffer-substring start (line-end-position)))
|
2000-03-01 10:27:54 +00:00
|
|
|
|
"/"))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(if (string-match "[/~]" (char-to-string (preceding-char)))
|
|
|
|
|
(setq start (1- start)))
|
2011-02-17 04:50:47 +00:00
|
|
|
|
(skip-chars-forward filename-chars))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
(error "No file found around point!"))
|
1994-04-06 00:51:43 +00:00
|
|
|
|
;; Return string.
|
2000-03-01 10:27:54 +00:00
|
|
|
|
(expand-file-name (concat prefix (buffer-substring start (point)))))))
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-16 08:32:30 +00:00
|
|
|
|
(defun dired-x-read-filename-at-point (prompt)
|
2001-01-03 21:21:20 +00:00
|
|
|
|
"Return filename prompting with PROMPT with completion.
|
|
|
|
|
If `current-prefix-arg' is non-nil, uses name at point as guess."
|
1994-06-28 18:41:05 +00:00
|
|
|
|
(if current-prefix-arg
|
|
|
|
|
(let ((guess (dired-filename-at-point)))
|
|
|
|
|
(read-file-name prompt
|
|
|
|
|
(file-name-directory guess)
|
|
|
|
|
guess
|
|
|
|
|
nil (file-name-nondirectory guess)))
|
|
|
|
|
(read-file-name prompt default-directory)))
|
2011-02-16 08:32:30 +00:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'read-filename-at-point
|
|
|
|
|
'dired-x-read-filename-at-point "24.1") ; is this even needed?
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; BUG REPORTS
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
2011-02-14 01:27:56 +00:00
|
|
|
|
(define-obsolete-function-alias 'dired-x-submit-report 'report-emacs-bug "24.1")
|
1994-01-03 16:56:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; As Barry Warsaw would say: "This might be useful..."
|
|
|
|
|
(provide 'dired-x)
|
|
|
|
|
|
2009-09-11 06:50:14 +00:00
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; byte-compile-dynamic: t
|
|
|
|
|
;; generated-autoload-file: "dired.el"
|
|
|
|
|
;; End:
|
|
|
|
|
|
1994-01-03 16:56:13 +00:00
|
|
|
|
;;; dired-x.el ends here
|