[Top][All Lists]

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

Re: Need an enabler for a bad habit.

From: martin rudalics
Subject: Re: Need an enabler for a bad habit.
Date: Thu, 02 Nov 2006 08:36:39 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

You probably want something like the below.  Replace
`execute-extended-command' by whatever you need.

(defun mouse-drag-region (start-event)
  "Set the region to the text that the mouse is dragged over.
Highlight the drag area as you move the mouse.
This must be bound to a button-down mouse event.
In Transient Mark mode, the highlighting remains as long as the mark
remains active.  Otherwise, it remains until the next input event.

If the click is in the echo area, run a command."
  (interactive "e")
  (let ((w (posn-window (event-start start-event))))
    (if (and (window-minibuffer-p w)
             (not (minibuffer-window-active-p w)))
          ;; Swallow the up-event.
          (call-interactively 'execute-extended-command))
      ;; Give temporary modes such as isearch a chance to turn off.
      (run-hooks 'mouse-leave-buffer-hook)
      (mouse-drag-track start-event t))))

reply via email to

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