GNU bug report logs - #1496
23.0.60; comint-delete-output should copy region to the kill ring

Previous Next

Package: emacs;

Reported by: barry <at> python.org

Date: Fri, 5 Dec 2008 00:20:03 UTC

Severity: wishlist

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1496 in the body.
You can then email your comments to 1496 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to barry <at> python.org:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: barry <at> python.org
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; comint-delete-output should copy region to the kill ring
Date: Thu,  4 Dec 2008 18:37:10 -0500 (EST)
comint-delete-output uses delete-region instead of kill-region because the
latter sets this-command.  Still, comint-delete-output should copy the killed
region to the kill ring so that it can be conveniently yanked into other
buffers.  A use case:

I use bzr diff in a shell buffer to get the changes in my working directory.
I'd like to copy that output directly into an email or a pastebin buffer.
With comint-delete-output's current behavior I can't use C-c C-o because the
output is thrown away.  By adding a call to copy-region-as-kill, I can now go
to my mail buffer and hit C-y to paste the diff output.

Here's a better definition of comint-delete-output:

(defun comint-delete-output ()
  "Delete all output from interpreter since last input.
Does not delete the prompt."
  (interactive)
  (let ((proc (get-buffer-process (current-buffer)))
        (replacement nil)
        (inhibit-read-only t))
    (save-excursion
      (let ((pmark (progn (goto-char (process-mark proc))
                          (forward-line 0)
                          (point-marker))))
        ;; Add the text to the kill ring.
        (copy-region-as-kill comint-last-input-end pmark)
        (delete-region comint-last-input-end pmark)
        (goto-char (process-mark proc))
        (setq replacement (concat "*** output flushed ***\n"
                                  (buffer-substring pmark (point))))
        (delete-region pmark (point))))
    ;; Output message and put back prompt
    (comint-output-filter proc replacement)))

The only difference is the addition of the comment and the call to
copy-region-as-kill.



In GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.14.3)
 of 2008-10-13 on rothera, modified by Debian
 (emacs-snapshot package, version 1:20081013-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10502000
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.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/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_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Elisp

Minor modes in effect:
  shell-dirtrack-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  show-paren-mode: t
  savehist-mode: t
  rcirc-track-minor-mode: t
  global-whitespace-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-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: t

Recent input:
<escape> x r e p o r t <tab> <return>

Recent messages:
Undo!
Quit [2 times]
Loading vc-svn...done
Mark saved where search started
if: End of buffer
Mark set
Press C-c C-c when you are done editing.
Enter a change comment.  Type C-c C-c when done




Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 10 Dec 2008 04:50:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: barry <at> python.org
Cc: 1496 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
Date: Thu, 11 Dec 2008 11:24:35 -0500
> comint-delete-output uses delete-region instead of kill-region because the
> latter sets this-command.

I do not know if it's the reason for it, but I think your suggestion is
about right, except that if the command kills the output, it should be
called comint-kill-output rather than comint-delete-output.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Barry Warsaw <barry <at> python.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Barry Warsaw <barry <at> python.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 1496 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
Date: Thu, 11 Dec 2008 11:48:55 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 11, 2008, at 11:24 AM, Stefan Monnier wrote:

>> comint-delete-output uses delete-region instead of kill-region  
>> because the
>> latter sets this-command.
>
> I do not know if it's the reason for it, but I think your suggestion  
> is
> about right, except that if the command kills the output, it should be
> called comint-kill-output rather than comint-delete-output.

Yes, that's a better name for it, thanks.

I remember reading a comment somewhere that that was the reason for  
using delete-region instead of kill-region, but I could be  
misremembering.

Cheers
- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSUFEd3EjvBPtnXfVAQKLFgP+KPFvYZ9znlSvgRs6M+3w7/1/FBh/8mgJ
qXzaRmmQN803tNFoQN6fx30+z516/m/Oy1Hhx5UFvjrxdS/7mOpXsBr5gd6sPc6n
1lwYY1Fhv//vONfavTIcUV7VopBTERyDIxxOHwO2WyuePVIUq2L37IySF5APQUqz
Q1nnyxsmO3s=
=K/F4
-----END PGP SIGNATURE-----




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Barry Warsaw <barry <at> python.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1496; Package emacs. (Wed, 18 Feb 2009 14:10:06 GMT) Full text and rfc822 format available.

View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: barry <at> python.org
Cc: 1496 <at> debbugs.gnu.org
Subject: bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
Date: Mon, 19 Jul 2021 17:14:02 +0200
barry <at> python.org writes:

> comint-delete-output uses delete-region instead of kill-region because the
> latter sets this-command.  Still, comint-delete-output should copy the killed
> region to the kill ring so that it can be conveniently yanked into other
> buffers.  A use case:
>
> I use bzr diff in a shell buffer to get the changes in my working directory.
> I'd like to copy that output directly into an email or a pastebin buffer.
> With comint-delete-output's current behavior I can't use C-c C-o because the
> output is thrown away.  By adding a call to copy-region-as-kill, I can now go
> to my mail buffer and hit C-y to paste the diff output.

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

I think that sounds like useful functionality, to I've now made
`C-u C-c C-o' save the output on the kill ring (before deleting it) in
Emacs 28.

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




bug marked as fixed in version 28.1, send any further explanations to 1496 <at> debbugs.gnu.org and barry <at> python.org Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 19 Jul 2021 15:15:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 17 Aug 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 223 days ago.

Previous Next


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