[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] skip-chars-forward (was: Re: XEmacs and character c
From: |
Vadim Nasardinov |
Subject: |
[emacs-wiki-discuss] skip-chars-forward (was: Re: XEmacs and character classes) |
Date: |
Tue, 21 Dec 2004 16:42:32 -0500 |
User-agent: |
KMail/1.5.4 |
On Tuesday 21 December 2004 16:12, Carl Worth wrote:
> > |(defun emacs-wiki-insert-anchor (anchor)
> > | "Insert an anchor, either around the word at point, or within a tag."
> > | (skip-chars-forward "[:space:]")
> >
> > Since my Emacs doesn't seem to understand the character class
> > [:space:],
>
> I'm confused about these threads mentioning the problems with
> character classes.
>
> I wouldn't expect "[:space:]" to get provide the desired effect. But
> is "[[:space:]]" not supported universally in emacs?
Ah, yes, you are right. The "[[:space:]]" regexp works just fine.
"C-h f skip-chars-forward" has this to say,
skip-chars-forward is a built-in function.
(skip-chars-forward STRING &optional LIM)
Move point forward, stopping before a char not in STRING, or at
pos LIM. STRING is like the inside of a `[...]' in a regular
expression except that `]' is never special and `\' quotes `^',
`-' or `\' (but not as the end of a range; quoting is never needed
there).
Thus, with arg "a-zA-Z", this skips letters stopping before first
nonletter. With arg "^a-zA-Z", skips nonletters stopping before
first letter. Returns the distance traveled, either zero or
positive.
So, in theory, it sounds like doing something like this
(skip-chars-forward "baz")
means, Skip characters matching the regexp "[baz]".
By the same token,
(skip-chars-forward "[:space:]")
can be expected to mean, Skip characters matching the regexp "[[:space:]]".
Except that it doesn't seem to work that way. Not for me, at least.
Thanks,
Vadim