[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
change "word" definition (syntax table) for double-click?
From: |
ead-gnu-emacs |
Subject: |
change "word" definition (syntax table) for double-click? |
Date: |
Sat, 29 Nov 2008 13:36:19 -0800 (PST) |
User-agent: |
G2/1.0 |
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
, specifically this note:
You can also set which syntax table is used on a per command
basis.
Here is how to use my-wacky-syntax-table with the C-M-f shortcut,
bound to forward-sexp by default.
(global-set-key "\C-\M-f" '(lambda ()
(interactive)
(with-syntax-table my-wacky-syntax-table (forward-sexp))))
; and I've created my own syntax table wherein all non-whitespace
characters are word characters:
(defvar my-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\n "-" table)
(modify-syntax-entry ?! "w" table)
(modify-syntax-entry ?\" "w" table)
(modify-syntax-entry ?# "w" table)
(modify-syntax-entry ?$ "w" table)
(modify-syntax-entry ?% "w" table)
(modify-syntax-entry ?& "w" table)
(modify-syntax-entry ?' "w" table)
(modify-syntax-entry ?\( "w" table)
(modify-syntax-entry ?\) "w" table)
(modify-syntax-entry ?* "w" table)
(modify-syntax-entry ?+ "w" table)
(modify-syntax-entry ?, "w" table)
(modify-syntax-entry ?- "w" table)
(modify-syntax-entry ?. "w" table)
(modify-syntax-entry ?/ "w" table)
(modify-syntax-entry ?: "w" table)
(modify-syntax-entry ?\; "w" table)
(modify-syntax-entry ?< "w" table)
(modify-syntax-entry ?= "w" table)
(modify-syntax-entry ?> "w" table)
(modify-syntax-entry ?? "w" table)
(modify-syntax-entry ?@ "w" table)
(modify-syntax-entry ?\[ "w" table)
(modify-syntax-entry ?\\ "w" table)
(modify-syntax-entry ?\] "w" table)
(modify-syntax-entry ?^ "w" table)
(modify-syntax-entry ?_ "w" table)
(modify-syntax-entry ?` "w" table)
(modify-syntax-entry ?{ "w" table)
(modify-syntax-entry ?| "w" table)
(modify-syntax-entry ?} "w" table)
(modify-syntax-entry ?~ "w" table)
table))
; and I've attempted to bind mouse-set-point to [(double-mouse-1)]
using
the above syntax table:
(global-set-key [(double-mouse-1)] 'my-double-mouse-1)
(defun my-double-mouse-1 (event)
"Run mouse-set-point with my syntax table."
(interactive "e")
(with-syntax-table my-syntax-table (mouse-set-point)))
. However, I get an error message when I perform a double-click:
progn: Wrong number of arguments: #[(event) "\301^H!\210\302^H
\211^X
:\203]^@\303^H8:\203^W^@\303\202^X^@\304^H8\202#^@\305 `
\306\307F)!
\207" [event mouse-minibuffer-check posn-set-point 2 1 selected
window
(0 . 0) 0] 6 581237 "e"], 0
So, where am I going wrong? How can I have my syntax table be applied
to
a double-click?
Thanks a million,
Eric
--
Eric De Mund | Ixian Systems | Jab: eadixian@jabber.org/
main
ead@ixian.com | 650 Castro St, #120-210 | Y!M: ead0002
ixian.com/ead/ | Mountain View, CA 94041 | ICQ: 811788
- change "word" definition (syntax table) for double-click?,
ead-gnu-emacs <=