unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
@ 2008-12-04 23:37 barry
  2008-12-11 16:24 ` Stefan Monnier
  2021-07-19 15:14 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: barry @ 2008-12-04 23:37 UTC (permalink / raw)
  To: emacs-pretest-bug

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






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

* bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
  2008-12-04 23:37 bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring barry
@ 2008-12-11 16:24 ` Stefan Monnier
  2008-12-11 16:48   ` Barry Warsaw
  2021-07-19 15:14 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-12-11 16:24 UTC (permalink / raw)
  To: barry; +Cc: emacs-pretest-bug, 1496

> 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






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

* bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
  2008-12-11 16:24 ` Stefan Monnier
@ 2008-12-11 16:48   ` Barry Warsaw
  0 siblings, 0 replies; 4+ messages in thread
From: Barry Warsaw @ 2008-12-11 16:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-pretest-bug, 1496

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






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

* bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring
  2008-12-04 23:37 bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring barry
  2008-12-11 16:24 ` Stefan Monnier
@ 2021-07-19 15:14 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-19 15:14 UTC (permalink / raw)
  To: barry; +Cc: 1496

barry@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





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

end of thread, other threads:[~2021-07-19 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-04 23:37 bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring barry
2008-12-11 16:24 ` Stefan Monnier
2008-12-11 16:48   ` Barry Warsaw
2021-07-19 15:14 ` 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).