branch: elpa/gnuplot
commit 35a8a19d8b23c5bebd10180a8cc6b049f33cf046
Author: joddie <[email protected]>
Commit: joddie <[email protected]>
Check for `syntax-propertize-function' when defining syntax-table
In pre-24 Emacs which lack `syntax-propertize', syntax parsing of
strings and comments can be done by the normal syntax-table mechanism,
which works OK except for the corner cases.
---
gnuplot.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/gnuplot.el b/gnuplot.el
index 3af5f31..88fce08 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -1664,19 +1664,21 @@ static char *help_btn[] = {
(modify-syntax-entry ?_ "w" table )
- ;; In GNU Emacs we scan for strings and comments ourselves in
- ;; `gnuplot-scan-after-change'. I can't get this to work in xemacs,
- ;; so there we'll make ", ', and # delimiters as normal, and use the
- ;; built-in parser
- (if (featurep 'xemacs)
+ ;; In GNU Emacs >=24 we can use `syntax-propertize-function' to
+ ;; accurately scan for strings and comments (see
+ ;; `gnuplot-syntax-propertize'). If there's no
+ ;; `syntax-propertize', fall back to using the built-in parser and
+ ;; making ", ', and # string or comment delimiters as normal.
+ (if (not (boundp 'syntax-propertize-function))
(progn
(modify-syntax-entry ?\' "\"" table)
(modify-syntax-entry ?# "<" table)
(modify-syntax-entry ?\n ">" table)
(modify-syntax-entry ?\\ "\\" table))
- ;; GNU Emacs: Make ", ', and # punctuation, so the built-in parser
- ;; doesn't interfere with them
+ ;; When syntax-propertize is available, ", ', and # should be
+ ;; punctuation so that the built-in parser doesn't interfere
+ ;; with the syntax-propertize search.
(modify-syntax-entry ?\" "." table)
(modify-syntax-entry ?\' "." table)
(modify-syntax-entry ?` "." table)