help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Real time output


From: andrea crotti
Subject: Real time output
Date: Tue, 15 Feb 2011 15:28:11 +0100

How would that be possible to implement a function which calls a shell command and shows its output
in real-time?

I tried a few things but didn't succeed yet, I thought about something as below.
Where I switch to the buffer and activate auto-revert-mode, but apparently it doesn't work...

--8<---------------cut here---------------start------------->8---
(defun pad-show-results ()
  "shows the results of the execution"
  (interactive)
  ;; takes a symbol and a number corresponding the conf to analyze
  (let
      ((cmd (read-from-minibuffer "command to run: " "cd $PAD_DIR && ./run_sim.py"))
       (output-buffer "*pad-results*"))

    (if (buffer-live-p (get-buffer output-buffer))
        (kill-buffer (get-buffer output-buffer)))
    ;; maybe can popup always on the same external frame instead
    (switch-to-buffer output-buffer)
    (message (concat "running " cmd))
    (auto-revert-mode t)
    (shell-command cmd output-buffer)
    (compilation-mode)))
--8<---------------cut here---------------end--------------->8---


Thanks,
Andrea

reply via email to

[Prev in Thread] Current Thread [Next in Thread]