GNU bug report logs - #4891
23.1; shell-command overwrites whole buffer

Previous Next

Package: emacs;

Reported by: Adam Spiers <bug-gnu-emacs <at> adamspiers.org>

Date: Mon, 9 Nov 2009 11:20:04 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #15 received at 4891 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Adam Spiers <bug-gnu-emacs <at> adamspiers.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 4891 <at> debbugs.gnu.org
Subject: Re: bug#4891: 23.1; shell-command overwrites whole buffer
Date: Thu, 12 Nov 2009 01:15:48 +0000
On Wed, Nov 11, 2009 at 12:47:21PM +0200, Juri Linkov wrote:
> > Starting emacs 23.1.1 with the '-q' argument and typing:
> >
> >   M-: (shell-command "date" (get-buffer "*scratch*"))
> >
> > results in the prior contents of the *scratch* buffer being
> > overwritten.  This seems to contradict the last sentence in the
> > following paragraph of the docstring for shell-command:
> >
> >     The optional second argument output-buffer, if non-nil, says to
> >     put the output in some other buffer.  If output-buffer is a buffer
> >     or buffer name, put the output there.  If output-buffer is not a
> >     buffer and not nil, insert output in current buffer.  (This cannot
> >     be done asynchronously.)  In either case, the output is inserted
> >     after point (leaving mark after it).
> 
> Is the following description more precise?
> 
>     The optional second argument OUTPUT-BUFFER, if non-nil,
>     says to put the output in some other buffer.
>     If OUTPUT-BUFFER is a buffer or buffer name, put the output there
>       replacing the old contents of that buffer.
>     If OUTPUT-BUFFER is not a buffer and not nil,
>       insert output in current buffer.  (This cannot be done
>       asynchronously.)  In the latter case, the output is inserted
>       after point (leaving mark after it).

Thanks for the quick reply!  Yes, that does make more sense now - but
what if I want to asynchronously insert output into an existing
buffer?  I think it would be more useful if the code was changed to
match the docstring, rather than the other way around :-)

Regards,
Adam



This bug report was last modified 15 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.