diff options
| author | Richard M. Stallman | 1998-04-28 23:40:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-04-28 23:40:39 +0000 |
| commit | 61154252277af5543924c15b2b63e522f65fef83 (patch) | |
| tree | ec2fff28fa91c90219c814391c2853bc5684082f | |
| parent | cea6021b073e11280b57ab4bcc8efa4bf76e2018 (diff) | |
| download | emacs-61154252277af5543924c15b2b63e522f65fef83.tar.gz emacs-61154252277af5543924c15b2b63e522f65fef83.zip | |
(dired-at-point): Add autoload cookie.
(dired-at-point-require-prefix): New option.
(dired-at-point): New command.
(dired-at-point-prompter): New function.
| -rw-r--r-- | lisp/ffap.el | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el index caacd4bc5e7..762b17dae44 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el | |||
| @@ -1624,6 +1624,52 @@ Only intended for interactive use." | |||
| 1624 | (interactive) (ffap-gnus-wrapper '(ffap-menu))) | 1624 | (interactive) (ffap-gnus-wrapper '(ffap-menu))) |
| 1625 | 1625 | ||
| 1626 | 1626 | ||
| 1627 | (defcustom dired-at-point-require-prefix nil | ||
| 1628 | "*If set, reverses the prefix argument to `dired-at-point'. | ||
| 1629 | This is nil so neophytes notice ffap. Experts may prefer to disable | ||
| 1630 | ffap most of the time." | ||
| 1631 | :type 'boolean | ||
| 1632 | :group 'ffap | ||
| 1633 | :version "20.3") | ||
| 1634 | |||
| 1635 | ;;;###autoload | ||
| 1636 | (defun dired-at-point (&optional filename) | ||
| 1637 | "Start Dired, defaulting to file at point. See `ffap'." | ||
| 1638 | (interactive) | ||
| 1639 | (if (and (interactive-p) | ||
| 1640 | (if dired-at-point-require-prefix | ||
| 1641 | (not current-prefix-arg) | ||
| 1642 | current-prefix-arg)) | ||
| 1643 | (let (current-prefix-arg) ; already interpreted | ||
| 1644 | (call-interactively dired-function)) | ||
| 1645 | (or filename (setq filename (dired-at-point-prompter))) | ||
| 1646 | (cond | ||
| 1647 | ((ffap-url-p filename) | ||
| 1648 | (funcall ffap-url-fetcher filename)) | ||
| 1649 | ((and ffap-dired-wildcards | ||
| 1650 | (string-match ffap-dired-wildcards filename)) | ||
| 1651 | (dired filename)) | ||
| 1652 | ((file-exists-p filename) | ||
| 1653 | (if (file-directory-p filename) | ||
| 1654 | (dired (expand-file-name filename)) | ||
| 1655 | (dired (concat (expand-file-name filename) "*")))) | ||
| 1656 | ((y-or-n-p "Directory does not exist, create it? ") | ||
| 1657 | (make-directory filename) | ||
| 1658 | (dired filename)) | ||
| 1659 | ((error "No such file or directory `%s'" filename))))) | ||
| 1660 | |||
| 1661 | (defun dired-at-point-prompter (&optional guess) | ||
| 1662 | ;; Does guess and prompt step for find-file-at-point. | ||
| 1663 | ;; Extra complication for the temporary highlighting. | ||
| 1664 | (unwind-protect | ||
| 1665 | (ffap-read-file-or-url | ||
| 1666 | (if ffap-url-regexp "Dired file or URL: " "Dired file: ") | ||
| 1667 | (prog1 | ||
| 1668 | (setq guess (or guess (ffap-guesser))) | ||
| 1669 | (and guess (ffap-highlight)) | ||
| 1670 | )) | ||
| 1671 | (ffap-highlight t))) | ||
| 1672 | |||
| 1627 | ;;; Offer default global bindings (`ffap-bindings'): | 1673 | ;;; Offer default global bindings (`ffap-bindings'): |
| 1628 | 1674 | ||
| 1629 | (defvar ffap-bindings | 1675 | (defvar ffap-bindings |