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

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

Re: How to make dragging with mouse 1 not do highlighting or marking?


From: Ian Kelling
Subject: Re: How to make dragging with mouse 1 not do highlighting or marking?
Date: Fri, 25 Jan 2013 00:34:28 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

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



reply via email to

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