[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: forward-word and NamesLikeThis
From: |
B. T. Raven |
Subject: |
Re: forward-word and NamesLikeThis |
Date: |
Sun, 18 Jun 2006 23:14:31 -0500 |
"Drew Adams" <drew.adams@oracle.com> wrote in message
news:mailman.3013.1150683192.9609.help-gnu-emacs@gnu.org...
> (defun forward-stud ()
> (interactive)
> (while (not (looking-at " \|[A-Z]")) (forward-char))
> (forward-char))
> why doesn't it stop at all characters following spaces and at upper
case
> characters. I have never used the \| before so I suppose something
is
> wrong with the regexp, but what?
>
> Use two backslashes to insert a backslash in a Lisp string: \\|.
Of course. Thanks. Now that it sort of works I can see that the approach
is hopelessly naive. If I needed such a thing I would use the
SubWordMinorMode suggested by Johan. The latest cut, such as it is:
(defun forward-stud ()
"Move point forward to next word or upper case character as the case may
be"
(interactive)
(forward-char)
(while (not (looking-at " \\|[A-Z]"))
(forward-char))
(while (looking-at " ") (forward-char))
(while (looking-at ";") (foward-line))
(while (eolp) (forward-char))
)