aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2016-03-11 23:28:35 +0000
committerAlan Mackenzie2016-03-11 23:28:35 +0000
commite7591bb08fbc12c3656104d6abd0706cf83d0ef4 (patch)
treea07f3a9e786915e5fbed2304db74a7f47f319b67 /src
parent345cb4c37b0093cf607edff41937c86d24b9200c (diff)
downloademacs-e7591bb08fbc12c3656104d6abd0706cf83d0ef4.tar.gz
emacs-e7591bb08fbc12c3656104d6abd0706cf83d0ef4.zip
Rename comment-depth (etc.) to literal-cache (etc.). Enable it by default
* buffer.c: * buffer.h: * syntax.c: * syntax.h: * insdel.c: * textprop.c: Rename `comment-depth' to `literal-cache', `comment-depth-hwm' to `literal-cache-hwm', `comment-cacheing-flag' to `literal-cacheing-flag'. Rename some functions and internal variables similarly. * syntax.c (literal-cacheing-flag): Enable by default.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c14
-rw-r--r--src/buffer.h6
-rw-r--r--src/insdel.c2
-rw-r--r--src/syntax.c126
-rw-r--r--src/syntax.h2
-rw-r--r--src/textprop.c16
6 files changed, 83 insertions, 83 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 1065e4da6f3..87945c21077 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -359,9 +359,9 @@ bset_zv_marker (struct buffer *b, Lisp_Object val)
359 b->zv_marker_ = val; 359 b->zv_marker_ = val;
360} 360}
361static void 361static void
362bset_comment_depth_hwm (struct buffer *b, Lisp_Object val) 362bset_literal_cache_hwm (struct buffer *b, Lisp_Object val)
363{ 363{
364 b->comment_depth_hwm_ = val; 364 b->literal_cache_hwm_ = val;
365} 365}
366 366
367void 367void
@@ -5103,7 +5103,7 @@ init_buffer_once (void)
5103 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; 5103 XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
5104 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; 5104 XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
5105 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; 5105 XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
5106 XSETFASTINT (BVAR (&buffer_local_flags, comment_depth_hwm), idx); ++idx; 5106 XSETFASTINT (BVAR (&buffer_local_flags, literal_cache_hwm), idx); ++idx;
5107 5107
5108 /* Need more room? */ 5108 /* Need more room? */
5109 if (idx >= MAX_PER_BUFFER_VARS) 5109 if (idx >= MAX_PER_BUFFER_VARS)
@@ -5190,7 +5190,7 @@ init_buffer_once (void)
5190 bset_scroll_up_aggressively (&buffer_defaults, Qnil); 5190 bset_scroll_up_aggressively (&buffer_defaults, Qnil);
5191 bset_scroll_down_aggressively (&buffer_defaults, Qnil); 5191 bset_scroll_down_aggressively (&buffer_defaults, Qnil);
5192 bset_display_time (&buffer_defaults, Qnil); 5192 bset_display_time (&buffer_defaults, Qnil);
5193 bset_comment_depth_hwm (&buffer_defaults, make_number (1)); 5193 bset_literal_cache_hwm (&buffer_defaults, make_number (1));
5194 5194
5195 /* Assign the local-flags to the slots that have default values. 5195 /* Assign the local-flags to the slots that have default values.
5196 The local flag is a bit that is used in the buffer 5196 The local flag is a bit that is used in the buffer
@@ -6261,9 +6261,9 @@ If t, displays a cursor related to the usual cursor type
6261You can also specify the cursor type as in the `cursor-type' variable. 6261You can also specify the cursor type as in the `cursor-type' variable.
6262Use Custom to set this variable and update the display. */); 6262Use Custom to set this variable and update the display. */);
6263 6263
6264 DEFVAR_PER_BUFFER ("comment-depth-hwm", 6264 DEFVAR_PER_BUFFER ("literal-cache-hwm",
6265 &BVAR (current_buffer, comment_depth_hwm), Qintegerp, 6265 &BVAR (current_buffer, literal_cache_hwm), Qintegerp,
6266 doc: /* Buffer position below which the `comment-depth' property is valid. */); 6266 doc: /* Buffer position below which the `literal-cache' property is valid. */);
6267 6267
6268 DEFVAR_LISP ("kill-buffer-query-functions", Vkill_buffer_query_functions, 6268 DEFVAR_LISP ("kill-buffer-query-functions", Vkill_buffer_query_functions,
6269 doc: /* List of functions called with no args to query before killing a buffer. 6269 doc: /* List of functions called with no args to query before killing a buffer.
diff --git a/src/buffer.h b/src/buffer.h
index a5343707221..16f1226d7e9 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -748,8 +748,8 @@ struct buffer
748 See `cursor-type' for other values. */ 748 See `cursor-type' for other values. */
749 Lisp_Object cursor_in_non_selected_windows_; 749 Lisp_Object cursor_in_non_selected_windows_;
750 750
751 /* Buffer position below which the `comment-depth' property is valid. */ 751 /* Buffer position below which the `literal-cache' property is valid. */
752 Lisp_Object comment_depth_hwm_; 752 Lisp_Object literal_cache_hwm_;
753 753
754 /* No more Lisp_Object beyond this point. Except undo_list, 754 /* No more Lisp_Object beyond this point. Except undo_list,
755 which is handled specially in Fgarbage_collect. */ 755 which is handled specially in Fgarbage_collect. */
@@ -1270,7 +1270,7 @@ extern int last_per_buffer_idx;
1270 1270
1271#define FOR_EACH_PER_BUFFER_OBJECT_AT(offset) \ 1271#define FOR_EACH_PER_BUFFER_OBJECT_AT(offset) \
1272 for (offset = PER_BUFFER_VAR_OFFSET (name); \ 1272 for (offset = PER_BUFFER_VAR_OFFSET (name); \
1273 offset <= PER_BUFFER_VAR_OFFSET (comment_depth_hwm); \ 1273 offset <= PER_BUFFER_VAR_OFFSET (literal_cache_hwm); \
1274 offset += word_size) 1274 offset += word_size)
1275 1275
1276/* Return the index of buffer-local variable VAR. Each per-buffer 1276/* Return the index of buffer-local variable VAR. Each per-buffer
diff --git a/src/insdel.c b/src/insdel.c
index 119f713c387..d5ead0e6749 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2083,7 +2083,7 @@ signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins)
2083 2083
2084 specbind (Qinhibit_modification_hooks, Qt); 2084 specbind (Qinhibit_modification_hooks, Qt);
2085 2085
2086 Ftrim_comment_cache (make_number (charpos)); 2086 Ftrim_literal_cache (make_number (charpos));
2087 2087
2088 if (!NILP (Vafter_change_functions)) 2088 if (!NILP (Vafter_change_functions))
2089 { 2089 {
diff --git a/src/syntax.c b/src/syntax.c
index db09372be32..e43ae55a478 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -958,25 +958,25 @@ old_back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
958 return from != comment_end; 958 return from != comment_end;
959} 959}
960 960
961/* `comment-depth' text properties 961/* `literal-cache' text properties
962 ------------------------------- 962 -------------------------------
963These are applied to all text between BOB and `comment-depth-hwm'. 963These are applied to all text between BOB and `literal-cache-hwm'.
964They are primarily to record whether or not the current character is 964They are primarily to record whether or not the current character is
965inside a literal, and if so, what type. 965inside a literal, and if so, what type.
966 966
967On a buffer change (when `inhibit-modification-hooks' is nil), any 967On a buffer change (when `inhibit-modification-hooks' is nil), any
968buffer change (including changing text-properties) will reduce 968buffer change (including changing text-properties) will reduce
969`comment-depth-hwm' to the change position, if it is higher. When 969`literal-cache-hwm' to the change position, if it is higher. When
970`inhibit-modification-hooks' is non-nil, only changes to the 970`inhibit-modification-hooks' is non-nil, only changes to the
971`syntax-table' text property (possibly via a `category' text property) 971`syntax-table' text property (possibly via a `category' text property)
972which affect the scanning of literals cause the setting of 972which affect the scanning of literals cause the setting of
973`comment-depth-hwm'. 973`literal-cache-hwm'.
974 974
975The `comment-depth' text property for a literal is applied on the text 975The `literal-cache' text property for a literal is applied on the text
976between just after its opening delimiter and just after its closing 976between just after its opening delimiter and just after its closing
977delimiter. 977delimiter.
978 978
979The value of the `comment-depth' text property is a cons. For a 979The value of the `literal-cache' text property is a cons. For a
980string, its car is the symbol `string' and its cdr is the expected 980string, its car is the symbol `string' and its cdr is the expected
981closing delimiter (or ST_STRING_STYLE in the case of a string fence 981closing delimiter (or ST_STRING_STYLE in the case of a string fence
982string). For a comment, the car is -1 for a non-nestable comment, or 982string). For a comment, the car is -1 for a non-nestable comment, or
@@ -984,7 +984,7 @@ the current nesting depth for a nestable comment. When not in a
984literal, the value is '(0 . 0). These values match the internal 984literal, the value is '(0 . 0). These values match the internal
985values used in `scan_sexps_forward. */ 985values used in `scan_sexps_forward. */
986 986
987DEFUN ("trim-comment-cache", Ftrim_comment_cache, Strim_comment_cache, 0, 1, 0, 987DEFUN ("trim-literal-cache", Ftrim_literal_cache, Strim_literal_cache, 0, 1, 0,
988 doc: /* Mark the selected buffer's "comment cache" as invalid from POS. 988 doc: /* Mark the selected buffer's "comment cache" as invalid from POS.
989By default, POS is the beginning of the buffer (position 1). If the cache is 989By default, POS is the beginning of the buffer (position 1). If the cache is
990already invalid from an earlier position than POS, this function has no 990already invalid from an earlier position than POS, this function has no
@@ -1000,10 +1000,10 @@ effect. The return value is the new bound. */)
1000 } 1000 }
1001 else 1001 else
1002 position = 1; 1002 position = 1;
1003 cache_limit = XINT (BVAR (current_buffer, comment_depth_hwm)); 1003 cache_limit = XINT (BVAR (current_buffer, literal_cache_hwm));
1004 BVAR (current_buffer, comment_depth_hwm) 1004 BVAR (current_buffer, literal_cache_hwm)
1005 = make_number (min (cache_limit, position)); 1005 = make_number (min (cache_limit, position));
1006 return BVAR (current_buffer, comment_depth_hwm); 1006 return BVAR (current_buffer, literal_cache_hwm);
1007} 1007}
1008 1008
1009static 1009static
@@ -1028,9 +1028,9 @@ bool syntax_table_value_is_interesting_for_literals (Lisp_Object val)
1028 1028
1029/* The text property PROP is having its value VAL at position POS in buffer BUF 1029/* The text property PROP is having its value VAL at position POS in buffer BUF
1030either set or cleared. If this value is relevant to the syntax of literals, 1030either set or cleared. If this value is relevant to the syntax of literals,
1031reduce the BUF's value of comment_depth_hwm to POS. */ 1031reduce the BUF's value of literal_cache_hwm to POS. */
1032void 1032void
1033check_comment_depth_hwm_for_prop (ptrdiff_t pos, Lisp_Object prop, 1033check_literal_cache_hwm_for_prop (ptrdiff_t pos, Lisp_Object prop,
1034 Lisp_Object val, Lisp_Object buffer) 1034 Lisp_Object val, Lisp_Object buffer)
1035{ 1035{
1036 struct buffer *b; 1036 struct buffer *b;
@@ -1040,7 +1040,7 @@ check_comment_depth_hwm_for_prop (ptrdiff_t pos, Lisp_Object prop,
1040 if (!BUFFERP (buffer)) 1040 if (!BUFFERP (buffer))
1041 return; 1041 return;
1042 b = XBUFFER (buffer); 1042 b = XBUFFER (buffer);
1043 hwm = XINT (BVAR (b, comment_depth_hwm)); 1043 hwm = XINT (BVAR (b, literal_cache_hwm));
1044 if (pos >= hwm) 1044 if (pos >= hwm)
1045 return; 1045 return;
1046 1046
@@ -1062,34 +1062,34 @@ check_comment_depth_hwm_for_prop (ptrdiff_t pos, Lisp_Object prop,
1062 } 1062 }
1063 if (EQ (prop, Qsyntax_table) 1063 if (EQ (prop, Qsyntax_table)
1064 && syntax_table_value_is_interesting_for_literals (val)) 1064 && syntax_table_value_is_interesting_for_literals (val))
1065 BVAR (b, comment_depth_hwm) = make_number (pos); 1065 BVAR (b, literal_cache_hwm) = make_number (pos);
1066} 1066}
1067 1067
1068/* Scan forward over the innards of a containing comment, marking 1068/* Scan forward over the innards of a containing comment, marking
1069nested comments. FROM/FROM_BYTE, TO delimit the region to be marked. 1069nested comments. FROM/FROM_BYTE, TO delimit the region to be marked.
1070COMMENT_DEPTH_VALUE is the value of the `comment-depth' property that 1070LITERAL_CACHE_VALUE is the value of the `literal-cache' property that
1071was applied to the containing comment. */ 1071was applied to the containing comment. */
1072static void 1072static void
1073scan_nested_comments_forward (ptrdiff_t from, ptrdiff_t from_byte, 1073scan_nested_comments_forward (ptrdiff_t from, ptrdiff_t from_byte,
1074 ptrdiff_t to, 1074 ptrdiff_t to,
1075 Lisp_Object comment_depth_value) 1075 Lisp_Object literal_cache_value)
1076{ 1076{
1077 Lisp_Object tem; 1077 Lisp_Object tem;
1078 int comstyle = XINT (XCDR (comment_depth_value)); 1078 int comstyle = XINT (XCDR (literal_cache_value));
1079 struct lisp_parse_state state; 1079 struct lisp_parse_state state;
1080 1080
1081 /* Increment the nesting depth. */ 1081 /* Increment the nesting depth. */
1082 comment_depth_value = 1082 literal_cache_value =
1083 Fcons (make_number (XINT (XCAR (comment_depth_value)) + 1), 1083 Fcons (make_number (XINT (XCAR (literal_cache_value)) + 1),
1084 XCDR (comment_depth_value)); 1084 XCDR (literal_cache_value));
1085 /* Make sure our text property value is `eq' to other values which 1085 /* Make sure our text property value is `eq' to other values which
1086 are `equal'. */ 1086 are `equal'. */
1087 tem = Fmember (comment_depth_value, Vcomment_depth_values); 1087 tem = Fmember (literal_cache_value, Vliteral_cache_values);
1088 if (CONSP (tem)) 1088 if (CONSP (tem))
1089 comment_depth_value = XCAR (tem); 1089 literal_cache_value = XCAR (tem);
1090 else 1090 else
1091 Vcomment_depth_values = Fcons (comment_depth_value, 1091 Vliteral_cache_values = Fcons (literal_cache_value,
1092 Vcomment_depth_values); 1092 Vliteral_cache_values);
1093 1093
1094 UPDATE_SYNTAX_TABLE_BACKWARD (from); 1094 UPDATE_SYNTAX_TABLE_BACKWARD (from);
1095 internalize_parse_state (Qnil, &state); 1095 internalize_parse_state (Qnil, &state);
@@ -1118,11 +1118,11 @@ scan_nested_comments_forward (ptrdiff_t from, ptrdiff_t from_byte,
1118 -1); 1118 -1);
1119 Fput_text_property (make_number (from), 1119 Fput_text_property (make_number (from),
1120 make_number (state.location), 1120 make_number (state.location),
1121 Qcomment_depth, 1121 Qliteral_cache,
1122 comment_depth_value, Qnil); 1122 literal_cache_value, Qnil);
1123 scan_nested_comments_forward (from, from_byte, 1123 scan_nested_comments_forward (from, from_byte,
1124 state.location, 1124 state.location,
1125 comment_depth_value); 1125 literal_cache_value);
1126 from = state.location; 1126 from = state.location;
1127 from_byte = state.location_byte; 1127 from_byte = state.location_byte;
1128 } 1128 }
@@ -1131,9 +1131,9 @@ scan_nested_comments_forward (ptrdiff_t from, ptrdiff_t from_byte,
1131 1131
1132 1132
1133 1133
1134/* Scan forward over all text between comment-depth-hwm and TO, 1134/* Scan forward over all text between literal-cache-hwm and TO,
1135 marking literals (strings and comments) with the `comment-depth' 1135 marking literals (strings and comments) with the `literal-cache'
1136 text property. `comment-depth-hwm' is updated to TO. */ 1136 text property. `literal-cache-hwm' is updated to TO. */
1137static void 1137static void
1138scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte) 1138scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte)
1139{ 1139{
@@ -1145,10 +1145,10 @@ scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte)
1145 int c, syntax; 1145 int c, syntax;
1146 enum syntaxcode code; 1146 enum syntaxcode code;
1147 Lisp_Object depth; 1147 Lisp_Object depth;
1148 Lisp_Object comment_depth_value; 1148 Lisp_Object literal_cache_value;
1149 Lisp_Object tem; 1149 Lisp_Object tem;
1150 1150
1151 hwm = XINT (BVAR (current_buffer, comment_depth_hwm)); 1151 hwm = XINT (BVAR (current_buffer, literal_cache_hwm));
1152 1152
1153 if (hwm < to) 1153 if (hwm < to)
1154 { 1154 {
@@ -1181,10 +1181,10 @@ scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte)
1181 internalize_parse_state (Qnil, &state); 1181 internalize_parse_state (Qnil, &state);
1182 if (hwm > BEG) 1182 if (hwm > BEG)
1183 /* Initialize STATE with the current value of the 1183 /* Initialize STATE with the current value of the
1184 `comment-depth' text property. */ 1184 `literal-cache' text property. */
1185 { 1185 {
1186 depth = Fget_text_property (make_number (hwm - 1), 1186 depth = Fget_text_property (make_number (hwm - 1),
1187 Qcomment_depth, Qnil); 1187 Qliteral_cache, Qnil);
1188 if (CONSP (depth)) 1188 if (CONSP (depth))
1189 { 1189 {
1190 if (EQ (Fcar (depth), Qstring)) 1190 if (EQ (Fcar (depth), Qstring))
@@ -1221,35 +1221,35 @@ scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte)
1221 1221
1222 while (hwm < to) 1222 while (hwm < to)
1223 { 1223 {
1224 /* For each literal we scan, we apply the `comment-depth' 1224 /* For each literal we scan, we apply the `literal-cache'
1225 property on its innards and closing delimiter. Calculate 1225 property on its innards and closing delimiter. Calculate
1226 the value we will use first. */ 1226 the value we will use first. */
1227 comment_depth_value = (state.instring != -1) 1227 literal_cache_value = (state.instring != -1)
1228 ? Fcons (Qstring, make_number (state.instring)) 1228 ? Fcons (Qstring, make_number (state.instring))
1229 : (state.incomment 1229 : (state.incomment
1230 ? Fcons (make_number (state.incomment), 1230 ? Fcons (make_number (state.incomment),
1231 make_number (state.comstyle)) 1231 make_number (state.comstyle))
1232 : Fcons (make_number (0), make_number (0))); 1232 : Fcons (make_number (0), make_number (0)));
1233 /* Ensure all `equal' values of comment-depth-value are also `eq'. */ 1233 /* Ensure all `equal' values of literal-cache-value are also `eq'. */
1234 tem = Fmember (comment_depth_value, Vcomment_depth_values); 1234 tem = Fmember (literal_cache_value, Vliteral_cache_values);
1235 if (CONSP (tem)) 1235 if (CONSP (tem))
1236 comment_depth_value = XCAR (tem); 1236 literal_cache_value = XCAR (tem);
1237 else 1237 else
1238 Vcomment_depth_values = Fcons (comment_depth_value, 1238 Vliteral_cache_values = Fcons (literal_cache_value,
1239 Vcomment_depth_values); 1239 Vliteral_cache_values);
1240 1240
1241 scan_sexps_forward (&state, hwm, hwm_byte, to, 1241 scan_sexps_forward (&state, hwm, hwm_byte, to,
1242 TYPE_MINIMUM (EMACS_INT), false, 1242 TYPE_MINIMUM (EMACS_INT), false,
1243 -1); /* stop after literal boundary */ 1243 -1); /* stop after literal boundary */
1244 1244
1245 Fput_text_property (make_number (hwm), make_number (state.location), 1245 Fput_text_property (make_number (hwm), make_number (state.location),
1246 Qcomment_depth, 1246 Qliteral_cache,
1247 comment_depth_value, Qnil); 1247 literal_cache_value, Qnil);
1248 1248
1249 if (NUMBERP (XCAR (comment_depth_value)) 1249 if (NUMBERP (XCAR (literal_cache_value))
1250 && XINT (XCAR (comment_depth_value)) > 0) 1250 && XINT (XCAR (literal_cache_value)) > 0)
1251 scan_nested_comments_forward 1251 scan_nested_comments_forward
1252 (hwm, hwm_byte, state.location, comment_depth_value); 1252 (hwm, hwm_byte, state.location, literal_cache_value);
1253 1253
1254 hwm = state.location; 1254 hwm = state.location;
1255 hwm_byte = state.location_byte; 1255 hwm_byte = state.location_byte;
@@ -1259,7 +1259,7 @@ scan_comments_forward_to (ptrdiff_t to, ptrdiff_t to_byte)
1259 /* Frestore_buffer_modified_p overwrites gl_state, hence: */ 1259 /* Frestore_buffer_modified_p overwrites gl_state, hence: */
1260 SETUP_SYNTAX_TABLE (to, -1); 1260 SETUP_SYNTAX_TABLE (to, -1);
1261 } 1261 }
1262 BVAR (current_buffer, comment_depth_hwm) = make_number (hwm); 1262 BVAR (current_buffer, literal_cache_hwm) = make_number (hwm);
1263 unbind_to (count, Qnil); 1263 unbind_to (count, Qnil);
1264 } 1264 }
1265} 1265}
@@ -1281,22 +1281,22 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
1281 ptrdiff_t *bytepos_ptr) 1281 ptrdiff_t *bytepos_ptr)
1282{ 1282{
1283 Lisp_Object depth; 1283 Lisp_Object depth;
1284 ptrdiff_t comment_depth, target_depth, comment_style; 1284 ptrdiff_t literal_cache, target_depth, comment_style;
1285 Lisp_Object temp; 1285 Lisp_Object temp;
1286 int c; 1286 int c;
1287 int syntax, code; 1287 int syntax, code;
1288 1288
1289 if (comment_cacheing_flag) 1289 if (literal_cacheing_flag)
1290 { 1290 {
1291 scan_comments_forward_to (from, from_byte); 1291 scan_comments_forward_to (from, from_byte);
1292 if (from <= stop) 1292 if (from <= stop)
1293 return false; 1293 return false;
1294 depth = Fget_text_property (make_number (from - 1), Qcomment_depth, Qnil); 1294 depth = Fget_text_property (make_number (from - 1), Qliteral_cache, Qnil);
1295 if (!CONSP (depth) 1295 if (!CONSP (depth)
1296 || !INTEGERP (XCAR (depth))) /* A string. */ 1296 || !INTEGERP (XCAR (depth))) /* A string. */
1297 return false; 1297 return false;
1298 comment_depth = XINT (XCAR (depth)); 1298 literal_cache = XINT (XCAR (depth));
1299 if (!comment_depth) /* Not in a comment. */ 1299 if (!literal_cache) /* Not in a comment. */
1300 return false; 1300 return false;
1301 comment_style = XINT (XCDR (depth)); 1301 comment_style = XINT (XCDR (depth));
1302 if (comment_style != comstyle) /* Wrong sort of comment. This 1302 if (comment_style != comstyle) /* Wrong sort of comment. This
@@ -1304,20 +1304,20 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
1304 end of a "||" line comment. */ 1304 end of a "||" line comment. */
1305 return false; 1305 return false;
1306 1306
1307 /* comment_depth: -1 is a non-nested comment, otherwise it's 1307 /* literal_cache: -1 is a non-nested comment, otherwise it's
1308 the depth of nesting of nested comments. */ 1308 the depth of nesting of nested comments. */
1309 target_depth = comment_depth < 0 ? 0 : comment_depth - 1; 1309 target_depth = literal_cache < 0 ? 0 : literal_cache - 1;
1310 do 1310 do
1311 { 1311 {
1312 temp = Fprevious_single_property_change (make_number (from), 1312 temp = Fprevious_single_property_change (make_number (from),
1313 Qcomment_depth, Qnil, Qnil); 1313 Qliteral_cache, Qnil, Qnil);
1314 if (NILP (temp)) 1314 if (NILP (temp))
1315 return false; 1315 return false;
1316 from = XINT (temp); 1316 from = XINT (temp);
1317 } 1317 }
1318 while (from > stop 1318 while (from > stop
1319 && (depth = Fget_text_property (make_number (from - 1), 1319 && (depth = Fget_text_property (make_number (from - 1),
1320 Qcomment_depth, Qnil), 1320 Qliteral_cache, Qnil),
1321 XINT (XCAR (depth)) > target_depth)); 1321 XINT (XCAR (depth)) > target_depth));
1322 if (from <= stop) 1322 if (from <= stop)
1323 return false; 1323 return false;
@@ -4082,18 +4082,18 @@ syms_of_syntax (void)
4082 Fput (Qscan_error, Qerror_message, 4082 Fput (Qscan_error, Qerror_message,
4083 build_pure_c_string ("Scan error")); 4083 build_pure_c_string ("Scan error"));
4084 4084
4085 DEFSYM (Qcomment_depth, "comment-depth"); 4085 DEFSYM (Qliteral_cache, "literal-cache");
4086 DEFVAR_BOOL ("comment-cacheing-flag", comment_cacheing_flag, 4086 DEFVAR_BOOL ("literal-cacheing-flag", literal_cacheing_flag,
4087 doc: /* Non-nil means use new style comment handling. */); 4087 doc: /* Non-nil means use new style comment handling. */);
4088 comment_cacheing_flag = 0; 4088 literal_cacheing_flag = 1;
4089 4089
4090 DEFVAR_LISP ("comment-depth-values", Vcomment_depth_values, 4090 DEFVAR_LISP ("literal-cache-values", Vliteral_cache_values,
4091 doc: /* A list of values which the text property `comment-depth' can assume. 4091 doc: /* A list of values which the text property `literal-cache' can assume.
4092This is to ensure that any values which are `equal' are also `eq', as required by the text 4092This is to ensure that any values which are `equal' are also `eq', as required by the text
4093property functions. The list starts off empty, and any time a new value is needed, it is 4093property functions. The list starts off empty, and any time a new value is needed, it is
4094pushed onto the list. The second time a value is needed, it is found by `member', and the 4094pushed onto the list. The second time a value is needed, it is found by `member', and the
4095canonical equivalent used. */); 4095canonical equivalent used. */);
4096 Vcomment_depth_values = Qnil; 4096 Vliteral_cache_values = Qnil;
4097 4097
4098 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, 4098 DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments,
4099 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); 4099 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */);
@@ -4148,7 +4148,7 @@ In both cases, LIMIT bounds the search. */);
4148 DEFSYM (Qcomment_end_can_be_escaped, "comment-end-can-be-escaped"); 4148 DEFSYM (Qcomment_end_can_be_escaped, "comment-end-can-be-escaped");
4149 Fmake_variable_buffer_local (Qcomment_end_can_be_escaped); 4149 Fmake_variable_buffer_local (Qcomment_end_can_be_escaped);
4150 4150
4151 defsubr (&Strim_comment_cache); 4151 defsubr (&Strim_literal_cache);
4152 defsubr (&Ssyntax_table_p); 4152 defsubr (&Ssyntax_table_p);
4153 defsubr (&Ssyntax_table); 4153 defsubr (&Ssyntax_table);
4154 defsubr (&Sstandard_syntax_table); 4154 defsubr (&Sstandard_syntax_table);
diff --git a/src/syntax.h b/src/syntax.h
index 57c08737a63..cc277272daf 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -28,7 +28,7 @@ INLINE_HEADER_BEGIN
28 28
29extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); 29extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
30extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object); 30extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object);
31extern void check_comment_depth_hwm_for_prop (ptrdiff_t, Lisp_Object, 31extern void check_literal_cache_hwm_for_prop (ptrdiff_t, Lisp_Object,
32 Lisp_Object, Lisp_Object); 32 Lisp_Object, Lisp_Object);
33 33
34/* The standard syntax table is stored where it will automatically 34/* The standard syntax table is stored where it will automatically
diff --git a/src/textprop.c b/src/textprop.c
index a0191ad69cc..25fb6dcb444 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -341,10 +341,10 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
341 record_property_change (interval->position, LENGTH (interval), 341 record_property_change (interval->position, LENGTH (interval),
342 XCAR (sym), XCAR (value), 342 XCAR (sym), XCAR (value),
343 object); 343 object);
344 check_comment_depth_hwm_for_prop 344 check_literal_cache_hwm_for_prop
345 (interval->position, XCAR (sym), XCAR (value), object); 345 (interval->position, XCAR (sym), XCAR (value), object);
346 if (!EQ (property_value (properties, XCAR (sym)), Qunbound)) 346 if (!EQ (property_value (properties, XCAR (sym)), Qunbound))
347 check_comment_depth_hwm_for_prop 347 check_literal_cache_hwm_for_prop
348 (interval->position, XCAR (sym), 348 (interval->position, XCAR (sym),
349 property_value (properties, XCAR (sym)), object); 349 property_value (properties, XCAR (sym)), object);
350 } 350 }
@@ -359,7 +359,7 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
359 record_property_change (interval->position, LENGTH (interval), 359 record_property_change (interval->position, LENGTH (interval),
360 XCAR (sym), Qnil, 360 XCAR (sym), Qnil,
361 object); 361 object);
362 check_comment_depth_hwm_for_prop 362 check_literal_cache_hwm_for_prop
363 (interval->position, XCAR (sym), XCAR (value), object); 363 (interval->position, XCAR (sym), XCAR (value), object);
364 } 364 }
365 } 365 }
@@ -415,9 +415,9 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
415 { 415 {
416 record_property_change (i->position, LENGTH (i), 416 record_property_change (i->position, LENGTH (i),
417 sym1, Fcar (this_cdr), object); 417 sym1, Fcar (this_cdr), object);
418 check_comment_depth_hwm_for_prop 418 check_literal_cache_hwm_for_prop
419 (i->position, sym1, Fcar (this_cdr), object); 419 (i->position, sym1, Fcar (this_cdr), object);
420 check_comment_depth_hwm_for_prop 420 check_literal_cache_hwm_for_prop
421 (i->position, sym1, val1, object); 421 (i->position, sym1, val1, object);
422 } 422 }
423 423
@@ -455,7 +455,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
455 { 455 {
456 record_property_change (i->position, LENGTH (i), 456 record_property_change (i->position, LENGTH (i),
457 sym1, Qnil, object); 457 sym1, Qnil, object);
458 check_comment_depth_hwm_for_prop 458 check_literal_cache_hwm_for_prop
459 (i->position, sym1, val1, object); 459 (i->position, sym1, val1, object);
460 } 460 }
461 set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist))); 461 set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist)));
@@ -495,7 +495,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
495 record_property_change (i->position, LENGTH (i), 495 record_property_change (i->position, LENGTH (i),
496 sym, XCAR (XCDR (current_plist)), 496 sym, XCAR (XCDR (current_plist)),
497 object); 497 object);
498 check_comment_depth_hwm_for_prop 498 check_literal_cache_hwm_for_prop
499 (i->position, sym, XCAR (XCDR (current_plist)), object); 499 (i->position, sym, XCAR (XCDR (current_plist)), object);
500 } 500 }
501 current_plist = XCDR (XCDR (current_plist)); 501 current_plist = XCDR (XCDR (current_plist));
@@ -513,7 +513,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
513 { 513 {
514 record_property_change (i->position, LENGTH (i), 514 record_property_change (i->position, LENGTH (i),
515 sym, XCAR (XCDR (this)), object); 515 sym, XCAR (XCDR (this)), object);
516 check_comment_depth_hwm_for_prop 516 check_literal_cache_hwm_for_prop
517 (i->position, sym, XCAR (XCDR (this)), object); 517 (i->position, sym, XCAR (XCDR (this)), object);
518 } 518 }
519 519