Run command in emacs, get output in clickable buffer
Asked Answered
F

2

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.

Farrier answered 8/3, 2012 at 17:40 Comment(0)
C
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"

Cesya answered 8/3, 2012 at 17:51 Comment(3)
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.Farrier
<kbd>M-x apropos</kbd> "grep.*null" finds grep-use-null-device.Cesya
@Cesya To make it easier for others to find it might make sense to also put the content of that comment directly in your answer.Glorygloryofthesnow
H
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.

Horselaugh answered 12/3, 2012 at 4:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.