bug-gnu-emacs
[Top][All Lists]
Advanced

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

Small bug in term.el -- With correction.


From: matthieu . moy
Subject: Small bug in term.el -- With correction.
Date: Tue, 30 Sep 2003 16:09:49 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (sparc-sun-solaris2.5.1)

Hi ! 

There's a problem with term.el, in  char mode. If you split your frame
in  two windows,  one  with the  term  buffer, and  the  other with  a
standard  buffer, if your  cursor is  in the  standard buffer  and you
middle-click in  the term  buffer, then, you  get an error  instead of
pasting the text. 

I'm using the following workaround :

  (define-key term-raw-map (kbd "<mouse-2>") '(lambda (c a)
                                                (interactive "e\nP")
                                                (mouse-set-point c)
                                                (term-mouse-paste c
                                                                  a)))

But  the  line (mouse-set-point  c)  should  simply  be added  to  the
beginning of term-mouse-paste, is it ? 




Similarly, the secondary selection  pasting doesn't work well, because
the   text   gets   inserted   in   the  buffer   instead   of   being
"term-raw-string"-ed. 

I'm using the following :

(defun term-mouse-paste-secondary (click arg)
  "Insert the last stretch of killed text at the position clicked on."
  (interactive "e\nP")
  (term-if-xemacs
   (term-send-raw-string (or (condition-case () (x-get-selection 'SECONDARY) 
(error ()))
                             (x-get-cutbuffer)
                             (error "No selection or cut buffer available"))))
  (term-ifnot-xemacs
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (setq this-command 'yank)
   (term-send-raw-string (condition-case () (x-get-selection 'SECONDARY) (error 
())))))

(defun my-mouse-yank-secondary (CLICK)
  "Insert the secondary selection at point
regardless of where you click."
  (interactive "e")
  (if (eq major-mode 'term-mode)
      (term-mouse-paste-secondary CLICK nil)
    (mouse-yank-secondary CLICK)))

and  I call  my-mouse-yank-secondary instead  of mouse-yank-secondary.
This should be doable also with defadvice. 


Hopes this helps,


PS: the  email address of  the author of  term.el (bothner@cygnus.com)
seems to be invalid

<bothner@cygnus.com>: host cygnusentertainment.com[65.240.187.162] said: 553
    5.3.0 <bothner@cygnus.com>... No such user here (in reply to RCPT TO
    command)

-- 
Matthieu MOY                                    Ph. D Student
STMicroelectronics  -----  System and Architecture Technology
Verimag  --------  Synchronous Languages and Reactive Systems




reply via email to

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