Package: emacs22-common
Version: 22.2+2-3
Severity: normal
Tags: patch

Hello

When I evalute
(shell-command-on-region (region-beginning)
                         (region-end)
                         "cpp -C -P -"
                         t)
by M-: the region gets replaced with the output which, if
I understand the documentation correctly, should not happen.
Instead, the output should be inserted after the region.

I've looked at simple.el and found that the following change
(see patch) does it for me. However, the output is inserted
_before_ the region and I don't know how this change affects
shell-command-on-region in other situations.

Cheers

The patch:
2067c2067
<               (call-process-region start end shell-file-name t
---
>               (call-process-region start end shell-file-name replace


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages emacs22-common depends on:
ii  dpkg                          1.14.20    Debian package management system
ii  emacsen-common                1.4.17     Common facilities for all emacsen

emacs22-common recommends no packages.

Versions of packages emacs22-common suggests:
pn  emacs22-common-non-dfsg       <none>     (no description available)
ii  emacs22-el                    22.2+2-3   GNU Emacs LISP (.el) files

-- no debconf information
>From MAILER-DAEMON Sun Aug 24 00:07:28 2008
Return-path: <>
Envelope-to: [EMAIL PROTECTED]
Delivery-date: Sun, 24 Aug 2008 00:07:28 +0200
Received: from Debian-exim by fastestdamian.home with local (Exim 4.69)
	id 1KX1Ga-00019I-S4
	for [EMAIL PROTECTED]; Sun, 24 Aug 2008 00:07:28 +0200
X-Failed-Recipients: [EMAIL PROTECTED]
Auto-Submitted: auto-replied
From: Mail Delivery System <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Mail delivery failed: returning message to sender
Message-Id: <[EMAIL PROTECTED]>
Date: Sun, 24 Aug 2008 00:07:28 +0200
Status: R

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  [EMAIL PROTECTED]
    Mailing to remote domains not supported

------ This is a copy of the message, including all the headers. ------

Return-path: <[EMAIL PROTECTED]>
Received: from damian by fastestdamian.home with local (Exim 4.69)
	(envelope-from <[EMAIL PROTECTED]>)
	id 1KX1Ga-00019G-Mb
	for [EMAIL PROTECTED]; Sun, 24 Aug 2008 00:07:28 +0200
To: [EMAIL PROTECTED]
Subject: shell-command-on-region replaces region when 4th argument is t
Message-Id: <[EMAIL PROTECTED]>
From: Damian Birchler <[EMAIL PROTECTED]>
Date: Sun, 24 Aug 2008 00:07:28 +0200

Hello

When I evalute
(shell-command-on-region (region-beginning)
			 (region-end)
			 "cpp -C -P -"
			 t)
by M-: the region gets replaced with the output which, if
I understand the documentation correctly, should not happen.
Instead, the output should be inserted after the region.

I've looked at simple.el and found that the following change
(see patch) does it for me. However, the output is inserted
_before_ the region and I don't know how this change affects
shell-command-on-region in other situations.

Cheers

The patch:
2067c2067
< 		(call-process-region start end shell-file-name t
---
> 		(call-process-region start end shell-file-name replace


In GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-07-25 on raven, modified by Debian
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/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' '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_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  tool-bar-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
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<backspace> <backspace> M-x e v a l - b u f f e r <return> 
C-x b a p p <tab> c <tab> <return> C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-SPC C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-p C-p C-p C-p C-p C-n C-e M-: ( s h e l l - c o m 
m m <backspace> a n d - o n - r e g i o n SPC ( r e 
g i o n - b e g i n n i n g ) SPC ( r e g i o n - e 
n d ) SPC ( <backspace> " c p p SPC - C SPC - P SPC 
- " SPC t ) <return> C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-x b <return> C-s ( d e f u n SPC SPC <backspace> 
SPC s h e l l <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> s h e l l - c o m m <tab> <backspace> 
C-s C-s C-s C-s C-a M-v M-v M-v M-v M-v C-v C-v M-v 
C-v C-v C-v M-v M-v C-v C-v C-n C-n C-n C-n C-f C-f 
C-f C-h a p a r e n t <return> C-h a s e x p <return> 
C-M-v C-M-v C-x 1 C-v M-v M-v M-v M-v C-v M-v C-v C-v 
M-v <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
Wrote /home/damian/my-simple.el
Mark set [2 times]
Quit
Mark set
0 (#o0, #x0)
Auto-saving...done
Mark saved where search started
Type C-x 1 to remove help window.  
Auto-saving...done
Loading emacsbug...done

Reply via email to