all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: change "word" definition (syntax table) for double-click?
Date: Sat, 29 Nov 2008 18:13:21 -0800 (PST)	[thread overview]
Message-ID: <e2c70753-359b-4aef-8ee1-9abb84530f5d@w24g2000prd.googlegroups.com> (raw)
In-Reply-To: c34c9aed-a150-4a11-b30e-94846001fb69@y1g2000pra.googlegroups.com



ead-gnu-em...@ixian.com wrote:
> Hello,
>
> How can I have a double-click on for instance the middle "o" in
> "http://www.foo.com/" highlight the entirety of "http://www.foo.com/"
> rather than merely the word "foo"?
>
> I'm using this version of Emacs:
>     GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
>     of 2008-11-09 on raven, modified by Debian
>
> and I've looked at this web page:
>     Hacking the syntax table
>     http://www.emacswiki.org/emacs/EmacsSyntaxTable#toc3

syntax table is not much fitting here. You can do it like this:

(defun select-url ()
  "Mark the url under cursor."
  (interactive)
;  (require 'thingatpt)
  (let (bds)
      (setq bds (bounds-of-thing-at-point 'url))
      (set-mark (car bds))
      (goto-char (cdr bds))
      )
  )

am not sure how to bind it to double clicking though.

if you want to bind it mid button, you can:

(global-set-key (kbd "<mouse-2>") 'select-url)

the above code assumes you have transient-mark-mode on.

  Xah
∑ http://xahlee.org/

  reply	other threads:[~2008-11-30  2:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29 21:36 change "word" definition (syntax table) for double-click? ead-gnu-emacs
2008-11-30  2:13 ` Xah Lee [this message]
2008-12-01  5:08   ` ead-gnu-emacs
2008-12-01  5:57     ` Xah Lee
2008-12-01 18:29     ` Drew Adams
2008-12-01 18:39       ` Drew Adams
2008-12-01 18:52       ` Drew Adams

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

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

  git send-email \
    --in-reply-to=e2c70753-359b-4aef-8ee1-9abb84530f5d@w24g2000prd.googlegroups.com \
    --to=xahlee@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.