all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Mode for output analysis
Date: Tue, 21 Dec 2010 16:49:15 +0100	[thread overview]
Message-ID: <m14oa7gm84.fsf@ip1-201.halifax.rwth-aachen.de> (raw)

I have a log file which looks something like this:

--8<---------------cut here---------------start------------->8---
28.250000: 

1: BEACON_EVENT_TRIGGERED(27)
1: BEACON_SENT
----------------------------------------
28.251000: 

3: BEACON_RECEIVED(1)
3: NEIGHBOUR_UPDATED(1)
2: BEACON_RECEIVED(1)
2: NEIGHBOUR_UPDATED(1)
0: BEACON_RECEIVED(1)
0: NEIGHBOUR_UPDATED(1)
--8<---------------cut here---------------end--------------->8---

only today for the first time I thought to actually display the output
in emacs instead of the shell, and I produced:

--8<---------------cut here---------------start------------->8---
(defun pad-show-results (rerun)
  "shows the results of the execution"
  (interactive "Mrerun?:\n")
  (let*
      ((script (if (null rerun) "./analyze.py" "./runner.py"))
       (cmd (concat "cd $PAD_DIR && " script " 1")))
    
    (if (buffer-live-p (get-buffer result-buffer-name))
        (kill-buffer (get-buffer result-buffer-name)))
    ;; maybe can popup always on the same external frame instead
    (pop-to-buffer "*pad-results*")
    (message  (concat "running command " cmd))
    (insert (shell-command-to-string cmd))
    (goto-line 0)
    (compilation-mode)))

(setq compile-command "cd $PAD_DIR && make -j4")

(defun compile-and-show ()
  "recompile and show the output of the new execution"
  (interactive)
  (recompile)
  ;; does the second command waits for the end of the first??
  (pad-show-results t))
--8<---------------cut here---------------end--------------->8---

first a couple of questions:
- is it possible to rewrite on an existing buffer (which is read-only)
  more easily than how I do (checking if exist, kill and then create a
  new one)?
- am I sure in compile-and-show that the second expression is evaluated
  after the compilation is over?
  By default the subprocess are synchronous right?

And then I finally realized that I can do much much better, for example
- jump to where the expression shown is logged
- filter over regular expression, node number etc

I think I'll have to use overlays maybe and some black magic, do you
have any advice or example of library which does something like this??




             reply	other threads:[~2010-12-21 15:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-21 15:49 Andrea Crotti [this message]
2010-12-21 18:31 ` Mode for output analysis Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14oa7gm84.fsf@ip1-201.halifax.rwth-aachen.de \
    --to=andrea.crotti.0@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.