From f5d6548ac93ed6b2c5eb06bfe93e2f531ddd72e0 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 21 May 2010 00:33:58 +0300 Subject: [PATCH] * dired-x.el (dired-jump, dired-jump-other-window): Add arg FILE-NAME to read from the minibuffer when called interactively with prefix argument instead of using buffer-file-name. http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00534.html * dired.el: Update autoloads. --- etc/NEWS | 5 +++++ lisp/ChangeLog | 9 +++++++++ lisp/dired-x.el | 23 +++++++++++++++-------- lisp/dired.el | 7 +++++-- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 0d07a160ac1..1c7d9268e5d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -147,6 +147,11 @@ Use the arrow to the left of the option name to toggle visibility. *** The color widget now has a "Choose" button, which allows you to choose a color via list-colors-display. +** Dired-x + +*** dired-jump and dired-jump-other-window called with a prefix argument +read a file name from the minibuffer instead of using buffer-file-name. + ** VC and related modes *** New VC commands: vc-log-incoming, vc-log-outgoing, vc-find-conflicted-file. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b7c5c5827e8..b54d50d79fa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2010-05-20 Juri Linkov + + * dired-x.el (dired-jump, dired-jump-other-window): Add arg + FILE-NAME to read from the minibuffer when called interactively + with prefix argument instead of using buffer-file-name. + http://lists.gnu.org/archive/html/emacs-devel/2010-05/msg00534.html + + * dired.el: Update autoloads. + 2010-05-20 Chong Yidong * nxml/nxml-mode.el (nxml-mode-map): Bind C-c / to diff --git a/lisp/dired-x.el b/lisp/dired-x.el index aba4b7a7a9d..2dc7475e9e3 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -506,16 +506,21 @@ See variables `dired-texinfo-unclean-extensions', ;;; JUMP. ;;;###autoload -(defun dired-jump (&optional other-window) +(defun dired-jump (&optional other-window file-name) "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." - (interactive "P") - (let* ((file buffer-file-name) +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)) (dir (if file (file-name-directory file) default-directory))) - (if (eq major-mode 'dired-mode) + (if (and (eq major-mode 'dired-mode) (null file-name)) (progn (setq dir (dired-current-directory)) (dired-up-directory other-window) @@ -539,10 +544,12 @@ buffer and try again." (dired-omit-mode) (dired-goto-file file)))))))) -(defun dired-jump-other-window () +(defun dired-jump-other-window (&optional file-name) "Like \\[dired-jump] (`dired-jump') but in other window." - (interactive) - (dired-jump t)) + (interactive + (list (and current-prefix-arg + (read-file-name "Jump to dired file: ")))) + (dired-jump t file-name)) ;;; OMITTING. diff --git a/lisp/dired.el b/lisp/dired.el index 0dc53bf32c4..ae9915698de 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3974,7 +3974,7 @@ true then the type of the file linked to by FILE is printed instead. ;;;*** ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el" -;;;;;; "2f8d3d5a31b969b181e23c40d6bb16a0") +;;;;;; "6c492aba3ca0d36a4cd7b02fb9c1cc10") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\ @@ -3983,8 +3983,11 @@ 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. +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. -\(fn &optional OTHER-WINDOW)" t nil) +\(fn &optional OTHER-WINDOW FILE-NAME)" t nil) (autoload 'dired-do-relsymlink "dired-x" "\ Relative symlink all marked (or next ARG) files into a directory. -- 2.11.4.GIT