all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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.