[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Select Text Inside Parentheses
From: |
Drew Adams |
Subject: |
RE: Select Text Inside Parentheses |
Date: |
Sun, 2 Sep 2012 06:29:41 -0700 |
> I've tried this on two platforms now; on my own distro, where I run
> emacs-22.3.2 and on an Ubuntu 12.04 with emacs-23.3.1
> I place my point on "b" in bar in this code:
> (
> foo
> bar
> baz
> )
Put the cursor before the (, not after it. Or redefine the command accordingly.
I did not hear you say that you wanted it to start with point between the
parens. As I described, the regexp I gave looks first for a (.
Also, . matches any char except a newline. If you want to pick up newlines
also, and not other whitespace, then change \\(.+\\) to
\\(\\(\\S-\\|[\n]\\)+\\). But if you want to pick up whitespace too, as in (foo
bar baz) or
(
foo bar
baz
)
then use just \\([^)]\\), IOW, just pick up everything up to the first ).
It depends what you want. Read the Elisp manual's section about regexps.
. matches any char except a newline.
[\n] matches only a newline.
\\s- matches a whitespace char (but not a newline).
\\S- matches a non-whitespace, non-newline char.
Re: Select Text Inside Parentheses, Andreas Röhler, 2012/09/04