5

I would like to run a shell command and get its output in clickable buffer in emacs. The command is a shell script that eventually runs glimpse on bunch of source files. Its output looks like grep's output. It includes file name and line number. I would like to be able to click on a file or enter while standing on it and for emacs to take me to that line in the file. I suppose I need some custom function to do that, but I am new to emacs so I don't yet know how to program it.

N.N.
  • 8,336
  • 12
  • 54
  • 94
Alexander Sandler
  • 2,078
  • 2
  • 19
  • 21

2 Answers2

7

M-x grep type in your command instead of the default.

M-x apropos "grep.*null" finds grep-use-null-device if you need to not send "/dev/null"

event_jr
  • 17,467
  • 4
  • 47
  • 62
  • This seems like an interesting direction. The problem is that emacs appends /dev/null as last argument to my command. I assume it expects grep to run on some set of files and since my command doesn't include any files in its arguments, it appends /dev/null as a default file. – Alexander Sandler Mar 08 '12 at 17:57
  • 1
    M-x apropos "grep.*null" finds `grep-use-null-device`. – event_jr Mar 08 '12 at 18:19
  • @event_jr To make it easier for others to find it might make sense to also put the content of that comment directly in your answer. – N.N. Mar 08 '12 at 18:30
1

An alternative approach is to run the command using shell-command M-!, and changing the output buffer's mode to compilation-mode using M-x compilation-mode.

Yet another alternative is to run the command using M-x compile. The downside of this is that, Emacs allows only one active compilation buffer by default.

Praveen Kumar
  • 1,280
  • 1
  • 8
  • 14