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

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

Re: Redirect Output


From: Johan Andersson
Subject: Re: Redirect Output
Date: Wed, 31 Mar 2010 12:41:10 +0000

I solved it like this:

  (defadvice message (around message-around (format-string &rest args) activate))
  (defun message-force (format-string &rest args)
    (princ (apply 'format format-string args)))

Thanks!

On Tue, Mar 30, 2010 at 10:14 PM, Johan Andersson <johan.rejeep@gmail.com> wrote:
Lennart, You're almost my private Emacs tutor :)

Didn't know about advicing! Looks like it could solve it! I will look into it and get back with the results. But that'll have to wait until tomorrow.

Thanks!

On Tue, Mar 30, 2010 at 10:08 PM, Lennart Borgman <lennart.borgman@gmail.com> wrote:
On Tue, Mar 30, 2010 at 11:23 PM, Johan Andersson
<johan.rejeep@gmail.com> wrote:
> Hey,
> I have a batch program where I run some Elisp functions and then print some
> results. The problem is that some of the functions I'm calling produces
> output. And I don't want that. So I'm basically looking for a way to only
> output my printing.
> The first I thought about was redirecting stdout to something else. Like
> this:
>
> #!/usr/bin/emacs --script
> (let* ((buffer (get-buffer-create "output"))
>        (standard-output buffer))
>   (print "some printing"))
>
> That works fine, except that it does not bite on message. Like this:
>
> #!/usr/bin/emacs --script
> (let* ((buffer (get-buffer-create "output"))
>        (standard-output buffer))
>   (message "some message"))
>
> Any ideas how I can solve this?

defadvice the `message' function?



reply via email to

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