help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Elisp code to choose a region covering a word


From: Elena
Subject: Re: Elisp code to choose a region covering a word
Date: Wed, 08 Dec 2010 15:36:39 -0000
User-agent: G2/1.0

On 18 Nov, 10:22, ishi soichi <soichi...@gmail.com> wrote:
> I am trying to develop an elisp program that sets a region covering a word
> in text.
> I am a newbie in elisp so please be adviced.
>
> For example, we have a text like...
>
> ----------------------------
> In late 2008, it (<=point here!!!)  reduced its interest to 13 percent to
> raise much-needed cash, in a move that many saw as the beginning of a
> distancing of the long-time partners. Ford's stake fell further to 11
> percent when Mazda issued new shares last year.
> ----------------------
>
> by tying "C-f" (I know it's not a good idea to override "C-f". It's a test),
> the region is set to be
>
> ----------------------------
> In late 2008, it (Mark here!!!=>) reduced(<=point here!!!) its interest to
> 13 percent to raise much-needed cash, in a move that many saw as the
> beginning of a distancing of the long-time partners. Ford's stake fell
> further to 11 percent when Mazda issued new shares last year.
> ----------------------
>
> by typing "C-f" again, the region would be
>
> ----------------------------
> In late 2008, it reduced (Mark here!!!=>)its(<=point here!!!) interest to 13
> percent to raise much-needed cash, in a move that many saw as the beginning
> of a distancing of the long-time partners. Ford's stake fell further to 11
> percent when Mazda issued new shares last year.
> ----------------------
>
> and so on.  Every time we execute the interactive function, each individual
> word is chosen.  So I tried,
>
> ;;-------------------------
> (defun word-choice ()
>   (interactive)
>   (let  (foo)
> (re-search-forward "\\w")
> (goto-char (match-beginning 0))
> (setq foo (point-marker))
> (re-search-forward "\\s ")
> (goto-char (match-beginning 0))
> ))
> (define-key global-map "\C-f" 'word-choice)
> ;;---------------------------
>
> Obviously it does not do the job.  I don't think it sets a mark at all.
>  Maybe the use of "point-marker" is wrong.
> Could anyone help me for it?
>
> soichi

Maybe is a call to `push-mark' missing?


reply via email to

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