unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
@ 2010-02-22  9:44 tomas
  2010-02-23 18:08 ` Glenn Morris
  2022-01-27 18:31 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: tomas @ 2010-02-22  9:44 UTC (permalink / raw)
  To: 5618; +Cc: rfrancoise

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':

- - Start with some buffer with text in it. *scratch* will do fine.
- - Put point somewhere in text
- - evaluate (shell-command-on-region (point) (point) "/bin/date" (current-buffer) nil)

(The actual values of START and END are irrelevant, though).

The whole content of the buffer gets replaced by output of
command. According to the doc, I'd expect the ouput to be inserted
before point.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/23.1.91/etc/DEBUG.


In GNU Emacs 23.1.91.1 (i486-pc-linux-gnu, GTK+ Version 2.12.12)
 of 2010-01-11 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100111-1~lenny1)
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.91/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

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_ZW.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Help

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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: (only . t)
  view-mode: t

Recent input:
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> C-x 
b <return> C-x u C-h f c a l l - p r o c e s s <tab> 
<tab> - r e <tab> <return> M-x <up> <return> <up> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> c a l l - p r o 
c e s s <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> n i l SPC <return> M-x <up> <return> 
<up> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <down-mouse-1> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <help-echo> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <drag-mouse-1> C-g 
C-x o M-x r e p o <tab> r <tab> <return>

Recent messages:
uncompressing simple.el.gz...done
Note: file is write protected
0 (#o0, #x0)
Mark saved where search started
Undo!
Making completion list...
Type C-x 1 to delete the help window.
0 (#o0, #x0)
Quit
Making completion list...

Load-path shadows:
/usr/share/emacs/23.1.91/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup

Features:
(shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1 hex-util
hashcash mail-utils emacsbug multi-isearch jka-compr find-func debug
help-mode easymenu view cc-styles cc-align cc-engine cc-vars cc-defs
uniquify advice help-fns advice-preload markerpen am-mode easy-mmode
am-files diredz regexp-opt wid-edit edmacro kmacro tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote
make-network-process dbusbind font-render-setting gtk x-toolkit x
multi-tty emacs)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLglHtBcgs9XrR2kYRAgd7AJ4gD7sTtf0hIhR7T7wLHIaPQlR9QwCfUr68
P6oq/qRMBtsYCsNF9/eUl4M=
=79DJ
-----END PGP SIGNATURE-----






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-22  9:44 bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer tomas
@ 2010-02-23 18:08 ` Glenn Morris
  2010-02-24  5:58   ` tomas
  2022-01-27 18:31 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2010-02-23 18:08 UTC (permalink / raw)
  To: tomas; +Cc: 5618, rfrancoise

tomas@tuxteam.de wrote:

> The whole content of the buffer gets replaced by output of
> command. According to the doc, I'd expect the ouput to be inserted
> before point.

I guess this is a documentation bug, in the same way as was

http://debbugs.gnu.org/4891

I'm not sure that the installed doc fix for that bug is actually
correct. The suggestion in

http://debbugs.gnu.org/4891#10

seems correct to me.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-23 18:08 ` Glenn Morris
@ 2010-02-24  5:58   ` tomas
  2010-02-26  9:17     ` Juri Linkov
  2010-03-06 17:34     ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: tomas @ 2010-02-24  5:58 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 5618, rfrancoise

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks, Glenn for looking into it.

On Tue, Feb 23, 2010 at 01:08:37PM -0500, Glenn Morris wrote:
> tomas@tuxteam.de wrote:
> 
> > The whole content of the buffer gets replaced by output of
> > command. According to the doc, I'd expect the ouput to be inserted
> > before point.
> 
> I guess this is a documentation bug, in the same way as was
> 
> http://debbugs.gnu.org/4891

Yes, I think it's the same "bug". Now if I knew how to merge that...

> I'm not sure that the installed doc fix for that bug is actually
> correct. The suggestion in
> 
> http://debbugs.gnu.org/4891#10

Except that in our case, even if it's the current buffer, the whole
content of the buffer is overwritten as well, rendering the above
mentioned doc fix incorrect:

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

Besides, the behaviour in the current documentation seems way more
useful (i.e. _not_ erasing the buffer whenever REPLACE is non-nil).

What do you think?

> seems correct to me.

Half of it, yes, see above.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLhMAFBcgs9XrR2kYRAghcAJ97B90JiuOcu8Ck+Yt0iCPtRQcw1gCePIY8
XYLgohnxDDQjrsn1OPJf6mY=
=4Z+h
-----END PGP SIGNATURE-----






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-24  5:58   ` tomas
@ 2010-02-26  9:17     ` Juri Linkov
  2010-02-26 10:12       ` tomas
  2010-03-06 17:34     ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2010-02-26  9:17 UTC (permalink / raw)
  To: tomas; +Cc: 5618, rfrancoise

>> I'm not sure that the installed doc fix for that bug is actually
>> correct. The suggestion in
>>
>> http://debbugs.gnu.org/4891#10
>
> Except that in our case, even if it's the current buffer, the whole
> content of the buffer is overwritten as well, rendering the above
> mentioned doc fix incorrect:
>
>     "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)"
>
> Besides, the behaviour in the current documentation seems way more
> useful (i.e. _not_ erasing the buffer whenever REPLACE is non-nil).
>
> What do you think?

Are you sure that changing its long-time behaviour won't break
some existing packages?

>> seems correct to me.
>
> Half of it, yes, see above.

-- 
Juri Linkov
http://www.jurta.org/emacs/






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-26  9:17     ` Juri Linkov
@ 2010-02-26 10:12       ` tomas
  0 siblings, 0 replies; 7+ messages in thread
From: tomas @ 2010-02-26 10:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 5618, rfrancoise

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Feb 26, 2010 at 11:17:19AM +0200, Juri Linkov wrote:

[...]

> > Besides, the behaviour in the current documentation seems way more
> > useful (i.e. _not_ erasing the buffer whenever REPLACE is non-nil).
> >
> > What do you think?
> 
> Are you sure that changing its long-time behaviour won't break
> some existing packages?

No, of course not. Taking into account that the doc has stated tthis
behaviour one might venture to guess that packages wouldn't rely on the
"actual" (as opposed to the "documented") behaviour.

Still it's a judgement call, and I haven't the insight/experience to
perform that.

I'd try to offer a patch for the function if consensus arises that this
is desirable (but not this week).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLh56BBcgs9XrR2kYRAgt7AJ9IJD6LDEt5Gc4JL83mLUNNvxd65gCfUVOq
uvqlUAuKKiAiRj2xhrcR1zA=
=QCCG
-----END PGP SIGNATURE-----






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-24  5:58   ` tomas
  2010-02-26  9:17     ` Juri Linkov
@ 2010-03-06 17:34     ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2010-03-06 17:34 UTC (permalink / raw)
  To: tomas; +Cc: 5618, rfrancoise

> Besides, the behaviour in the current documentation seems way more
> useful (i.e. _not_ erasing the buffer whenever REPLACE is non-nil).

Agreed.  We should try and fix the code to obey the doc more than the
converse.  If that can introduce backward compatibility problems, then
it just means we need to do it more carefully.


        Stefan






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer
  2010-02-22  9:44 bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer tomas
  2010-02-23 18:08 ` Glenn Morris
@ 2022-01-27 18:31 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-27 18:31 UTC (permalink / raw)
  To: tomas; +Cc: 5618, rfrancoise

tomas@tuxteam.de writes:

> - Start with some buffer with text in it. *scratch* will do fine.
> - Put point somewhere in text
> - evaluate (shell-command-on-region (point) (point) "/bin/date" (current-buffer) nil)
>
> (The actual values of START and END are irrelevant, though).
>
> The whole content of the buffer gets replaced by output of
> command. According to the doc, I'd expect the ouput to be inserted
> before point.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

The behaviour has now been documented as such:

----
Optional fourth arg OUTPUT-BUFFER specifies where to put the
command's output.  If the value is a buffer or buffer name,
erase that buffer and insert the output there; a non-nil value of
`shell-command-dont-erase-buffer' prevent to erase the buffer.
If the value is nil, use the buffer specified by `shell-command-buffer-name'.
Any other non-nil value means to insert the output in the
current buffer after START.
----

And we've grown an extra user option (that's...  pretty confusing in
itself, I think).  So while the semantics here are far less than ideal,
I don't think there's anything further to do here, and I'm closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-27 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22  9:44 bug#5618: 23.1.91; shell-command-on-region unexpectedly erases buffer tomas
2010-02-23 18:08 ` Glenn Morris
2010-02-24  5:58   ` tomas
2010-02-26  9:17     ` Juri Linkov
2010-02-26 10:12       ` tomas
2010-03-06 17:34     ` Stefan Monnier
2022-01-27 18:31 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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