I've written my first custom elisp function for dealing with the output from grep.
(defun open-at-grep ()
(interactive)
(let ((thisline (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
(find-file (nth 0 (split-string thisline ":")))
(goto-line (string-to-number (nth 1 (split-string thisline ":"))))
))
This works, and I can hotkey it with a global key-binding. What I would like to do is to create a minor mode to autoload the keybinding (eventually just getting hooked for files with a custom extension). What I've tried is
(define-minor-mode grepout-mode
"tool for making use of output of grep -n"
nil
"grepout-mode"
(("C->" . open-at-grep)))
which throws an error when emacs launches
Invalid function: (C-> . open-at-grep)
The stack-trace from launching emacs --debug-init
is not particularly more helpful. I've tried (([C->] . 'open-at-grep))
, and other permutations of quotes and not quotes. What am I missing?