unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Ernest Adrogué" <nfdisco@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: select text without moving the point in graphical interface
Date: Tue, 10 Dec 2013 19:58:55 +0100	[thread overview]
Message-ID: <20131210185855.GA32729@doriath.local> (raw)
In-Reply-To: <877gbdesh1.fsf@web.de>

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	other threads:[~2013-12-10 18:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08 19:00 select text without moving the point in graphical interface Ernest Adrogué
2013-12-08 19:11 ` Drew Adams
2013-12-08 19:34   ` Ernest Adrogué
2013-12-08 20:24     ` Drew Adams
2013-12-08 20:41       ` Ernest Adrogué
2013-12-08 22:13         ` Drew Adams
2013-12-09  1:53           ` Bob Proulx
2013-12-09  3:45           ` Eli Zaretskii
     [not found]           ` <<83fvq2znym.fsf@gnu.org>
2013-12-09  5:17             ` Drew Adams
2013-12-09 16:20               ` Eli Zaretskii
     [not found]               ` <<83bo0qyp1d.fsf@gnu.org>
2013-12-09 18:16                 ` Drew Adams
2013-12-09 18:33                   ` Eli Zaretskii
     [not found]                   ` <<8338m1zxfj.fsf@gnu.org>
2013-12-09 18:59                     ` Drew Adams
2013-12-08 21:25 ` Michael Heerdegen
2013-12-08 22:58   ` Ernest Adrogué
2013-12-09 19:26     ` Michael Heerdegen
2013-12-10 18:58       ` Ernest Adrogué [this message]
2013-12-10 19:02         ` Drew Adams
2013-12-10 19:13         ` Michael Heerdegen
2013-12-10 19:26           ` Ernest Adrogué

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131210185855.GA32729@doriath.local \
    --to=nfdisco@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).