[Top][All Lists]

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

syntax-propertize-function vs indentation lexer

From: Stephen Leake
Subject: syntax-propertize-function vs indentation lexer
Date: Wed, 29 May 2013 11:19:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt)

I'm working on a new indentation mode for Ada (and have been for a while
- see http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html).

I've recently run across an issue with syntax-propertize-function.

I use that to set the syntax of Ada character constants (ie 'A') to
'string'. This matters for the particular constant '\', and for some
other cases.

The indentation engine relies on this, because it uses a lexer that uses
syntax properties.

However, syntax-propertize-function is only called from font-lock. So it
only runs on the visible part of the buffer, and only when font-lock is
enabled. So if neither of those conditions is present, the lexer fails
on character constants. In particular, I have a test suite that runs in
batch mode, when global-font-lock-mode is off.

To fix this, I could call syntax-propertize-function (or
ada-syntax-propertize directly) from ada-mode to initialize the buffer,
and again from before- or after-change-functions to catch edits.

Is there a better way?

-- Stephe

reply via email to

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