Mercurial > emacs
comparison lisp/dired-x.el @ 109859:68616bb3ae25
merged from trunk
author | Joakim <joakim@localhost.localdomain> |
---|---|
date | Mon, 14 Jun 2010 11:48:51 +0200 |
parents | 5b835c23f034 |
children | 280c8ae2476d |
comparison
equal
deleted
inserted
replaced
109858:73108272ef0b | 109859:68616bb3ae25 |
---|---|
504 (list ".dvi")))) | 504 (list ".dvi")))) |
505 | 505 |
506 ;;; JUMP. | 506 ;;; JUMP. |
507 | 507 |
508 ;;;###autoload | 508 ;;;###autoload |
509 (defun dired-jump (&optional other-window) | 509 (defun dired-jump (&optional other-window file-name) |
510 "Jump to dired buffer corresponding to current buffer. | 510 "Jump to dired buffer corresponding to current buffer. |
511 If in a file, dired the current directory and move to file's line. | 511 If in a file, dired the current directory and move to file's line. |
512 If in Dired already, pop up a level and goto old directory's line. | 512 If in Dired already, pop up a level and goto old directory's line. |
513 In case the proper dired file line cannot be found, refresh the dired | 513 In case the proper dired file line cannot be found, refresh the dired |
514 buffer and try again." | 514 buffer and try again. |
515 (interactive "P") | 515 When OTHER-WINDOW is non-nil, jump to dired buffer in other window. |
516 (let* ((file buffer-file-name) | 516 Interactively with prefix argument, read FILE-NAME and |
517 move to its line in dired." | |
518 (interactive | |
519 (list nil (and current-prefix-arg | |
520 (read-file-name "Jump to dired file: ")))) | |
521 (let* ((file (or file-name buffer-file-name)) | |
517 (dir (if file (file-name-directory file) default-directory))) | 522 (dir (if file (file-name-directory file) default-directory))) |
518 (if (eq major-mode 'dired-mode) | 523 (if (and (eq major-mode 'dired-mode) (null file-name)) |
519 (progn | 524 (progn |
520 (setq dir (dired-current-directory)) | 525 (setq dir (dired-current-directory)) |
521 (dired-up-directory other-window) | 526 (dired-up-directory other-window) |
522 (or (dired-goto-file dir) | 527 (or (dired-goto-file dir) |
523 ;; refresh and try again | 528 ;; refresh and try again |
537 (if dired-omit-mode | 542 (if dired-omit-mode |
538 (progn | 543 (progn |
539 (dired-omit-mode) | 544 (dired-omit-mode) |
540 (dired-goto-file file)))))))) | 545 (dired-goto-file file)))))))) |
541 | 546 |
542 (defun dired-jump-other-window () | 547 (defun dired-jump-other-window (&optional file-name) |
543 "Like \\[dired-jump] (`dired-jump') but in other window." | 548 "Like \\[dired-jump] (`dired-jump') but in other window." |
544 (interactive) | 549 (interactive |
545 (dired-jump t)) | 550 (list (and current-prefix-arg |
551 (read-file-name "Jump to dired file: ")))) | |
552 (dired-jump t file-name)) | |
546 | 553 |
547 ;;; OMITTING. | 554 ;;; OMITTING. |
548 | 555 |
549 ;; Enhanced omitting of lines from directory listings. | 556 ;; Enhanced omitting of lines from directory listings. |
550 ;; Marked files are never omitted. | 557 ;; Marked files are never omitted. |