Thanks, this works very well, but somehow the vi (gf) version is still a bit smarter. I think he is looking at a path variable for search paths.
I did something that is uselessly complicated, but works for me (only on Linux). It uses the locate command to find the path under the cursor. I think this can be done smarter by first looking at the relative path to the current file. sorry for my poor elisp skills ... This can probably be achieved much nicer.
enter your .emacs, then use goto-file with Mx
(defun shell-command-to-string (command) "Execute shell command COMMAND and return its output as a string." (with-output-to-string (with-current-buffer standard-output (call-process shell-file-name nil t nil shell-command-switch command)))) (defun goto-file () "open file under cursor" (interactive) (find-file (shell-command-to-string (concat "locate " (current-word) "|head -c -1" )) ))
Nir Nov 04 '08 at 8:35 2008-11-04 08:35
source share