unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mouse-yank-at-point in Comint modes
@ 2006-12-07  1:16 JD Smith
  2006-12-09 18:22 ` Chong Yidong
  2007-01-24 18:32 ` Bob Portmann
  0 siblings, 2 replies; 7+ messages in thread
From: JD Smith @ 2006-12-07  1:16 UTC (permalink / raw)




COMINT modes like shell inhibit the behavior of mouse-yank-at-point.  

M-x shell
M-x set-variable [Ret] mouse-yank-at-point [Ret] t
% echo foo [C-a]
[Select text in another buffer and middle click into shell buffer, after
'foo']

Text is not yanked at point.  This is a new behavior of Emacs 22.

JD

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mouse-yank-at-point in Comint modes
  2006-12-07  1:16 JD Smith
@ 2006-12-09 18:22 ` Chong Yidong
  2007-01-24 18:32 ` Bob Portmann
  1 sibling, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2006-12-09 18:22 UTC (permalink / raw)
  Cc: emacs-devel

JD Smith <jdsmith@as.arizona.edu> writes:

> COMINT modes like shell inhibit the behavior of mouse-yank-at-point.  
>
> M-x shell
> M-x set-variable [Ret] mouse-yank-at-point [Ret] t
> % echo foo [C-a]
> [Select text in another buffer and middle click into shell buffer, after
> 'foo']
>
> Text is not yanked at point.  This is a new behavior of Emacs 22.

I'm a bit confused about what's going on in this part of the code.
This issue has come up before:

    2005-03-24  Stefan Monnier  <monnier@iro.umontreal.ca>

      * comint.el (comint-insert-input): Obey mouse-yank-at-point.

It's not clear to me how subsequent changes broke this.  Naively, I'd
propose the following change; are there subtleties here that would
make it not work?

*** emacs/lisp/comint.el.~1.352.~	2006-12-09 10:48:30.000000000 -0500
--- emacs/lisp/comint.el	2006-12-09 13:15:19.000000000 -0500
***************
*** 805,811 ****
  (defun comint-insert-input (event)
    "In a Comint buffer, set the current input to the previous input at point."
    (interactive "e")
!   (mouse-set-point event)
    (let ((pos (point)))
      (if (not (eq (field-at-pos pos) 'input))
  	;; No input at POS, fall back to the global definition.
--- 805,811 ----
  (defun comint-insert-input (event)
    "In a Comint buffer, set the current input to the previous input at point."
    (interactive "e")
!   (unless mouse-yank-at-point (mouse-set-point event))
    (let ((pos (point)))
      (if (not (eq (field-at-pos pos) 'input))
  	;; No input at POS, fall back to the global definition.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mouse-yank-at-point in Comint modes
  2006-12-07  1:16 JD Smith
  2006-12-09 18:22 ` Chong Yidong
@ 2007-01-24 18:32 ` Bob Portmann
  1 sibling, 0 replies; 7+ messages in thread
From: Bob Portmann @ 2007-01-24 18:32 UTC (permalink / raw)
  To: emacs-devel

This bug is still present in the emacs-22.0.93 pretest.

--- JD Smith <jdsmith@as.arizona.edu> wrote:

> 
> 
> COMINT modes like shell inhibit the behavior of mouse-yank-at-point. 
> 
> 
> M-x shell
> M-x set-variable [Ret] mouse-yank-at-point [Ret] t
> % echo foo [C-a]
> [Select text in another buffer and middle click into shell buffer,
> after
> 'foo']
> 
> Text is not yanked at point.  This is a new behavior of Emacs 22.
> 
> JD
> 
> 
> 
> 
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
> 




 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

^ permalink raw reply	[flat|nested] 7+ messages in thread

* mouse-yank-at-point in Comint modes
@ 2008-09-11 21:37 Bob
  0 siblings, 0 replies; 7+ messages in thread
From: Bob @ 2008-09-11 21:37 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

The simple fix described in this email:

http://www.nabble.com/mouse-yank-at-point-in-Comint-modes-td7731895.html

never got applied to the trunk.  Thus the problem of yanks not honoring
mouse-yank-at-point is still present in comint mode.  Is it possible that it
could be applied?  Here is an updated version of the patch:

--- emacs/lisp/comint.el    2008-09-08 14:46:43.000000000 -0600
+++ emacs-080908/lisp/comint.el    2008-09-11 15:24:11.000000000 -0600
@@ -815,7 +815,7 @@
 If there is no previous input at point, run the command specified
 by the global keymap (usually `mouse-yank-at-point')."
   (interactive "e")
-  (mouse-set-point event)
+  (unless mouse-yank-at-point (mouse-set-point event))
   (let ((pos (posn-point (event-end event)))
     field input)
     (with-selected-window (posn-window (event-end event))

Thanks,
Bob

[-- Attachment #2: Type: text/html, Size: 1160 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* mouse-yank-at-point in Comint modes
@ 2009-05-14 23:59 Bob Nnamtrop
  2009-12-01 20:34 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Bob Nnamtrop @ 2009-05-14 23:59 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

Comint mode does not honor mouse-yank-at-point.  This has been mentioned in
2006 and 2008 in these posts:

http://www.nabble.com/mouse-yank-at-point-in-Comint-modes-to19445336.html

http://www.nabble.com/mouse-yank-at-point-in-Comint-modes-to7731895.html

Here is an updated patch of the simple one-line fix (which works great in my
usage).  Could it get applied before the release?

--- emacs-23.0.93/lisp/comint.el    2009-01-06 13:29:03.000000000 -0700
+++ emacs/lisp/comint.el    2009-05-14 17:31:05.000000000 -0600
@@ -816,7 +816,7 @@
 If there is no previous input at point, run the command specified
 by the global keymap (usually `mouse-yank-at-point')."
   (interactive "e")
-  (mouse-set-point event)
+  (unless mouse-yank-at-point (mouse-set-point event))
   (let ((pos (posn-point (event-end event)))
     field input)
     (with-selected-window (posn-window (event-end event))

<http://www.nabble.com/mouse-yank-at-point-in-Comint-modes-td7731895.html>Here
is another simple patch which fixes another annoyance.  When the mouse is
over an old input in comint mode, that input is highlighted and a mouse-2
click will yank it to the command line.  This is fine except that it still
happens if the mouse is beyond the end of the old input and the old input is
not highlighted.  This simple patch fixes this.  Could it also get applied
before the release?

diff -r -u emacs-23.0.93/lisp/subr.el emacs/lisp/subr.el
--- emacs-23.0.93/lisp/subr.el    2009-04-28 22:45:17.000000000 -0600
+++ emacs/lisp/subr.el    2009-05-14 17:52:33.000000000 -0600
@@ -2319,10 +2319,11 @@

 (defun field-at-pos (pos)
   "Return the field at position POS, taking stickiness etc into account."
-  (let ((raw-field (get-char-property (field-beginning pos) 'field)))
-    (if (eq raw-field 'boundary)
-    (get-char-property (1- (field-end pos)) 'field)
-      raw-field)))
+  (if (< pos (field-end pos))
+      (let ((raw-field (get-char-property (field-beginning pos) 'field)))
+        (if (eq raw-field 'boundary)
+            (get-char-property (1- (field-end pos)) 'field)
+          raw-field))))



 ;;;; Support for yanking and text properties.

[-- Attachment #2: Type: text/html, Size: 2562 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mouse-yank-at-point in Comint modes
  2009-05-14 23:59 mouse-yank-at-point in Comint modes Bob Nnamtrop
@ 2009-12-01 20:34 ` Stefan Monnier
  2009-12-02  0:30   ` Bob Nnamtrop
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2009-12-01 20:34 UTC (permalink / raw)
  To: Bob Nnamtrop; +Cc: emacs-devel

> --- emacs-23.0.93/lisp/comint.el    2009-01-06 13:29:03.000000000 -0700
> +++ emacs/lisp/comint.el    2009-05-14 17:31:05.000000000 -0600
> @@ -816,7 +816,7 @@
>  If there is no previous input at point, run the command specified
>  by the global keymap (usually `mouse-yank-at-point')."
>    (interactive "e")
> -  (mouse-set-point event)
> +  (unless mouse-yank-at-point (mouse-set-point event))
>    (let ((pos (posn-point (event-end event)))
>      field input)
>      (with-selected-window (posn-window (event-end event))

Thanks.  This has been fixed by never calling mouse-set-point here.

>  (defun field-at-pos (pos)
>    "Return the field at position POS, taking stickiness etc into account."
> -  (let ((raw-field (get-char-property (field-beginning pos) 'field)))
> -    (if (eq raw-field 'boundary)
> -    (get-char-property (1- (field-end pos)) 'field)
> -      raw-field)))
> +  (if (< pos (field-end pos))
> +      (let ((raw-field (get-char-property (field-beginning pos) 'field)))
> +        (if (eq raw-field 'boundary)
> +            (get-char-property (1- (field-end pos)) 'field)
> +          raw-field))))

I'm not sure fixing it in field-at-pos is right, so I fixed it in
a similar way in cominut-insert-input.  Thank you for your help,


        Stefan









^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mouse-yank-at-point in Comint modes
  2009-12-01 20:34 ` Stefan Monnier
@ 2009-12-02  0:30   ` Bob Nnamtrop
  0 siblings, 0 replies; 7+ messages in thread
From: Bob Nnamtrop @ 2009-12-02  0:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

On Tue, Dec 1, 2009 at 1:34 PM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> > --- emacs-23.0.93/lisp/comint.el    2009-01-06 13:29:03.000000000 -0700
> > +++ emacs/lisp/comint.el    2009-05-14 17:31:05.000000000 -0600
> > @@ -816,7 +816,7 @@
> >  If there is no previous input at point, run the command specified
> >  by the global keymap (usually `mouse-yank-at-point')."
> >    (interactive "e")
> > -  (mouse-set-point event)
> > +  (unless mouse-yank-at-point (mouse-set-point event))
> >    (let ((pos (posn-point (event-end event)))
> >      field input)
> >      (with-selected-window (posn-window (event-end event))
>
> Thanks.  This has been fixed by never calling mouse-set-point here.
>
> >  (defun field-at-pos (pos)
> >    "Return the field at position POS, taking stickiness etc into
> account."
> > -  (let ((raw-field (get-char-property (field-beginning pos) 'field)))
> > -    (if (eq raw-field 'boundary)
> > -    (get-char-property (1- (field-end pos)) 'field)
> > -      raw-field)))
> > +  (if (< pos (field-end pos))
> > +      (let ((raw-field (get-char-property (field-beginning pos)
> 'field)))
> > +        (if (eq raw-field 'boundary)
> > +            (get-char-property (1- (field-end pos)) 'field)
> > +          raw-field))))
>
> I'm not sure fixing it in field-at-pos is right, so I fixed it in
> a similar way in cominut-insert-input.  Thank you for your help,
>
>
Thanks for the fixes.  I just tried them and they work fine.

Bob

[-- Attachment #2: Type: text/html, Size: 2034 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-02  0:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 23:59 mouse-yank-at-point in Comint modes Bob Nnamtrop
2009-12-01 20:34 ` Stefan Monnier
2009-12-02  0:30   ` Bob Nnamtrop
  -- strict thread matches above, loose matches on Subject: below --
2008-09-11 21:37 Bob
2006-12-07  1:16 JD Smith
2006-12-09 18:22 ` Chong Yidong
2007-01-24 18:32 ` Bob Portmann

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).