问题
How do we check whether (point)
is within matching "quotes"
Example 1: "(point)
",
but not within
Example 2: "quote here" (point)
"quote there",
in Emacs Lisp?
回答1:
What you are looking for is syntax-ppss
(defined in syntax.el
).
It returns 10 values, and the 4th tells you whether the point is inside a string.
回答2:
(eq (nth 1 (text-properties-at (point))) font-lock-string-face)
This checks whether the font of the text at point is recognized as a string (i.e. has the text property face font-lock-string-face).
This looking for a more elegant solution.
来源:https://stackoverflow.com/questions/15078322/test-whether-the-point-is-between-matching-quotes-emacs-lisp