all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Elisp code to choose a region covering a word
@ 2010-11-18 10:22 ishi soichi
  2010-11-18 11:45 ` Tassilo Horn
  2010-11-18 11:46 ` Deniz Dogan
  0 siblings, 2 replies; 6+ messages in thread
From: ishi soichi @ 2010-11-18 10:22 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 12206 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-19  6:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 10:22 Elisp code to choose a region covering a word ishi soichi
2010-11-18 11:45 ` Tassilo Horn
2010-11-18 12:10   ` Tassilo Horn
2010-11-18 15:31     ` Drew Adams
2010-11-18 11:46 ` Deniz Dogan
2010-11-19  6:49   ` ishi soichi

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.