2
votes

While skipping over spaces works fine using

(skip-chars-forward "\s-")

I can't seem to be able to skip over symbols using

(skip-chars-forward "\s_")

Maybe I am using she command wrongly, and it somehow recovers in the 1st case?

The relevant documentation does not seem to answer the question:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-Class-Table.html http://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html

3

3 Answers

2
votes

Syntax symbols as taken be search-forms aren't usable from skip-forms. Use skip-syntax-...

(skip-syntax-forward "_")

Or use an own sets of chars to move

(setq "my-choice" "[[:alnum:]].")

Evaluating form below after ")" should jump behind "...."

(skip-chars-forward my-choice)asdf....

Alternatively, using Emacs Werkstatt: M-x ar-symbol- TAB displays a whole bunch of commands working on symbols: forward, backward, delete, copy, hide... etc

BTW, the reason why skip-chars doesn't take syntax is, probably, speed. Skip-chars is very fast, reading and translating syntax tables probably would slow it down.

1
votes

You probably want (skip-syntax-forward "w_"), which skips over both word and symbol characters.

If you want to match syntax classes in a regexp written as a string, for passing to functions like search-regexp-forward, you will need to double your backslashes: "\\s-". But the argument to skip-syntax-forward is not a regexp, just a string in which each character represents a syntax class.

0
votes

You're using the command wrong, it should be:

(skip-chars-forward " \n\t")
(skip-chars-forward "A-Z_a-z-0-9")

Whatever you put in the string gets put into [] regex construct, and it doesn't expand \\s-.