I'm running the output of an application in an emacs buffer using shell-command.
(shell-command "verbose-app &" "*verbose-app*")
The problem is this command is extremely verbose. So much so, that it sometimes takes several seconds for the emacs buffer to catch up. It lags by several seconds with the actual output.
Is there any way I can speed up the output scrolling by disabling something? Like regex-matching or syntax highlighting?
For future reference:
The verbose app is adb logcat. I changed my existing function:
(defun adb-logcat ()
(interactive)
(shell-command "adb logcat -v threadtime&" "*adb-logcat*")
(pop-to-buffer "*adb-logcat*")
(buffer-disable-undo))
To the following:
(defun adb-logcat ()
(interactive)
(start-process "*adb-logcat*" "*adb-logcat*" "/bin/sh" "-c" "adb logcat -v threadtime")
(pop-to-buffer "*adb-logcat*")
(buffer-disable-undo))
It scrolls way faster now. Yay!
Like the documentation says, shell-command
runs the command in an inferior shell, implying shell-mode
. If you just want the output and none of the features, running the command with start-process
may be closer to what you want.
(start-process "*verbose-app*" "*verbose-app*"
"/bin/sh" "-c" "verbose-app")
Wrapping this into a function should not be too hard. You might want to look at how shell-command
implements async commands; for example, it will ask whether it should terminate an existing process if you attempt to create one when another already exists. http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/simple.el#n2447 might be a good starting point. (In case the link goes bad, this is a link to inside defun shell-command
, pointing to a a comment about handling the ampersand. If it's there, the command will be run asynchronously.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With