Go to the previous, next section.
This manual describes the dired features provided by the file `dired-x.el'. To take advantage of these features, you must load the file and (optionally) set some variables.
In your `.emacs' file in your home directory, or in the system-wide initialization file `default.el' in the `site-lisp' directory, put
(add-hook 'dired-load-hook (function (lambda () (load "dired-x") ;; Set dired-x global variables here. For example: ;; (setq dired-guess-shell-gnutar "gtar") ;; (setq dired-x-hands-off-my-keys nil) ))) (add-hook 'dired-mode-hook (function (lambda () ;; Set dired-x buffer-local variables here. For example: ;; (setq dired-omit-files-p t) )))
This will load `dired-x.el' when dired is first invoked (for example, when you first do C-x d).
In order to have
(See section Miscellaneous Commands) work before
dired-x have been properly loaded the user should set-up an autoload
for these functions. In your `.emacs' file put
;;; Autoload `dired-jump' and `dired-jump-other-window'. ;;; We autoload from FILE dired.el. This will then load dired-x.el ;;; and hence define `dired-jump' and `dired-jump-other-window'. (define-key global-map "\C-x\C-j" 'dired-jump) (define-key global-map "\C-x4\C-j" 'dired-jump-other-window) (autoload (quote dired-jump) "dired" "\ Jump to dired buffer corresponding to current buffer. If in a file, dired the current directory and move to file's line. If in dired already, pop up a level and goto old directory's line. In case the proper dired file line cannot be found, refresh the dired buffer and try again." t nil) (autoload (quote dired-jump-other-window) "dired" "\ Like \\[dired-jump] (dired-jump) but in other window." t nil)
Note that in recent releases of GNU Emacs 19 (i.e., 19.25 or later) the file
`../lisp/loaddefs.el' of the Emacs distribution already contains the
proper auto-loading for
dired-jump so you need only put
(define-key global-map "\C-x\C-j" 'dired-jump)
in your `.emacs' file in order to have C-x C-j work
dired is loaded.
If you choose to have `dired-x.el' bind
find-file (See section Find File At Point), then you will need to set
dired-x-hands-off-my-keys and make a call to the function
dired-x-bind-find-file in the
(add-hook 'dired-load-hook (function (lambda () (load "dired-x") ;; Bind dired-x-find-file. (setq dired-x-hands-off-my-keys nil) ;; Make sure our binding preference is invoked. (dired-x-bind-find-file) )))
Alternatively, you can set the variable before `dired-x.el' is loaded
(add-hook 'dired-load-hook (function (lambda () ;; Bind dired-x-find-file. (setq dired-x-hands-off-my-keys nil) (load "dired-x") )))
If `dired-x.el' was not bundled with the version of GNU Emacs
installed at your site (i.e., not in the default `../lisp' directory)
then you must put the file `dired-x.el' in a directory known to GNU
Emacs. Examine the variable
load-path for a list of these directories.
If you wish to add a new directory on this list of directories use something
like this in your `.emacs' file
;;; LOAD PATH (setq load-path (append load-path ; default at top (list "/the/directory/where/you/put/dired-x")))
If you wish to put the new directory at the head of the list (where it will be found first) then you should use instead
;;; LOAD PATH (setq load-path (append (list "/the/directory/where/you/put/dired-x") load-path)) ; default at bottom
You must also byte compile the file (for example, hitting B in
dired-mode). When byte-compiling `dired-x.el' you may get
messages about functions
reporter-submit-bug-report not being defined. These are warnings
and should be ignored.
CAUTION: If you are using a version of GNU Emacs earlier than 19.20
than you may have to edit `dired.el'. The copy of `dired.el' in GNU
Emacs versions earlier than 19.20 incorrectly had the call to
before the call to
provide. In such a case, it is possible that
byte-compiling and/or loading dired can cause an infinite loop. To prevent
this, make sure the line of code
is the last executable line in the file `dired.el'. That is, make sure it comes after the line
Go to the previous, next section.