If I remember right, you sometimes use Icicles.
If so, then anytime you are in the minibuffer, you can use
M-. to insert text from the buffer, at point, or in fact text derived from that text. Page Inserting Text from Cursor of the Icicles doc describes this feature.
The behavior of
M-. is governed by user options
In particular, if library
ffap.el is loaded then option
ffap-guesser as one of its text-grabbing functions.
This means that you can use
M-. to grab
/home/pythonnut/.emacs.d/modules/config-company.el into the minibuffer when the cursor is on the library name
config-company in the buffer text
You can customize
icicle-thing-at-point-functions to move the position of
ffap-guesser sooner or later in the list of text-grabbing functions that are used when you use
Updated after your comment -
So are you asking for a command that copies to the
ffap-guesser returns at point? If so, try this:
(defun ffap-guesser-copy (&optional msgp)
(let ((text (kill-new (ffap-guesser))))
(when msgp (message "Copied `%s to kill ring" text))))
(global-set-key "\C-o" 'ffap-guesser-copy)