unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Johan Andersson <johan.rejeep@gmail.com>
To: Johan Andersson <johan.rejeep@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Redirect Output
Date: Wed, 31 Mar 2010 12:41:10 +0000	[thread overview]
Message-ID: <y2o929ccd881003310541xd533647aqff27c94d292ce688@mail.gmail.com> (raw)
In-Reply-To: <929ccd881003301514n1aa14473kffd0c4fb37d022dc@mail.gmail.com>

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

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?
>>
>
>

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

      reply	other threads:[~2010-03-31 12:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 21:23 Redirect Output Johan Andersson
2010-03-30 22:08 ` Lennart Borgman
2010-03-30 22:14   ` Johan Andersson
2010-03-31 12:41     ` Johan Andersson [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=y2o929ccd881003310541xd533647aqff27c94d292ce688@mail.gmail.com \
    --to=johan.rejeep@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.
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).