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: Ernest Adrogué
Subject: Re: select text without moving the point in graphical interface
Date: Tue, 10 Dec 2013 19:58:55 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

 9-12-2013, 20:26 (+0100); Michael Heerdegen escriu:
> 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?

I can't get this to work, because I don't have this `advice-add` function in
my Emacs (I currently use version 24.3.1). As I'm not familiar with advices,
I redefined `mouse-drag-region` with your function instead, but this doesn't
work either. When I left-click I get:

"Wrong type of argument: commandp, mouse-drag-region"



reply via email to

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