* elisp oddity: search-forward-regexp and search-backward-regexp not symmetric
@ 2010-06-21 9:42 Xah Lee
0 siblings, 0 replies; only message in thread
From: Xah Lee @ 2010-06-21 9:42 UTC (permalink / raw)
To: help-gnu-emacs
Summary: if you do search-forward-regexp with " +", then it'll skip
all spaces. However, if you use the backward version, it'll stop at
the first space.
reading the inline doc carefully, it seems the behavior is as
specified in the doc... seems odd.
(defun xub-forward-to-space ()
"Move cursor forward to next end of space or newline."
(interactive)
(search-forward-regexp " +\\|\n+" nil t)
)
(defun xub-backward-to-space ()
"Move cursor backward to previous beginning of space or newline."
(interactive)
(search-backward-regexp " +\\|\n+" nil t)
)
Thanks.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-21 9:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21 9:42 elisp oddity: search-forward-regexp and search-backward-regexp not symmetric Xah Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).