Function: ffap-at-mouse
ffap-at-mouse is an autoloaded, interactive and byte-compiled function
defined in ffap.el.gz.
Signature
(ffap-at-mouse E)
Documentation
Find file or URL guessed from text around mouse click.
Interactively, calls ffap-at-mouse-fallback if no guess is found.
Return value:
* if a guess string is found, return it (after finding it)
* if the fallback is called, return whatever it returns
* otherwise, nil
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/ffap.el.gz
;;;###autoload
(defun ffap-at-mouse (e)
"Find file or URL guessed from text around mouse click.
Interactively, calls `ffap-at-mouse-fallback' if no guess is found.
Return value:
* if a guess string is found, return it (after finding it)
* if the fallback is called, return whatever it returns
* otherwise, nil"
(interactive "e")
(let ((guess
;; Maybe less surprising without the save-excursion?
(save-excursion
(mouse-set-point e)
;; Would prefer to do nothing unless click was *on* text. How
;; to tell that the click was beyond the end of current line?
(ffap-guesser))))
(cond
(guess
(set-buffer (window-buffer (car (event-start e))))
(ffap-highlight)
(unwind-protect
(progn
(sit-for 0) ; display
(message "Finding `%s'" guess)
(find-file-at-point guess)
guess) ; success: return non-nil
(ffap-highlight t)))
((called-interactively-p 'interactive)
(if ffap-at-mouse-fallback
(call-interactively ffap-at-mouse-fallback)
(message "No file or URL found at mouse click.")
nil)) ; no fallback, return nil
;; failure: return nil
)))