From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Johan Andersson Newsgroups: gmane.emacs.help Subject: Re: Redirect Output Date: Wed, 31 Mar 2010 12:41:10 +0000 Message-ID: References: <929ccd881003301423r6e405f6fped5d5849b7899831@mail.gmail.com> <929ccd881003301514n1aa14473kffd0c4fb37d022dc@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e6d7e744976c300483180fc5 X-Trace: dough.gmane.org 1270039384 8851 80.91.229.12 (31 Mar 2010 12:43:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Mar 2010 12:43:04 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Johan Andersson Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 31 14:43:00 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NwxG0-0001iT-Hk for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Mar 2010 14:42:53 +0200 Original-Received: from localhost ([127.0.0.1]:50557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwxFz-0007v2-Po for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Mar 2010 08:42:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NwxEU-0007av-4X for help-gnu-emacs@gnu.org; Wed, 31 Mar 2010 08:41:18 -0400 Original-Received: from [140.186.70.92] (port=59132 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwxER-0007Xm-7n for help-gnu-emacs@gnu.org; Wed, 31 Mar 2010 08:41:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwxEO-00076N-2m for help-gnu-emacs@gnu.org; Wed, 31 Mar 2010 08:41:15 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:40231) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwxEN-00076A-Nj for help-gnu-emacs@gnu.org; Wed, 31 Mar 2010 08:41:12 -0400 Original-Received: by wyf22 with SMTP id 22so23807wyf.0 for ; Wed, 31 Mar 2010 05:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=vq1UdtBkT+PJNyrYVC15bKjZfF8RTiV11ghrxcfiNcM=; b=LV15c9DvWfCvv2/Oz/5469h8WEHb39A9pVSm3QGERDeMrjqqZp/PdvtZxKYAXcbqJf 8TNZ2iYNkKCEN9gjg7fCc8MT49D1r0HzHXsiGb4obQeOLqVfYNSC0bPaW+Mwg0N3kX4K AD0Ev3mzt25RDj1eMYmPGs9a7uVLcskfcdT7U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=qbpqlyCGJraEAQOp3P0BpYxrmkATj4U8phaRTVq6P/36MnVzgN3GZGuJstngkQMP5O ZltwNR3onS4w00HEXGczdrCE44mUp/dTxmqY1DbZ9Bm15pIltVI2k8fwSRKCweBCd1nL a39EbYEfgTQMs5B8Esyc4zoLjv+dbU5EZn36k= Original-Received: by 10.216.20.198 with HTTP; Wed, 31 Mar 2010 05:41:10 -0700 (PDT) In-Reply-To: <929ccd881003301514n1aa14473kffd0c4fb37d022dc@mail.gmail.com> Original-Received: by 10.216.85.194 with SMTP id u44mr878977wee.160.1270039270877; Wed, 31 Mar 2010 05:41:10 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72551 Archived-At: --0016e6d7e744976c300483180fc5 Content-Type: text/plain; charset=ISO-8859-1 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 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 >> 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? >> > > --0016e6d7e744976c300483180fc5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I solved it like this:

=A0=A0(defadvice message (around m= essage-around (format-string &rest args) activate))
=A0=A0(de= fun message-force (format-string &rest args)
=A0=A0 =A0(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 t= omorrow.

Thanks!
<= br>
On Tue, Mar 30, 2010 at 10:08 PM, Lennart Bor= gman <lennart.borgman@gmail.com> wrote:
On Tue, Mar 30, 2010 at= 11:23 PM, Johan Andersson
<johan.rejee= p@gmail.com> wrote:
> Hey,
> I have a batch program where I run some Elisp functions and then print= =A0some
> results. The problem is that some of the functions I'm calling=A0p= roduces
> output. And I don't want that. So I'm basically looking=A0for = a way to only
> output my printing.
> The first I thought about was redirecting stdout to something else. Li= ke
> this:
>
> #!/usr/bin/emacs --script
> (let* ((buffer (get-buffer-create "output"))
> =A0=A0 =A0 =A0 (standard-output buffer))
> =A0=A0(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"))
> =A0=A0 =A0 =A0 (standard-output buffer))
> =A0=A0(message "some message"))
>
> Any ideas how I can solve this?

defadvice the `message' function?


--0016e6d7e744976c300483180fc5--