unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to make dragging with mouse 1 not do highlighting or marking?
@ 2012-12-21 15:45 Ian Kelling
  2012-12-21 16:58 ` Dmitry Gutov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ian Kelling @ 2012-12-21 15:45 UTC (permalink / raw)
  To: help-gnu-emacs

When I hold down mouse-1 and move it around in a buffer, I just want the cursor to 
follow the mouse as I move it. So far, my best guess is to copy mouse-drag-track 
function and remove mark related code.

Thanks,
Ian Kelling



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2012-12-21 15:45 How to make dragging with mouse 1 not do highlighting or marking? Ian Kelling
@ 2012-12-21 16:58 ` Dmitry Gutov
  2012-12-21 17:30   ` Ian Kelling
  2012-12-21 20:26 ` Stephen Berman
  2012-12-27  2:11 ` J. David Boyd
  2 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2012-12-21 16:58 UTC (permalink / raw)
  To: Ian Kelling; +Cc: help-gnu-emacs

Ian Kelling <ianowl@gmail.com> writes:

> When I hold down mouse-1 and move it around in a buffer, I just want the cursor
> to follow the mouse as I move it. So far, my best guess is to copy
> mouse-drag-track function and remove mark related code.

Have you tried rebinding [down-mouse-1] to 'mouse-set-point?



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2012-12-21 16:58 ` Dmitry Gutov
@ 2012-12-21 17:30   ` Ian Kelling
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Kelling @ 2012-12-21 17:30 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: help-gnu-emacs

On 12/21/2012 08:58 AM, Dmitry Gutov wrote:
> Ian Kelling <ianowl@gmail.com> writes:
>
>> When I hold down mouse-1 and move it around in a buffer, I just want the cursor
>> to follow the mouse as I move it. So far, my best guess is to copy
>> mouse-drag-track function and remove mark related code.
> Have you tried rebinding [down-mouse-1] to 'mouse-set-point?
>


Yes. It does not update the point location while dragging.

Specifically
(global-set-key (kbd "<down-mouse-1>") 'mouse-set-point)



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2012-12-21 15:45 How to make dragging with mouse 1 not do highlighting or marking? Ian Kelling
  2012-12-21 16:58 ` Dmitry Gutov
@ 2012-12-21 20:26 ` Stephen Berman
  2012-12-27  2:11 ` J. David Boyd
  2 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2012-12-21 20:26 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 21 Dec 2012 07:45:50 -0800 Ian Kelling <ianowl@gmail.com> wrote:

> When I hold down mouse-1 and move it around in a buffer, I just want the
> cursor to follow the mouse as I move it. So far, my best guess is to copy
> mouse-drag-track function and remove mark related code.

You might find artist.el useful, specifically the command
artist-down-mouse-1 and the function artist-mouse-draw-continously.

Steve Berman




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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2012-12-21 15:45 How to make dragging with mouse 1 not do highlighting or marking? Ian Kelling
  2012-12-21 16:58 ` Dmitry Gutov
  2012-12-21 20:26 ` Stephen Berman
@ 2012-12-27  2:11 ` J. David Boyd
  2013-01-14 17:58   ` Ian Kelling
       [not found]   ` <mailman.17411.1358186333.855.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 9+ messages in thread
From: J. David Boyd @ 2012-12-27  2:11 UTC (permalink / raw)
  To: help-gnu-emacs

Ian Kelling <ianowl@gmail.com> writes:

> When I hold down mouse-1 and move it around in a buffer, I just want
> the cursor to follow the mouse as I move it. So far, my best guess is
> to copy mouse-drag-track function and remove mark related code.
>
> Thanks,
> Ian Kelling


Then, why hold down mouse-1?  I mean, the cursor already follow the
mouse around as you move it....




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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2012-12-27  2:11 ` J. David Boyd
@ 2013-01-14 17:58   ` Ian Kelling
       [not found]   ` <mailman.17411.1358186333.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Ian Kelling @ 2013-01-14 17:58 UTC (permalink / raw)
  To: help-gnu-emacs

On 12/26/2012 06:11 PM, J. David Boyd wrote:
> Ian Kelling <ianowl@gmail.com> writes:
>
>> When I hold down mouse-1 and move it around in a buffer, I just want
>> the cursor to follow the mouse as I move it. So far, my best guess is
>> to copy mouse-drag-track function and remove mark related code.
>>
>> Thanks,
>> Ian Kelling
>
> Then, why hold down mouse-1?  I mean, the cursor already follow the
> mouse around as you move it....
>

Because I do not want to highlight or select a region. The general idea is to be 
able to more easily identify exactly which character the mouse pointer would act on.

I've changed what I want a bit, and need some help from the elisp gurus out there. 
I want the character that the mouse pointer would act on highlighted all the time, 
not just when I press a button. I was able to get it working when a button was 
pressed down using mouse.el code as an example (and mouse+.el). However, that code 
doesn't work in the background so to speak if I try to just run it from my init file.

The critical example from mouse.el is this:

(track-mouse
              (while (progn (setq event  (read-event))
                            (or (mouse-movement-p event)
                                (memq (car-safe event) '(switch-frame 
select-window))))

How can I run code in which I would update an overlay on all on mouse movement 
events?



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
       [not found]   ` <mailman.17411.1358186333.855.help-gnu-emacs@gnu.org>
@ 2013-01-17  4:56     ` Michael Heerdegen
  2013-01-25  8:34       ` Ian Kelling
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2013-01-17  4:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I guess you want something like this:


(defun my-move-cursor (event)
  "Doc..."
  (interactive "e")
  (mouse-set-point event)
  (let (event ov)
    (track-mouse
      (while (progn
               (setq event (read-event))
               (or (mouse-movement-p event)
                   (memq (car-safe event) '(switch-frame select-window))))
        (mouse-set-point event)
        (if ov (move-overlay ov (point)  (1+ (point)))
          (setq ov (make-overlay (point) (1+ (point))))
          (overlay-put ov 'face 'match))))
    (when ov (delete-overlay ov))))

(global-set-key [down-mouse-1] #'my-move-cursor)


Slightly tested.


Regards,

Michael.



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2013-01-17  4:56     ` Michael Heerdegen
@ 2013-01-25  8:34       ` Ian Kelling
  2013-01-25 14:58         ` Ian Kelling
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Kelling @ 2013-01-25  8:34 UTC (permalink / raw)
  To: help-gnu-emacs

On 01/16/2013 08:56 PM, Michael Heerdegen wrote:
> Hi,
>
> I guess you want something like this:
>
>
> (defun my-move-cursor (event)
>    "Doc..."
>    (interactive "e")
>    (mouse-set-point event)
>    (let (event ov)
>      (track-mouse
>        (while (progn
>                 (setq event (read-event))
>                 (or (mouse-movement-p event)
>                     (memq (car-safe event) '(switch-frame select-window))))
>          (mouse-set-point event)
>          (if ov (move-overlay ov (point)  (1+ (point)))
>            (setq ov (make-overlay (point) (1+ (point))))
>            (overlay-put ov 'face 'match))))
>      (when ov (delete-overlay ov))))
>
> (global-set-key [down-mouse-1] #'my-move-cursor)

Yes, that is what I was originally thinking. Thank you. Now I also want an overlay 
to follow the mouse cursor when no button is pressed. I'm having a hard time with 
it. I'm going to post to the list under a new subject to ask about that.

- Ian



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

* Re: How to make dragging with mouse 1 not do highlighting or marking?
  2013-01-25  8:34       ` Ian Kelling
@ 2013-01-25 14:58         ` Ian Kelling
  0 siblings, 0 replies; 9+ messages in thread
From: Ian Kelling @ 2013-01-25 14:58 UTC (permalink / raw)
  To: help-gnu-emacs

On 01/25/2013 12:34 AM, Ian Kelling wrote:
> Yes, that is what I was originally thinking. Thank you. Now I also want an 
> overlay to follow the mouse cursor when no button is pressed. I'm having a hard 
> time with it. I'm going to post to the list under a new subject to ask about that.
>
> - Ian

I figured out the trick to tracking the mouse all the time.
(setq track-mouse t)
and bind to <mouse-movement>




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

end of thread, other threads:[~2013-01-25 14:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-21 15:45 How to make dragging with mouse 1 not do highlighting or marking? Ian Kelling
2012-12-21 16:58 ` Dmitry Gutov
2012-12-21 17:30   ` Ian Kelling
2012-12-21 20:26 ` Stephen Berman
2012-12-27  2:11 ` J. David Boyd
2013-01-14 17:58   ` Ian Kelling
     [not found]   ` <mailman.17411.1358186333.855.help-gnu-emacs@gnu.org>
2013-01-17  4:56     ` Michael Heerdegen
2013-01-25  8:34       ` Ian Kelling
2013-01-25 14:58         ` Ian Kelling

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