unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Real time output
@ 2011-02-15 14:28 andrea crotti
  0 siblings, 0 replies; 3+ messages in thread
From: andrea crotti @ 2011-02-15 14:28 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1223 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Real time output
       [not found] <mailman.2.1297780104.22169.help-gnu-emacs@gnu.org>
@ 2011-02-16 10:51 ` José A. Romero L.
  2011-02-16 10:54 ` José A. Romero L.
  1 sibling, 0 replies; 3+ messages in thread
From: José A. Romero L. @ 2011-02-16 10:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 15, 3:28 pm, andrea crotti <andrea.crott...@gmail.com> wrote:
> 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...
(...)

Have you already considered using M-x async-shell-command, or even
M-x term?

Cheers,
--
José Alfredo Romero L. | Software Architect
StepStone Solutions  | CBL ul. Lubicz 23 | 31-503 Kraków | Poland
jose.romero@stepstonesolutions.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Real time output
       [not found] <mailman.2.1297780104.22169.help-gnu-emacs@gnu.org>
  2011-02-16 10:51 ` Real time output José A. Romero L.
@ 2011-02-16 10:54 ` José A. Romero L.
  1 sibling, 0 replies; 3+ messages in thread
From: José A. Romero L. @ 2011-02-16 10:54 UTC (permalink / raw)
  To: help-gnu-emacs

On Feb 15, 3:28 pm, andrea crotti <andrea.crott...@gmail.com> wrote:
> 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...

Have you already considered using M-x async-shell-command, or even
M-x term?

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-16 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2.1297780104.22169.help-gnu-emacs@gnu.org>
2011-02-16 10:51 ` Real time output José A. Romero L.
2011-02-16 10:54 ` José A. Romero L.
2011-02-15 14:28 andrea crotti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).