Subject: bug#4891 closed by Chong Yidong <[email-masked]> (Re: 23.1; shell-command overwrites whole buffer)

From: [email-masked] (Emacs bug Tracking System)
Date: Sat, 14 Nov 2009 16:15:05 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#4891: 23.1; shell-command overwrites whole buffer

It has been closed by Chong Yidong <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Chong Yidong <[email-masked]> by
replying to this email.

-- 
4891: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4891
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: 23.1; shell-command overwrites whole buffer
From: Chong Yidong <[email-masked]>
To: Adam Spiers <[email-masked]>
Cc: [email-masked]
Date: Sat, 14 Nov 2009 11:09:30 -0500

>   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).

Thanks for the bug report.  This is really a documentation bug, because
shell-command has always erased the buffer since the first version of
Emacs, and other code depends on this behavior.  I've amended the
docstring to mention that the buffer is erased.

Subject: 23.1; shell-command overwrites whole buffer
From: Adam Spiers <[email-masked]>
To: [email-masked]
Date: Mon, 9 Nov 2009 11:14:14 +0000 (UTC)

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).

In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
 of 2009-09-29 on x86-7.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10603901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-: ( s h e l l - c o m m a n d SPC " d a t e " S-SPC 
( g e t - b u f f e r SPC " * s c r a t c h * " ) ) 
<return> C-x b <return> M-x r e p o r <tab> 
<return>

Recent messages:
Loading /usr/share/emacs/site-lisp/site-start.d/muse-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/po-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/ruby-mode-init.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Mon Nov  9 10:38:11 GMT 2009
0 (#o0, #x0)
Making completion list...