[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Redefining (forward-word) and (backward-word)
From: |
Andreas Röhler |
Subject: |
Re: Redefining (forward-word) and (backward-word) |
Date: |
Mon, 5 May 2008 10:33:20 +0200 |
User-agent: |
KMail/1.9.5 |
Am Sonntag, 4. Mai 2008 19:56 schrieb Johan Bockgård:
> (defun my-forward-word (&optional arg)
> (interactive "p")
> (dotimes (n arg)
> (goto-char (1+ (point)))
> (re-search-forward "\\b" nil t)))
Great, thanks!
So let's give them still an appropriate name and make it move
backward too.
(defun next-word-boundary (&optional arg)
"Move point forward arg word boundaries (backward if arg is negative)"
(interactive "p")
(if (< 0 arg)
(dotimes (n arg)
(goto-char (1+ (point)))
(re-search-forward "\\b" nil t))
(dotimes (n (abs arg))
(goto-char (1- (point)))
(re-search-backward "\\b" nil t))))
Andreas Röhler