visit-source.el
visit-source.el is an utility Emacs package to quickly go to a file at
point (under cursor). I bind (keymap-global-set "H-RET"
#'visit-sourse) and can quickly go to files with line precision from
anywhere, including log outputs.
Installation
grab a file visit-source.el, put it somewhere on load-path, bind to a
key – I have it within ffap package:
(use-package ffap :ensure nil
:config
(require 'visit-source)
;;(setq ffap-file-finder #'visit-source)
(setq ffap-file-finder #'find-file)
:bind (("H-<return>" . visit-source)))
Usage
In any buffer put a point on a file-looking string and call {M-x visit-source RET} (or {H-<return>} for me).
File-looking string can be:
- a filename
- a filename with lines (as in exception or log output)
History
When I first find it on r/emacs comment, it was much simpler version
and was intended as drop-in replacement for find-file. Then I added
project awareness, so you can visit-source on a file
Pavels-Emacs-Configuration-v3.org by filename, from anywhere in the
project.
Initially I adopted visit-source instead of find-file {C-x C-f} but
then switched to find-file-at-point that has a bit different semantics
and kept visit-source at {H-RET} separately.
visit-source v0.3.0
visit-source worked in most cases, but still had some rough edges,
like didn't parse when path at point ends with dots, so text like
../Pavels-Emacs-Configuration-v3.org. didn't parse, so I had to
manually end sentences with "../Pavels-Emacs-Configuration-v3.org
file." or "../nv directory." Yesterday I bumped into the need to
visit arbitrary Org Mode link. {C-c C-o} runs OS open on it, so log
files were opening with TextEdit.app for me. Surely I can reconfigure
it in macOS level to associate Emacs with log files (via UI?); but
visit-source looks the way for it.
Given personal tooling reneissance, with Claude Code on <2026-05-06 Wed> I asked it to refactor the code - extract helper pure functions, implement fixes, support Org Mode links, get rid of trailing punctuation, add tests.
So meet visit-source v0.3.0 – visit-source.el!