I’m trying to make a particular exclamation point behave like a word constituent (from the point of view of the syntax table), using the syntax-table
text property, but I can’t get it to work.
In an empty buffer I write an exclamation mark and then evaluate the command (add-text-properties 1 2 '(syntax-table (2)))
. I think this is what I’m supposed to do.
But describe-char
on the exclamation mark shows
character: ! (displayed as !) (codepoint 33, #o41, #x21)
[…]
syntax: . which means: punctuation
[…]
There are text properties here:
syntax-table (2)
Note that the text property has been applied, but it is still considered a punctuation character. What am I missing? Do I need to call a function to update it somehow? Other text properties (for instance display
) are applied automatically.
parse-sexp-lookup-properties
to a non-nil value.syntax-table
text property is useless otherwise? Why isn’t that on by default?