Since Emacs 25.1, syntax-begin-function
is obsolete:
syntax-begin-function is a variable defined in ‘syntax.el’.
Its value is nil
This variable is obsolete since 25.1.
This variable may be risky if used as a file-local variable.
Documentation:
Function to move back outside of any comment/string/paren.
This function should move the cursor back to some syntactically safe
point (where the PPSS is equivalent to nil).
This was done in commit dd1e6846198e559b1c2ca321a1e6f8b05945fd66 which offers no further explanation how that functionality should be achieved now. The code also still refers to syntax-begin-function
in several comments as if nothing happened.
php-mode
just surrounded the offending code with with-no-warnings
(cf. https://github.com/ejmr/php-mode/blob/master/php-mode.el#L1193-L1196), and other projects seem to have found no "proper" solution yet either. The function php-mode
used for this variable, c-beginning-of-syntax
, refers to font-lock-beginning-of-syntax-function
which was also removed in Emacs 25.1 (but, again, is referred to in several other comments as well).
If I completely remove the section:
;; syntax-begin-function is obsolete in Emacs 25.1
(with-no-warnings
(set (make-local-variable 'syntax-begin-function)
'c-beginning-of-syntax))
from php-mode.el
and test it with Emacs 24.3 and 25.2, I don't see any obvious adverse effects.
What was syntax-begin-function
obsoleted in favour of? Is the reference in php-mode.el
just dead code that did nothing? If not, how can I test its behaviour?