Open the file under the cursor and go to the specified line number.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
slf-open-file-under-cursor-test.el
slf-open-file-under-cursor.el
test.txt

README.md

slf-open-file-under-cursor

`slf-open-file-under-cursor' is an emacs command which opens the file under the cursor and goes to the specified line number.

The command parses the current line to extract the filename and line number. Then it opens the file and goes to the line.

The command supports four common file/line formats generated by grep, a couple stack traces and logging.

Line formats:

  1. filename:10:...
  2. ... in filename line 20...
  3. ...File "filename" line 30...
  4. ...:basename(40):...
  5. 2015-11-12 21:53:21 basename.py(30) ...

Filename is either a full path or a filename relative to the current directory.

The fourth and fifth verions, supports filenames without path information. The basename is searched in the base folder and its subfolders to find the file. It uses the system find command to search the folder.

You can add support for other formats by adding a regular expression and a few lines of code.

Install

To install, copy the `slf-open-file-under-cursor.el' file to your emacs load path and assign a key to slf-open-file-under-cursor.

(load-file "~/.emacs.d/slf-open-file-under-cursor.el")
(global-set-key "\M-o" 'slf-open-file-under-cursor)