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

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

Re: select text without moving the point in graphical interface


From: Michael Heerdegen
Subject: Re: select text without moving the point in graphical interface
Date: Mon, 09 Dec 2013 20:26:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Ernest Adrogué <nfdisco@gmail.com> writes:

> >   (info "(emacs) Secondary Selection")
>
> Yeah, this is exactly it.  Now I guess the question is can I have the
> secondary selection text selection style but using the primary selection
> instead?

It's not intended to do so, I'm afraid; using the secondary selection is
hardcoded for that stuff.

Mmh, maybe we should try to modify the default mouse-1 behavior
instead.  Can you try the following:

--8<---------------cut here---------------start------------->8---
(defun mouse-drag-region-restore-point-advice (f e)
  (let ((opoint (with-selected-window
                    (posn-window (event-start e))
                  (point))))
    (prog1 (funcall f e)
      (run-with-idle-timer
       0 nil
       (lambda (win pos)
         (with-selected-window win
           (deactivate-mark)
           (goto-char pos)))
       (selected-window)  opoint))))

(advice-add 'mouse-drag-region
            :around #'mouse-drag-region-restore-point-advice)
--8<---------------cut here---------------end--------------->8---

Does that behave as you want it to?


Regards,

Michael.




reply via email to

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