[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#1496: 23.0.60; comint-delete-output should copy region to the kill r
From: |
barry |
Subject: |
bug#1496: 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
- bug#1496: 23.0.60; comint-delete-output should copy region to the kill ring,
barry <=