help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it obvious that string-match syntax matching is affected by the curre


From: Tom
Subject: Is it obvious that string-match syntax matching is affected by the current buffer?
Date: Sun, 13 Mar 2016 16:31:42 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I did a word constituent match with string-match and a question
occured to me: what controls what is considered word constituent
in this case?

I checked info, but I saw no mention of this, so I did a test and
yes, the current syntax table affects string-match:

(let ((tab (make-syntax-table)))
  (modify-syntax-entry ?a " " tab)
  (with-syntax-table tab
    (string-match "\\s-" "a")))


Isn't a strange? E.g. I'm doing a string match in elisp, so I'm
not working with the current buffer, yet its active syntax table
affects the result of string-match. Seems to me these are
different domains and string-match should have its own
string-match-syntax-table or something, so there can be no
match side effects depending on the currently active buffer.

Do you think it's obvious for the elisp users that string-match
is affected by the current buffer? Maybe the documentation should
mention this. (Maybe it does, but I didn't see it.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]