>>>> "Stephen" == Stephen J Turnbull
<stephen(a)xemacs.org> writes:
Stephen> skip(a)pobox.com writes:
> GNU Emacs defines a string-to-syntax function in src/syntax.c.
Stephen> What does it do?
Good question. The docstring sucked (at least for me - it's been years
since I attempted to do anything serious with Emacs Lisp):
string-to-syntax is a built-in function in `C source code'.
(string-to-syntax STRING)
Convert a syntax specification STRING into syntax cell form.
STRING should be a string as it is allowed as argument of
`modify-syntax-entry'. Value is the equivalent cons cell
(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
text property.
I empirically wrote what I needed for python-mode by observing the
constructs which were used in the code:
(if (featurep 'xemacs)
'(15)
(eval-when-compile (string-to-syntax "|")))
then building my own:
(if (featurep 'xemacs)
(defun string-to-syntax (s)
(cond
((equal s "|") '(15))
((equal s "_") '(3))
(t (error "Unhandled string: %s" s))))
)
and cleaning up the code where it was called.
Of course, that's a rather incomplete implementation. :-)
Skip
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta