[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: highlight select whole word when in the middle shortcut
From: |
Scott Frazer |
Subject: |
Re: highlight select whole word when in the middle shortcut |
Date: |
Wed, 08 Dec 2010 15:08:02 -0000 |
User-agent: |
G2/1.0 |
On May 12, 3:02 am, Robert Knighten <R...@knighten.org> wrote:
> Kevin Rodgers <kevin.d.rodg...@gmail.com> writes:
> > Colin S. Miller wrote:
> >> mouezapeter wrote:
> >>> Hi,
> >>> If I am in the middle of the word "deduction", is there a shortcut to
> >>> highlight,select the hole word ?
>
> >> Hi,
> >> If you are using a GUI, then double-click on the word to select it.
> >> Otherwise, add this to your .emacs, restart, and then press C-x w
>
> >> HTH,
> >> Colin S. Miller
>
> >> (defun select-word-at-point ()
> >> (interactive)
> >> (let ((p (bounds-of-thing-at-point 'word)))
> >> (set-mark (car p))
> >> (exchange-point-and-mark)
> >> (set-mark (cdr p))
> >> ))
>
> >> (global-set-key '[(control x) (w)] 'select-word-at-point)
>
> > M-x mark-word
>
> That just marks to the end of the word.
>
> --
> Robert L. Knighten
> R...@knighten.org
I use this:
(defun my-select-word-at-point ()
"Select the word at point."
(interactive)
(skip-syntax-forward "w_")
(push-mark (point))
(skip-syntax-backward "w_")
(exchange-point-and-mark))