all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Could you possibly DTRT with this for me?
@ 2004-02-18  8:39 Richard Stallman
  0 siblings, 0 replies; only message in thread
From: Richard Stallman @ 2004-02-18  8:39 UTC (permalink / raw)


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 <rms@gnu.org>
To: matthieu.moy@st.com
In-reply-to: <ph27k3q8j0y.fsf@st.com> (matthieu.moy@st.com)
Subject: Re: Small bug in term.el -- With correction.
bcc: rms-outgoing@gnu.org
Reply-to: rms@gnu.org
References:  <ph27k3q8j0y.fsf@st.com>
--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 Matthieu.Moy@st.com using -f
To: rms@gnu.org
Subject: Re: Small bug in term.el -- With correction.
From: Matthieu Moy <Matthieu.Moy@st.com>
Date: Mon, 12 Jan 2004 19:10:22 +0100
In-Reply-To: <E1AczK6-00054C-Lz@fencepost.gnu.org> (rms@gnu.org'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)

rms@gnu.org 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. 

rms@gnu.org 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-02-18  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-18  8:39 Could you possibly DTRT with this for me? Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.