tags:

views:

169

answers:

1

Right now, I have F5 set to start gdb in emacs for me:

(global-set-key [f5] 'gdb)

This switches to the mini-buffer, which I then type a path to an executable... I'd like to find a way to bypass this path typing...

I wrote an executable that looks at the Makefile, parses it and figures out the full path of the executable and prints it to standard out... Is it possible to call this from my .emacs... And then somehow pass the output to the gdb command?

+1  A: 
(defun gdb-getpath ()
  "Figures out the path to executable and launches gdb."
  (interactive)
  (let ((path (shell-command-to-string "/path/to/your/executable")))
    (gdb (concat "gdb " path))
    ))

(global-set-key [f5] 'gdb-getpath)
bstpierre
Awesome! I am going to accept this as the answer! I had to make 1 small change to my program... When I output the path, I put a "\n" on it that I had to remove to get it to work with your code... Thanks a million!
dicroce