emacs-devel
[Top][All Lists]
Advanced

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

Could you possibly DTRT with this for me?


From: Richard Stallman
Subject: Could you possibly DTRT with this for me?
Date: Wed, 18 Feb 2004 03:39:24 -0500

Matthieu sent this change, and I asked him to explain it.
He now has explained it.  I see it is a real minor bug,
but I am not sure what the best clean fix is here.

Is there anyone who can think about it?



From: Richard Stallman <address@hidden>
To: address@hidden
In-reply-to: <address@hidden> (address@hidden)
Subject: Re: Small bug in term.el -- With correction.
bcc: address@hidden
Reply-to: address@hidden
References:  <address@hidden>
--text follows this line--
I am not sure what to do with this.  It doesn't seem to be
a correction to anything in term.el.  Can you explain what
problem it is meant to solve?




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. 


X-Authentication-Warning: crx753.crocrd: mm43 set sender to address@hidden 
using -f
To: address@hidden
Subject: Re: Small bug in term.el -- With correction.
From: Matthieu Moy <address@hidden>
Date: Mon, 12 Jan 2004 19:10:22 +0100
In-Reply-To: <address@hidden> (address@hidden's message of
 "Sat, 3 Jan 2004 22:53:06 -0500")
X-Spam-Status: No, hits=-3.4 required=5.0
        tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,
              REPLY_WITH_QUOTES,USER_AGENT_GNUS_UA,X_AUTH_WARNING
        version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)

address@hidden writes:

> I am not sure what to do with this.  It doesn't seem to be
> a correction to anything in term.el.  Can you explain what
> problem it is meant to solve?

Mouse secondary selection paste  doesn't really work inside a terminal
emulation :

If you  make a  secondary selection on  the word  "ls", then, go  to a
*ansi-term* buffer, and  M-mouse2, then the text is  /inserted/ in the
buffer, but not passed to the shell. 

Type  <return> for  example :  Nothing happens  because the  shell has
received an empty command line.

This is  why term.el  has a re-implementation  of mouse-yank-at-click,
but the problem is that this works only for primary selection. 

address@hidden writes:

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

If you have mouse-yank-at-point to t, yes. 

But I don't,  and I often have  my cursor in the term  buffer, and use
mouse to secondary-select text  in another buffer, and then, M-mouse-2
in the other buffer.

This  is why (define-key  term-raw-map (kbd  "<mouse-2>") ...)  is not
sufficient, and I have to use this

>   (if (eq major-mode 'term-mode)
>       (term-mouse-paste-secondary CLICK nil)
>     (mouse-yank-secondary CLICK)))

Because this tells me in which mode *the buffer containing the cursor*
is, and not the buffer in which i clicked.

The advantage : It works. 

The inconveinient : It adds references to term.el outside term.el ... 


Is it more clear ? 

-- 
Matthieu MOY





reply via email to

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