summaryrefslogtreecommitdiff
path: root/src/syntax.h
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2015-09-09 15:14:52 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2015-09-09 15:14:52 -0400
commitab21f61a552f038485d40218dfd94a16b843eb52 (patch)
tree876a849cbfffc86a355480c17f93589fab012f82 /src/syntax.h
parent74baea086d1ea606bae99bfc8c9195c21d5530fc (diff)
downloademacs-ab21f61a552f038485d40218dfd94a16b843eb52.tar.gz
Make syntax.c call syntax-propertize on demand
* lisp/emacs-lisp/syntax.el (syntax--jit-propertize): New function. (parse-sexp-propertize-function): Use it. (syntax-propertize): Disable parse-sexp-propertize-function. * src/syntax.c (parse_sexp_propertize, update_syntax_table_forward): New functions. (syms_of_syntax): New vars `parse-sexp-propertize-done' and `parse-sexp-propertize-function'. * src/syntax.h (struct gl_state_s): Add `e_property_truncated' field. (UPDATE_SYNTAX_TABLE_FORWARD): Use update_syntax_table_forward. (SETUP_BUFFER_SYNTAX_TABLE): Set e_property_truncated. * lisp/progmodes/elisp-mode.el (elisp-byte-code-syntax-propertize): Don't assume `point' is set.
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/syntax.h b/src/syntax.h
index bfcb87168ba..9c44181155f 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
INLINE_HEADER_BEGIN
extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
+extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object);
/* The standard syntax table is stored where it will automatically
be used in all new buffers. */
@@ -52,30 +53,32 @@ enum syntaxcode
other side by any char with the same syntaxcode. */
Sstring_fence, /* Starts/ends string which is delimited on the
other side by any char with the same syntaxcode. */
- Smax /* Upper bound on codes that are meaningful */
+ Smax /* Upper bound on codes that are meaningful. */
};
struct gl_state_s
{
- Lisp_Object object; /* The object we are scanning. */
- ptrdiff_t start; /* Where to stop. */
- ptrdiff_t stop; /* Where to stop. */
+ Lisp_Object object; /* The object we are scanning. */
+ ptrdiff_t start; /* Where to stop. */
+ ptrdiff_t stop; /* Where to stop. */
bool use_global; /* Whether to use global_code
- or c_s_t. */
- Lisp_Object global_code; /* Syntax code of current char. */
- Lisp_Object current_syntax_table; /* Syntax table for current pos. */
- Lisp_Object old_prop; /* Syntax-table prop at prev pos. */
- ptrdiff_t b_property; /* First index where c_s_t is valid. */
+ or c_s_t. */
+ Lisp_Object global_code; /* Syntax code of current char. */
+ Lisp_Object current_syntax_table; /* Syntax table for current pos. */
+ Lisp_Object old_prop; /* Syntax-table prop at prev pos. */
+ ptrdiff_t b_property; /* First index where c_s_t is valid. */
ptrdiff_t e_property; /* First index where c_s_t is
- not valid. */
- INTERVAL forward_i; /* Where to start lookup on forward */
+ not valid. */
+ bool e_property_truncated; /* true if e_property if was truncated
+ by parse_sexp_propertize_done. */
+ INTERVAL forward_i; /* Where to start lookup on forward. */
INTERVAL backward_i; /* or backward movement. The
data in c_s_t is valid
between these intervals,
and possibly at the
intervals too, depending
- on: */
+ on: */
/* Offset for positions specified to UPDATE_SYNTAX_TABLE. */
ptrdiff_t offset;
};
@@ -173,7 +176,7 @@ INLINE void
UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos)
{
if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
- update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object);
+ update_syntax_table_forward (charpos + gl_state.offset, false, gl_state.object);
}
/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
@@ -201,6 +204,7 @@ INLINE void
SETUP_BUFFER_SYNTAX_TABLE (void)
{
gl_state.use_global = false;
+ gl_state.e_property_truncated = false;
gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
}