all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elisp regexp, what does this mean?
@ 2009-03-03  8:22 heinz.eriksson
  2009-03-03  9:38 ` Lennart Borgman
  2009-03-03 10:07 ` Alan Mackenzie
  0 siblings, 2 replies; 3+ messages in thread
From: heinz.eriksson @ 2009-03-03  8:22 UTC (permalink / raw
  To: help-gnu-emacs

I am trying to understand what the following:

(defun erl-ie-eval-expression (node)
  (interactive (list (erl-ie-read-nodename)))
  (erl-ie-read-nodename)
  (let ((end (point))
	(beg (save-excursion
	       (loop do (re-search-backward "\\(\\`\\|^\\<\\)")
		     while (looking-at "end"))
	       (point))))
    (erl-ie-evaluate beg end node t)))

Or rather the inner part involving the (scattered toothpick style)
regexp.

It is a function in distel-ie.el in http://code.google.com/p/distel/

I understand that the intent of the function is to grab a piece of
erlang source code and  pass it over for evaluation on the erlang
side. Doing so by starting from point and looking backward until...
yes, what/how?

BR


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

* Re: elisp regexp, what does this mean?
  2009-03-03  8:22 elisp regexp, what does this mean? heinz.eriksson
@ 2009-03-03  9:38 ` Lennart Borgman
  2009-03-03 10:07 ` Alan Mackenzie
  1 sibling, 0 replies; 3+ messages in thread
From: Lennart Borgman @ 2009-03-03  9:38 UTC (permalink / raw
  To: heinz.eriksson; +Cc: help-gnu-emacs

On Tue, Mar 3, 2009 at 9:22 AM,  <heinz.eriksson@gmail.com> wrote:
> I am trying to understand what the following:
>
> (defun erl-ie-eval-expression (node)
>  (interactive (list (erl-ie-read-nodename)))
>  (erl-ie-read-nodename)
>  (let ((end (point))
>        (beg (save-excursion
>               (loop do (re-search-backward "\\(\\`\\|^\\<\\)")
>                     while (looking-at "end"))
>               (point))))
>    (erl-ie-evaluate beg end node t)))
>
> Or rather the inner part involving the (scattered toothpick style)
> regexp.
>
> It is a function in distel-ie.el in http://code.google.com/p/distel/
>
> I understand that the intent of the function is to grab a piece of
> erlang source code and  pass it over for evaluation on the erlang
> side. Doing so by starting from point and looking backward until...
> yes, what/how?


(beginning of buffer) OR (beginning of line FOLLOWED BY start of word)

See (info "(elisp) Regexp Backslash")




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

* Re: elisp regexp, what does this mean?
  2009-03-03  8:22 elisp regexp, what does this mean? heinz.eriksson
  2009-03-03  9:38 ` Lennart Borgman
@ 2009-03-03 10:07 ` Alan Mackenzie
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2009-03-03 10:07 UTC (permalink / raw
  To: help-gnu-emacs

heinz.eriksson@gmail.com wrote:
> I am trying to understand what the following:

> (defun erl-ie-eval-expression (node)
>  (interactive (list (erl-ie-read-nodename)))
>  (erl-ie-read-nodename)
>  (let ((end (point))
>        (beg (save-excursion
>               (loop do (re-search-backward "\\(\\`\\|^\\<\\)")
>                     while (looking-at "end"))
>               (point))))
>    (erl-ie-evaluate beg end node t)))

> Or rather the inner part involving the (scattered toothpick style)
> regexp.

OK, for a start, double backslashes are really just single ones - you
need to write them double because they're in a lisp string.  If you
write it out with this substitution, and on two lines, it looks like
this:

    \(  \|   \)
      \`  ^\<

This regexp matches EITHER a match for \` OR a match for ^\<.
\` matches anything at the beginning of the (visible part of the) buffer.
^\< matches the beginning of a word at the start of a line.

This is all documented on the page "Syntax of Regexps" in the Elisp
manual.

> BR

-- 
Alan Mackenzie (Nuremberg, Germany).



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

end of thread, other threads:[~2009-03-03 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03  8:22 elisp regexp, what does this mean? heinz.eriksson
2009-03-03  9:38 ` Lennart Borgman
2009-03-03 10:07 ` Alan Mackenzie

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.