emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

M-x term & keyboard cut-and-paste


From: Mark Plaksin
Subject: M-x term & keyboard cut-and-paste
Date: Sat, 15 Mar 2008 16:06:03 -0400
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

I want to use the keyboard to do cut-and-paste while in a term.  I use
the code below so C-s turns on term-line-mode, M-w runs
kill-ring-save and switches back to raw mode, and C-y yanks.

It works fine most of the time but sometimes an extra newline appears
at the end of the buffer after I hit M-w.  This makes the shell think
I've hit RET which is not always good :)  When it happens, it is
(goto-char (point-max)) that causes it.  I'm sure I'm missing something
fundamental but I can't see it.

Any help is appreciated.  And, whether it's my code or something else,
having keyboard cut-and-paste in M-x term would be great.

Here's how I reproduce it:
vi /etc/aliases
:q!
diff /etc/aliases /etc/passwd
C-s C-p C-p C-p 
C-a C-SPC C-e M-w

(define-key term-raw-map "\C-s"
  '(lambda ()
     (interactive)
     (term-line-mode)
     (set-mark (point))))

(define-key term-mode-map "\ew"
  '(lambda ()
     (interactive)
     ;;(debug)
     (kill-ring-save (mark) (point))
     (goto-char (point-max))
     (term-char-mode)))

(define-key term-raw-map "\C-y"
  '(lambda ()
     (interactive)
     (term-line-mode)
     (yank)
     (term-char-mode)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]