diff options
| author | Joakim Verona | 2014-06-04 23:50:06 +0200 |
|---|---|---|
| committer | Joakim Verona | 2014-06-04 23:50:06 +0200 |
| commit | ce8171797dafbde765170b79e5f154afc4872e86 (patch) | |
| tree | 264b357b484de24929a3f2d20a34e0e43c006a15 /src/buffer.c | |
| parent | c1c9aa247cab9148916b367e719219ea0f055adb (diff) | |
| parent | b5d6fe3bf6e728c82a3ff63723d75519f7853716 (diff) | |
| download | emacs-ce8171797dafbde765170b79e5f154afc4872e86.tar.gz emacs-ce8171797dafbde765170b79e5f154afc4872e86.zip | |
upstream
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 417 |
1 files changed, 206 insertions, 211 deletions
diff --git a/src/buffer.c b/src/buffer.c index 71c01237205..bc0a796ea71 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | /* Buffer manipulation primitives for GNU Emacs. | 1 | /* Buffer manipulation primitives for GNU Emacs. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation, | 3 | Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation, Inc. |
| 4 | Inc. | ||
| 5 | 4 | ||
| 6 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 7 | 6 | ||
| @@ -20,8 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 19 | ||
| 21 | #include <config.h> | 20 | #include <config.h> |
| 22 | 21 | ||
| 23 | #define BUFFER_INLINE EXTERN_INLINE | ||
| 24 | |||
| 25 | #include <sys/types.h> | 22 | #include <sys/types.h> |
| 26 | #include <sys/stat.h> | 23 | #include <sys/stat.h> |
| 27 | #include <sys/param.h> | 24 | #include <sys/param.h> |
| @@ -47,6 +44,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 47 | #ifdef HAVE_XWIDGETS | 44 | #ifdef HAVE_XWIDGETS |
| 48 | #include "xwidget.h" | 45 | #include "xwidget.h" |
| 49 | #endif /* HAVE_XWIDGETS */ | 46 | #endif /* HAVE_XWIDGETS */ |
| 47 | #ifdef WINDOWSNT | ||
| 48 | #include "w32heap.h" /* for mmap_* */ | ||
| 49 | #endif | ||
| 50 | 50 | ||
| 51 | struct buffer *current_buffer; /* The current buffer. */ | 51 | struct buffer *current_buffer; /* The current buffer. */ |
| 52 | 52 | ||
| @@ -160,7 +160,8 @@ CHECK_OVERLAY (Lisp_Object x) | |||
| 160 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); | 160 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /* These setters are used only in this file, so they can be private. */ | 163 | /* These setters are used only in this file, so they can be private. |
| 164 | The public setters are inline functions defined in buffer.h. */ | ||
| 164 | static void | 165 | static void |
| 165 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) | 166 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) |
| 166 | { | 167 | { |
| @@ -207,11 +208,6 @@ bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) | |||
| 207 | b->INTERNAL_FIELD (buffer_file_coding_system) = val; | 208 | b->INTERNAL_FIELD (buffer_file_coding_system) = val; |
| 208 | } | 209 | } |
| 209 | static void | 210 | static void |
| 210 | bset_cache_long_scans (struct buffer *b, Lisp_Object val) | ||
| 211 | { | ||
| 212 | b->INTERNAL_FIELD (cache_long_scans) = val; | ||
| 213 | } | ||
| 214 | static void | ||
| 215 | bset_case_fold_search (struct buffer *b, Lisp_Object val) | 211 | bset_case_fold_search (struct buffer *b, Lisp_Object val) |
| 216 | { | 212 | { |
| 217 | b->INTERNAL_FIELD (case_fold_search) = val; | 213 | b->INTERNAL_FIELD (case_fold_search) = val; |
| @@ -583,7 +579,8 @@ even if it is dead. The return value is never nil. */) | |||
| 583 | BUF_END_UNCHANGED (b) = 0; | 579 | BUF_END_UNCHANGED (b) = 0; |
| 584 | BUF_BEG_UNCHANGED (b) = 0; | 580 | BUF_BEG_UNCHANGED (b) = 0; |
| 585 | *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ | 581 | *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ |
| 586 | b->text->inhibit_shrinking = 0; | 582 | b->text->inhibit_shrinking = false; |
| 583 | b->text->redisplay = false; | ||
| 587 | 584 | ||
| 588 | b->newline_cache = 0; | 585 | b->newline_cache = 0; |
| 589 | b->width_run_cache = 0; | 586 | b->width_run_cache = 0; |
| @@ -1168,10 +1165,10 @@ DEFUN ("buffer-local-value", Fbuffer_local_value, | |||
| 1168 | Sbuffer_local_value, 2, 2, 0, | 1165 | Sbuffer_local_value, 2, 2, 0, |
| 1169 | doc: /* Return the value of VARIABLE in BUFFER. | 1166 | doc: /* Return the value of VARIABLE in BUFFER. |
| 1170 | If VARIABLE does not have a buffer-local binding in BUFFER, the value | 1167 | If VARIABLE does not have a buffer-local binding in BUFFER, the value |
| 1171 | is the default binding of the variable. */) | 1168 | is the default binding of the variable. */) |
| 1172 | (register Lisp_Object variable, register Lisp_Object buffer) | 1169 | (register Lisp_Object variable, register Lisp_Object buffer) |
| 1173 | { | 1170 | { |
| 1174 | register Lisp_Object result = buffer_local_value_1 (variable, buffer); | 1171 | register Lisp_Object result = buffer_local_value (variable, buffer); |
| 1175 | 1172 | ||
| 1176 | if (EQ (result, Qunbound)) | 1173 | if (EQ (result, Qunbound)) |
| 1177 | xsignal1 (Qvoid_variable, variable); | 1174 | xsignal1 (Qvoid_variable, variable); |
| @@ -1184,7 +1181,7 @@ is the default binding of the variable. */) | |||
| 1184 | locally unbound. */ | 1181 | locally unbound. */ |
| 1185 | 1182 | ||
| 1186 | Lisp_Object | 1183 | Lisp_Object |
| 1187 | buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer) | 1184 | buffer_local_value (Lisp_Object variable, Lisp_Object buffer) |
| 1188 | { | 1185 | { |
| 1189 | register struct buffer *buf; | 1186 | register struct buffer *buf; |
| 1190 | register Lisp_Object result; | 1187 | register Lisp_Object result; |
| @@ -1338,15 +1335,59 @@ No argument or nil as argument means use current buffer as BUFFER. */) | |||
| 1338 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; | 1335 | return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; |
| 1339 | } | 1336 | } |
| 1340 | 1337 | ||
| 1338 | DEFUN ("force-mode-line-update", Fforce_mode_line_update, | ||
| 1339 | Sforce_mode_line_update, 0, 1, 0, | ||
| 1340 | doc: /* Force redisplay of the current buffer's mode line and header line. | ||
| 1341 | With optional non-nil ALL, force redisplay of all mode lines and | ||
| 1342 | header lines. This function also forces recomputation of the | ||
| 1343 | menu bar menus and the frame title. */) | ||
| 1344 | (Lisp_Object all) | ||
| 1345 | { | ||
| 1346 | if (!NILP (all)) | ||
| 1347 | { | ||
| 1348 | update_mode_lines = 10; | ||
| 1349 | /* FIXME: This can't be right. */ | ||
| 1350 | current_buffer->prevent_redisplay_optimizations_p = true; | ||
| 1351 | } | ||
| 1352 | else if (buffer_window_count (current_buffer)) | ||
| 1353 | { | ||
| 1354 | bset_update_mode_line (current_buffer); | ||
| 1355 | current_buffer->prevent_redisplay_optimizations_p = true; | ||
| 1356 | } | ||
| 1357 | return all; | ||
| 1358 | } | ||
| 1359 | |||
| 1341 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, | 1360 | DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, |
| 1342 | 1, 1, 0, | 1361 | 1, 1, 0, |
| 1343 | doc: /* Mark current buffer as modified or unmodified according to FLAG. | 1362 | doc: /* Mark current buffer as modified or unmodified according to FLAG. |
| 1344 | A non-nil FLAG means mark the buffer modified. */) | 1363 | A non-nil FLAG means mark the buffer modified. */) |
| 1345 | (Lisp_Object flag) | 1364 | (Lisp_Object flag) |
| 1346 | { | 1365 | { |
| 1366 | Frestore_buffer_modified_p (flag); | ||
| 1367 | |||
| 1368 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1369 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1370 | state by recording/restoring the state around blocks of code. | ||
| 1371 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1372 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1373 | would incur additional redisplay costs if we'd set | ||
| 1374 | update_modes_lines unconditionally. | ||
| 1375 | |||
| 1376 | Ideally, I think there should be another mechanism for fontifying | ||
| 1377 | buffers without "modifying" buffers, or redisplay should be | ||
| 1378 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1379 | return Fforce_mode_line_update (Qnil); | ||
| 1380 | } | ||
| 1381 | |||
| 1382 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1383 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1384 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1385 | It is not ensured that mode lines will be updated to show the modified | ||
| 1386 | state of the current buffer. Use with care. */) | ||
| 1387 | (Lisp_Object flag) | ||
| 1388 | { | ||
| 1347 | Lisp_Object fn; | 1389 | Lisp_Object fn; |
| 1348 | 1390 | ||
| 1349 | #ifdef CLASH_DETECTION | ||
| 1350 | /* If buffer becoming modified, lock the file. | 1391 | /* If buffer becoming modified, lock the file. |
| 1351 | If buffer becoming unmodified, unlock the file. */ | 1392 | If buffer becoming unmodified, unlock the file. */ |
| 1352 | 1393 | ||
| @@ -1364,7 +1405,6 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1364 | else if (already && NILP (flag)) | 1405 | else if (already && NILP (flag)) |
| 1365 | unlock_file (fn); | 1406 | unlock_file (fn); |
| 1366 | } | 1407 | } |
| 1367 | #endif /* CLASH_DETECTION */ | ||
| 1368 | 1408 | ||
| 1369 | /* Here we have a problem. SAVE_MODIFF is used here to encode | 1409 | /* Here we have a problem. SAVE_MODIFF is used here to encode |
| 1370 | buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as | 1410 | buffer-modified-p (as SAVE_MODIFF<MODIFF) as well as |
| @@ -1386,52 +1426,6 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1386 | or increase MODIFF. */ | 1426 | or increase MODIFF. */ |
| 1387 | : MODIFF++); | 1427 | : MODIFF++); |
| 1388 | 1428 | ||
| 1389 | /* Set update_mode_lines only if buffer is displayed in some window. | ||
| 1390 | Packages like jit-lock or lazy-lock preserve a buffer's modified | ||
| 1391 | state by recording/restoring the state around blocks of code. | ||
| 1392 | Setting update_mode_lines makes redisplay consider all windows | ||
| 1393 | (on all frames). Stealth fontification of buffers not displayed | ||
| 1394 | would incur additional redisplay costs if we'd set | ||
| 1395 | update_modes_lines unconditionally. | ||
| 1396 | |||
| 1397 | Ideally, I think there should be another mechanism for fontifying | ||
| 1398 | buffers without "modifying" buffers, or redisplay should be | ||
| 1399 | smarter about updating the `*' in mode lines. --gerd */ | ||
| 1400 | if (buffer_window_count (current_buffer)) | ||
| 1401 | { | ||
| 1402 | ++update_mode_lines; | ||
| 1403 | current_buffer->prevent_redisplay_optimizations_p = 1; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | return flag; | ||
| 1407 | } | ||
| 1408 | |||
| 1409 | DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, | ||
| 1410 | Srestore_buffer_modified_p, 1, 1, 0, | ||
| 1411 | doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. | ||
| 1412 | It is not ensured that mode lines will be updated to show the modified | ||
| 1413 | state of the current buffer. Use with care. */) | ||
| 1414 | (Lisp_Object flag) | ||
| 1415 | { | ||
| 1416 | #ifdef CLASH_DETECTION | ||
| 1417 | Lisp_Object fn; | ||
| 1418 | |||
| 1419 | /* If buffer becoming modified, lock the file. | ||
| 1420 | If buffer becoming unmodified, unlock the file. */ | ||
| 1421 | |||
| 1422 | fn = BVAR (current_buffer, file_truename); | ||
| 1423 | /* Test buffer-file-name so that binding it to nil is effective. */ | ||
| 1424 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | ||
| 1425 | { | ||
| 1426 | bool already = SAVE_MODIFF < MODIFF; | ||
| 1427 | if (!already && !NILP (flag)) | ||
| 1428 | lock_file (fn); | ||
| 1429 | else if (already && NILP (flag)) | ||
| 1430 | unlock_file (fn); | ||
| 1431 | } | ||
| 1432 | #endif /* CLASH_DETECTION */ | ||
| 1433 | |||
| 1434 | SAVE_MODIFF = NILP (flag) ? MODIFF : 0; | ||
| 1435 | return flag; | 1429 | return flag; |
| 1436 | } | 1430 | } |
| 1437 | 1431 | ||
| @@ -1519,7 +1513,7 @@ This does not change the name of the visited file (if any). */) | |||
| 1519 | 1513 | ||
| 1520 | /* Catch redisplay's attention. Unless we do this, the mode lines for | 1514 | /* Catch redisplay's attention. Unless we do this, the mode lines for |
| 1521 | any windows displaying current_buffer will stay unchanged. */ | 1515 | any windows displaying current_buffer will stay unchanged. */ |
| 1522 | update_mode_lines++; | 1516 | update_mode_lines = 11; |
| 1523 | 1517 | ||
| 1524 | XSETBUFFER (buf, current_buffer); | 1518 | XSETBUFFER (buf, current_buffer); |
| 1525 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); | 1519 | Fsetcar (Frassq (buf, Vbuffer_alist), newname); |
| @@ -1804,7 +1798,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1804 | /* Run replace_buffer_in_windows before making another buffer current | 1798 | /* Run replace_buffer_in_windows before making another buffer current |
| 1805 | since set-window-buffer-start-and-point will refuse to make another | 1799 | since set-window-buffer-start-and-point will refuse to make another |
| 1806 | buffer current if the selected window does not show the current | 1800 | buffer current if the selected window does not show the current |
| 1807 | buffer. (Bug#10114) */ | 1801 | buffer (bug#10114). */ |
| 1808 | replace_buffer_in_windows (buffer); | 1802 | replace_buffer_in_windows (buffer); |
| 1809 | 1803 | ||
| 1810 | /* Exit if replacing the buffer in windows has killed our buffer. */ | 1804 | /* Exit if replacing the buffer in windows has killed our buffer. */ |
| @@ -1830,10 +1824,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1830 | 1824 | ||
| 1831 | /* Now there is no question: we can kill the buffer. */ | 1825 | /* Now there is no question: we can kill the buffer. */ |
| 1832 | 1826 | ||
| 1833 | #ifdef CLASH_DETECTION | ||
| 1834 | /* Unlock this buffer's file, if it is locked. */ | 1827 | /* Unlock this buffer's file, if it is locked. */ |
| 1835 | unlock_buffer (b); | 1828 | unlock_buffer (b); |
| 1836 | #endif /* CLASH_DETECTION */ | ||
| 1837 | 1829 | ||
| 1838 | GCPRO1 (buffer); | 1830 | GCPRO1 (buffer); |
| 1839 | kill_buffer_processes (buffer); | 1831 | kill_buffer_processes (buffer); |
| @@ -1883,6 +1875,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1883 | 1875 | ||
| 1884 | if (b->base_buffer) | 1876 | if (b->base_buffer) |
| 1885 | { | 1877 | { |
| 1878 | INTERVAL i; | ||
| 1886 | /* Unchain all markers that belong to this indirect buffer. | 1879 | /* Unchain all markers that belong to this indirect buffer. |
| 1887 | Don't unchain the markers that belong to the base buffer | 1880 | Don't unchain the markers that belong to the base buffer |
| 1888 | or its other indirect buffers. */ | 1881 | or its other indirect buffers. */ |
| @@ -1897,6 +1890,14 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1897 | else | 1890 | else |
| 1898 | mp = &m->next; | 1891 | mp = &m->next; |
| 1899 | } | 1892 | } |
| 1893 | /* Intervals should be owned by the base buffer (Bug#16502). */ | ||
| 1894 | i = buffer_intervals (b); | ||
| 1895 | if (i) | ||
| 1896 | { | ||
| 1897 | Lisp_Object owner; | ||
| 1898 | XSETBUFFER (owner, b->base_buffer); | ||
| 1899 | set_interval_object (i, owner); | ||
| 1900 | } | ||
| 1900 | } | 1901 | } |
| 1901 | else | 1902 | else |
| 1902 | { | 1903 | { |
| @@ -2085,7 +2086,7 @@ the current buffer's major mode. */) | |||
| 2085 | count = SPECPDL_INDEX (); | 2086 | count = SPECPDL_INDEX (); |
| 2086 | 2087 | ||
| 2087 | /* To select a nonfundamental mode, | 2088 | /* To select a nonfundamental mode, |
| 2088 | select the buffer temporarily and then call the mode function. */ | 2089 | select the buffer temporarily and then call the mode function. */ |
| 2089 | 2090 | ||
| 2090 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 2091 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 2091 | 2092 | ||
| @@ -2125,7 +2126,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2125 | 2126 | ||
| 2126 | old_buf = current_buffer; | 2127 | old_buf = current_buffer; |
| 2127 | current_buffer = b; | 2128 | current_buffer = b; |
| 2128 | last_known_column_point = -1; /* invalidate indentation cache */ | 2129 | last_known_column_point = -1; /* Invalidate indentation cache. */ |
| 2129 | 2130 | ||
| 2130 | if (old_buf) | 2131 | if (old_buf) |
| 2131 | { | 2132 | { |
| @@ -2149,7 +2150,7 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2149 | fetch_buffer_markers (b); | 2150 | fetch_buffer_markers (b); |
| 2150 | 2151 | ||
| 2151 | /* Look down buffer's list of local Lisp variables | 2152 | /* Look down buffer's list of local Lisp variables |
| 2152 | to find and update any that forward into C variables. */ | 2153 | to find and update any that forward into C variables. */ |
| 2153 | 2154 | ||
| 2154 | do | 2155 | do |
| 2155 | { | 2156 | { |
| @@ -2193,11 +2194,12 @@ set_buffer_temp (struct buffer *b) | |||
| 2193 | 2194 | ||
| 2194 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, | 2195 | DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, |
| 2195 | doc: /* Make buffer BUFFER-OR-NAME current for editing operations. | 2196 | doc: /* Make buffer BUFFER-OR-NAME current for editing operations. |
| 2196 | BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See | 2197 | BUFFER-OR-NAME may be a buffer or the name of an existing buffer. |
| 2197 | also `with-current-buffer' when you want to make a buffer current | 2198 | See also `with-current-buffer' when you want to make a buffer current |
| 2198 | temporarily. This function does not display the buffer, so its effect | 2199 | temporarily. This function does not display the buffer, so its effect |
| 2199 | ends when the current command terminates. Use `switch-to-buffer' or | 2200 | ends when the current command terminates. Use `switch-to-buffer' or |
| 2200 | `pop-to-buffer' to switch buffers permanently. */) | 2201 | `pop-to-buffer' to switch buffers permanently. |
| 2202 | The return value is the buffer made current. */) | ||
| 2201 | (register Lisp_Object buffer_or_name) | 2203 | (register Lisp_Object buffer_or_name) |
| 2202 | { | 2204 | { |
| 2203 | register Lisp_Object buffer; | 2205 | register Lisp_Object buffer; |
| @@ -2267,7 +2269,7 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) | |||
| 2267 | } | 2269 | } |
| 2268 | 2270 | ||
| 2269 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) | 2271 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) |
| 2270 | args_out_of_range (*b, *e); | 2272 | args_out_of_range_3 (Fcurrent_buffer (), *b, *e); |
| 2271 | } | 2273 | } |
| 2272 | 2274 | ||
| 2273 | /* Advance BYTE_POS up to a character boundary | 2275 | /* Advance BYTE_POS up to a character boundary |
| @@ -2498,6 +2500,8 @@ current buffer is cleared. */) | |||
| 2498 | if (narrowed) | 2500 | if (narrowed) |
| 2499 | error ("Changing multibyteness in a narrowed buffer"); | 2501 | error ("Changing multibyteness in a narrowed buffer"); |
| 2500 | 2502 | ||
| 2503 | invalidate_buffer_caches (current_buffer, BEGV, ZV); | ||
| 2504 | |||
| 2501 | if (NILP (flag)) | 2505 | if (NILP (flag)) |
| 2502 | { | 2506 | { |
| 2503 | ptrdiff_t pos, stop; | 2507 | ptrdiff_t pos, stop; |
| @@ -2716,7 +2720,7 @@ current buffer is cleared. */) | |||
| 2716 | 2720 | ||
| 2717 | /* If buffer is shown in a window, let redisplay consider other windows. */ | 2721 | /* If buffer is shown in a window, let redisplay consider other windows. */ |
| 2718 | if (buffer_window_count (current_buffer)) | 2722 | if (buffer_window_count (current_buffer)) |
| 2719 | ++windows_or_buffers_changed; | 2723 | windows_or_buffers_changed = 10; |
| 2720 | 2724 | ||
| 2721 | /* Copy this buffer's new multibyte status | 2725 | /* Copy this buffer's new multibyte status |
| 2722 | into all of its indirect buffers. */ | 2726 | into all of its indirect buffers. */ |
| @@ -2776,7 +2780,7 @@ the normal hook `change-major-mode-hook'. */) | |||
| 2776 | 2780 | ||
| 2777 | /* Force mode-line redisplay. Useful here because all major mode | 2781 | /* Force mode-line redisplay. Useful here because all major mode |
| 2778 | commands call this function. */ | 2782 | commands call this function. */ |
| 2779 | update_mode_lines++; | 2783 | update_mode_lines = 12; |
| 2780 | 2784 | ||
| 2781 | return Qnil; | 2785 | return Qnil; |
| 2782 | } | 2786 | } |
| @@ -3150,6 +3154,7 @@ struct sortvec | |||
| 3150 | Lisp_Object overlay; | 3154 | Lisp_Object overlay; |
| 3151 | ptrdiff_t beg, end; | 3155 | ptrdiff_t beg, end; |
| 3152 | EMACS_INT priority; | 3156 | EMACS_INT priority; |
| 3157 | EMACS_INT spriority; /* Secondary priority. */ | ||
| 3153 | }; | 3158 | }; |
| 3154 | 3159 | ||
| 3155 | static int | 3160 | static int |
| @@ -3157,19 +3162,28 @@ compare_overlays (const void *v1, const void *v2) | |||
| 3157 | { | 3162 | { |
| 3158 | const struct sortvec *s1 = v1; | 3163 | const struct sortvec *s1 = v1; |
| 3159 | const struct sortvec *s2 = v2; | 3164 | const struct sortvec *s2 = v2; |
| 3165 | /* Return 1 if s1 should take precedence, -1 if v2 should take precedence, | ||
| 3166 | and 0 if they're equal. */ | ||
| 3160 | if (s1->priority != s2->priority) | 3167 | if (s1->priority != s2->priority) |
| 3161 | return s1->priority < s2->priority ? -1 : 1; | 3168 | return s1->priority < s2->priority ? -1 : 1; |
| 3162 | if (s1->beg != s2->beg) | 3169 | /* If the priority is equal, give precedence to the one not covered by the |
| 3163 | return s1->beg < s2->beg ? -1 : 1; | 3170 | other. If neither covers the other, obey spriority. */ |
| 3164 | if (s1->end != s2->end) | 3171 | else if (s1->beg < s2->beg) |
| 3172 | return (s1->end < s2->end && s1->spriority > s2->spriority ? 1 : -1); | ||
| 3173 | else if (s1->beg > s2->beg) | ||
| 3174 | return (s1->end > s2->end && s1->spriority < s2->spriority ? -1 : 1); | ||
| 3175 | else if (s1->end != s2->end) | ||
| 3165 | return s2->end < s1->end ? -1 : 1; | 3176 | return s2->end < s1->end ? -1 : 1; |
| 3166 | /* Avoid the non-determinism of qsort by choosing an arbitrary ordering | 3177 | else if (s1->spriority != s2->spriority) |
| 3167 | between "equal" overlays. The result can still change between | 3178 | return (s1->spriority < s2->spriority ? -1 : 1); |
| 3168 | invocations of Emacs, but it won't change in the middle of | 3179 | else if (EQ (s1->overlay, s2->overlay)) |
| 3169 | `find_field' (bug#6830). */ | 3180 | return 0; |
| 3170 | if (!EQ (s1->overlay, s2->overlay)) | 3181 | else |
| 3182 | /* Avoid the non-determinism of qsort by choosing an arbitrary ordering | ||
| 3183 | between "equal" overlays. The result can still change between | ||
| 3184 | invocations of Emacs, but it won't change in the middle of | ||
| 3185 | `find_field' (bug#6830). */ | ||
| 3171 | return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1; | 3186 | return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1; |
| 3172 | return 0; | ||
| 3173 | } | 3187 | } |
| 3174 | 3188 | ||
| 3175 | /* Sort an array of overlays by priority. The array is modified in place. | 3189 | /* Sort an array of overlays by priority. The array is modified in place. |
| @@ -3212,10 +3226,23 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) | |||
| 3212 | sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3226 | sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 3213 | sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3227 | sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 3214 | tem = Foverlay_get (overlay, Qpriority); | 3228 | tem = Foverlay_get (overlay, Qpriority); |
| 3215 | if (INTEGERP (tem)) | 3229 | if (NILP (tem)) |
| 3216 | sortvec[j].priority = XINT (tem); | 3230 | { |
| 3217 | else | 3231 | sortvec[j].priority = 0; |
| 3218 | sortvec[j].priority = 0; | 3232 | sortvec[j].spriority = 0; |
| 3233 | } | ||
| 3234 | else if (INTEGERP (tem)) | ||
| 3235 | { | ||
| 3236 | sortvec[j].priority = XINT (tem); | ||
| 3237 | sortvec[j].spriority = 0; | ||
| 3238 | } | ||
| 3239 | else if (CONSP (tem)) | ||
| 3240 | { | ||
| 3241 | Lisp_Object car = XCAR (tem); | ||
| 3242 | Lisp_Object cdr = XCDR (tem); | ||
| 3243 | sortvec[j].priority = INTEGERP (car) ? XINT (car) : 0; | ||
| 3244 | sortvec[j].spriority = INTEGERP (cdr) ? XINT (cdr) : 0; | ||
| 3245 | } | ||
| 3219 | j++; | 3246 | j++; |
| 3220 | } | 3247 | } |
| 3221 | } | 3248 | } |
| @@ -3313,17 +3340,18 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | |||
| 3313 | } | 3340 | } |
| 3314 | } | 3341 | } |
| 3315 | 3342 | ||
| 3316 | /* Return the concatenation of the strings associated with overlays that | 3343 | /* Concatenate the strings associated with overlays that begin or end |
| 3317 | begin or end at POS, ignoring overlays that are specific to a window | 3344 | at POS, ignoring overlays that are specific to windows other than W. |
| 3318 | other than W. The strings are concatenated in the appropriate order: | 3345 | The strings are concatenated in the appropriate order: shorter |
| 3319 | shorter overlays nest inside longer ones, and higher priority inside | 3346 | overlays nest inside longer ones, and higher priority inside lower. |
| 3320 | lower. Normally all of the after-strings come first, but zero-sized | 3347 | Normally all of the after-strings come first, but zero-sized |
| 3321 | overlays have their after-strings ride along with the before-strings | 3348 | overlays have their after-strings ride along with the |
| 3322 | because it would look strange to print them inside-out. | 3349 | before-strings because it would look strange to print them |
| 3350 | inside-out. | ||
| 3323 | 3351 | ||
| 3324 | Returns the string length, and stores the contents indirectly through | 3352 | Returns the concatenated string's length, and return the pointer to |
| 3325 | PSTR, if that variable is non-null. The string may be overwritten by | 3353 | that string via PSTR, if that variable is non-NULL. The storage of |
| 3326 | subsequent calls. */ | 3354 | the concatenated strings may be overwritten by subsequent calls. */ |
| 3327 | 3355 | ||
| 3328 | ptrdiff_t | 3356 | ptrdiff_t |
| 3329 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) | 3357 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) |
| @@ -3834,7 +3862,7 @@ DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0, | |||
| 3834 | } | 3862 | } |
| 3835 | 3863 | ||
| 3836 | DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0, | 3864 | DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0, |
| 3837 | doc: /* Create a new overlay with range BEG to END in BUFFER. | 3865 | doc: /* Create a new overlay with range BEG to END in BUFFER and return it. |
| 3838 | If omitted, BUFFER defaults to the current buffer. | 3866 | If omitted, BUFFER defaults to the current buffer. |
| 3839 | BEG and END may be integers or markers. | 3867 | BEG and END may be integers or markers. |
| 3840 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker | 3868 | The fourth arg FRONT-ADVANCE, if non-nil, makes the marker |
| @@ -3917,17 +3945,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 3917 | 3945 | ||
| 3918 | BUF_COMPUTE_UNCHANGED (buf, start, end); | 3946 | BUF_COMPUTE_UNCHANGED (buf, start, end); |
| 3919 | 3947 | ||
| 3920 | /* If BUF is visible, consider updating the display if ... */ | 3948 | bset_redisplay (buf); |
| 3921 | if (buffer_window_count (buf) > 0) | ||
| 3922 | { | ||
| 3923 | /* ... it's visible in other window than selected, */ | ||
| 3924 | if (buf != XBUFFER (XWINDOW (selected_window)->contents)) | ||
| 3925 | windows_or_buffers_changed = 1; | ||
| 3926 | /* ... or if we modify an overlay at the end of the buffer | ||
| 3927 | and so we cannot be sure that window end is still valid. */ | ||
| 3928 | else if (end >= ZV && start <= ZV) | ||
| 3929 | windows_or_buffers_changed = 1; | ||
| 3930 | } | ||
| 3931 | 3949 | ||
| 3932 | ++BUF_OVERLAY_MODIFF (buf); | 3950 | ++BUF_OVERLAY_MODIFF (buf); |
| 3933 | } | 3951 | } |
| @@ -4158,9 +4176,10 @@ OVERLAY. */) | |||
| 4158 | } | 4176 | } |
| 4159 | 4177 | ||
| 4160 | 4178 | ||
| 4161 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | 4179 | DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 2, 0, |
| 4162 | doc: /* Return a list of the overlays that contain the character at POS. */) | 4180 | doc: /* Return a list of the overlays that contain the character at POS. |
| 4163 | (Lisp_Object pos) | 4181 | If SORTED is non-nil, then sort them by decreasing priority. */) |
| 4182 | (Lisp_Object pos, Lisp_Object sorted) | ||
| 4164 | { | 4183 | { |
| 4165 | ptrdiff_t len, noverlays; | 4184 | ptrdiff_t len, noverlays; |
| 4166 | Lisp_Object *overlay_vec; | 4185 | Lisp_Object *overlay_vec; |
| @@ -4180,6 +4199,10 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 4180 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 4199 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4181 | NULL, NULL, 0); | 4200 | NULL, NULL, 0); |
| 4182 | 4201 | ||
| 4202 | if (!NILP (sorted)) | ||
| 4203 | noverlays = sort_overlays (overlay_vec, noverlays, | ||
| 4204 | WINDOWP (sorted) ? XWINDOW (sorted) : NULL); | ||
| 4205 | |||
| 4183 | /* Make a list of them all. */ | 4206 | /* Make a list of them all. */ |
| 4184 | result = Flist (noverlays, overlay_vec); | 4207 | result = Flist (noverlays, overlay_vec); |
| 4185 | 4208 | ||
| @@ -4621,7 +4644,8 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4621 | Allocation with mmap | 4644 | Allocation with mmap |
| 4622 | ***********************************************************************/ | 4645 | ***********************************************************************/ |
| 4623 | 4646 | ||
| 4624 | #ifdef USE_MMAP_FOR_BUFFERS | 4647 | /* Note: WINDOWSNT implements this stuff on w32heap.c. */ |
| 4648 | #if defined USE_MMAP_FOR_BUFFERS && !defined WINDOWSNT | ||
| 4625 | 4649 | ||
| 4626 | #include <sys/mman.h> | 4650 | #include <sys/mman.h> |
| 4627 | 4651 | ||
| @@ -4687,11 +4711,6 @@ static struct mmap_region *mmap_regions; | |||
| 4687 | 4711 | ||
| 4688 | static int mmap_fd; | 4712 | static int mmap_fd; |
| 4689 | 4713 | ||
| 4690 | /* Temporary storage for mmap_set_vars, see there. */ | ||
| 4691 | |||
| 4692 | static struct mmap_region *mmap_regions_1; | ||
| 4693 | static int mmap_fd_1; | ||
| 4694 | |||
| 4695 | /* Page size on this system. */ | 4714 | /* Page size on this system. */ |
| 4696 | 4715 | ||
| 4697 | static int mmap_page_size; | 4716 | static int mmap_page_size; |
| @@ -4763,36 +4782,6 @@ mmap_init (void) | |||
| 4763 | mmap_page_size = getpagesize (); | 4782 | mmap_page_size = getpagesize (); |
| 4764 | } | 4783 | } |
| 4765 | 4784 | ||
| 4766 | /* Return a region overlapping address range START...END, or null if | ||
| 4767 | none. END is not including, i.e. the last byte in the range | ||
| 4768 | is at END - 1. */ | ||
| 4769 | |||
| 4770 | static struct mmap_region * | ||
| 4771 | mmap_find (void *start, void *end) | ||
| 4772 | { | ||
| 4773 | struct mmap_region *r; | ||
| 4774 | char *s = start, *e = end; | ||
| 4775 | |||
| 4776 | for (r = mmap_regions; r; r = r->next) | ||
| 4777 | { | ||
| 4778 | char *rstart = (char *) r; | ||
| 4779 | char *rend = rstart + r->nbytes_mapped; | ||
| 4780 | |||
| 4781 | if (/* First byte of range, i.e. START, in this region? */ | ||
| 4782 | (s >= rstart && s < rend) | ||
| 4783 | /* Last byte of range, i.e. END - 1, in this region? */ | ||
| 4784 | || (e > rstart && e <= rend) | ||
| 4785 | /* First byte of this region in the range? */ | ||
| 4786 | || (rstart >= s && rstart < e) | ||
| 4787 | /* Last byte of this region in the range? */ | ||
| 4788 | || (rend > s && rend <= e)) | ||
| 4789 | break; | ||
| 4790 | } | ||
| 4791 | |||
| 4792 | return r; | ||
| 4793 | } | ||
| 4794 | |||
| 4795 | |||
| 4796 | /* Unmap a region. P is a pointer to the start of the user-araa of | 4785 | /* Unmap a region. P is a pointer to the start of the user-araa of |
| 4797 | the region. */ | 4786 | the region. */ |
| 4798 | 4787 | ||
| @@ -4869,38 +4858,6 @@ mmap_enlarge (struct mmap_region *r, int npages) | |||
| 4869 | } | 4858 | } |
| 4870 | 4859 | ||
| 4871 | 4860 | ||
| 4872 | /* Set or reset variables holding references to mapped regions. | ||
| 4873 | If not RESTORE_P, set all variables to null. If RESTORE_P, set all | ||
| 4874 | variables to the start of the user-areas of mapped regions. | ||
| 4875 | |||
| 4876 | This function is called from Fdump_emacs to ensure that the dumped | ||
| 4877 | Emacs doesn't contain references to memory that won't be mapped | ||
| 4878 | when Emacs starts. */ | ||
| 4879 | |||
| 4880 | void | ||
| 4881 | mmap_set_vars (bool restore_p) | ||
| 4882 | { | ||
| 4883 | struct mmap_region *r; | ||
| 4884 | |||
| 4885 | if (restore_p) | ||
| 4886 | { | ||
| 4887 | mmap_regions = mmap_regions_1; | ||
| 4888 | mmap_fd = mmap_fd_1; | ||
| 4889 | for (r = mmap_regions; r; r = r->next) | ||
| 4890 | *r->var = MMAP_USER_AREA (r); | ||
| 4891 | } | ||
| 4892 | else | ||
| 4893 | { | ||
| 4894 | for (r = mmap_regions; r; r = r->next) | ||
| 4895 | *r->var = NULL; | ||
| 4896 | mmap_regions_1 = mmap_regions; | ||
| 4897 | mmap_regions = NULL; | ||
| 4898 | mmap_fd_1 = mmap_fd; | ||
| 4899 | mmap_fd = -1; | ||
| 4900 | } | ||
| 4901 | } | ||
| 4902 | |||
| 4903 | |||
| 4904 | /* Allocate a block of storage large enough to hold NBYTES bytes of | 4861 | /* Allocate a block of storage large enough to hold NBYTES bytes of |
| 4905 | data. A pointer to the data is returned in *VAR. VAR is thus the | 4862 | data. A pointer to the data is returned in *VAR. VAR is thus the |
| 4906 | address of some variable which will use the data area. | 4863 | address of some variable which will use the data area. |
| @@ -5196,7 +5153,7 @@ init_buffer_once (void) | |||
| 5196 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); | 5153 | bset_buffer_file_coding_system (&buffer_defaults, Qnil); |
| 5197 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); | 5154 | XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); |
| 5198 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); | 5155 | XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); |
| 5199 | bset_cache_long_scans (&buffer_defaults, Qnil); | 5156 | bset_cache_long_scans (&buffer_defaults, Qt); |
| 5200 | bset_file_truename (&buffer_defaults, Qnil); | 5157 | bset_file_truename (&buffer_defaults, Qnil); |
| 5201 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); | 5158 | XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); |
| 5202 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); | 5159 | XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); |
| @@ -5318,23 +5275,57 @@ init_buffer_once (void) | |||
| 5318 | } | 5275 | } |
| 5319 | 5276 | ||
| 5320 | void | 5277 | void |
| 5321 | init_buffer (void) | 5278 | init_buffer (int initialized) |
| 5322 | { | 5279 | { |
| 5323 | char *pwd; | 5280 | char *pwd; |
| 5324 | Lisp_Object temp; | 5281 | Lisp_Object temp; |
| 5325 | ptrdiff_t len; | 5282 | ptrdiff_t len; |
| 5326 | 5283 | ||
| 5327 | #ifdef USE_MMAP_FOR_BUFFERS | 5284 | #ifdef USE_MMAP_FOR_BUFFERS |
| 5328 | { | 5285 | if (initialized) |
| 5329 | /* When using the ralloc implementation based on mmap(2), buffer | 5286 | { |
| 5330 | text pointers will have been set to null in the dumped Emacs. | 5287 | struct buffer *b; |
| 5331 | Map new memory. */ | 5288 | |
| 5332 | struct buffer *b; | 5289 | #ifndef WINDOWSNT |
| 5333 | 5290 | /* These must be reset in the dumped Emacs, to avoid stale | |
| 5334 | FOR_EACH_BUFFER (b) | 5291 | references to mmap'ed memory from before the dump. |
| 5335 | if (b->text->beg == NULL) | 5292 | |
| 5336 | enlarge_buffer_text (b, 0); | 5293 | WINDOWSNT doesn't need this because it doesn't track mmap'ed |
| 5337 | } | 5294 | regions by hand (see w32heap.c, which uses system APIs for |
| 5295 | that purpose), and thus doesn't use mmap_regions. */ | ||
| 5296 | mmap_regions = NULL; | ||
| 5297 | mmap_fd = -1; | ||
| 5298 | #endif | ||
| 5299 | |||
| 5300 | /* The dumped buffers reference addresses of buffer text | ||
| 5301 | recorded by temacs, that cannot be used by the dumped Emacs. | ||
| 5302 | We map new memory for their text here. | ||
| 5303 | |||
| 5304 | Implementation note: the buffers we carry from temacs are: | ||
| 5305 | " prin1", "*scratch*", " *Minibuf-0*", "*Messages*", and | ||
| 5306 | " *code-conversion-work*". They are created by | ||
| 5307 | init_buffer_once and init_window_once (which are not called | ||
| 5308 | in the dumped Emacs), and by the first call to coding.c routines. */ | ||
| 5309 | FOR_EACH_BUFFER (b) | ||
| 5310 | { | ||
| 5311 | b->text->beg = NULL; | ||
| 5312 | enlarge_buffer_text (b, 0); | ||
| 5313 | } | ||
| 5314 | } | ||
| 5315 | else | ||
| 5316 | { | ||
| 5317 | struct buffer *b; | ||
| 5318 | |||
| 5319 | /* Only buffers with allocated buffer text should be present at | ||
| 5320 | this point in temacs. */ | ||
| 5321 | FOR_EACH_BUFFER (b) | ||
| 5322 | { | ||
| 5323 | eassert (b->text->beg != NULL); | ||
| 5324 | } | ||
| 5325 | } | ||
| 5326 | #else /* not USE_MMAP_FOR_BUFFERS */ | ||
| 5327 | /* Avoid compiler warnings. */ | ||
| 5328 | initialized = initialized; | ||
| 5338 | #endif /* USE_MMAP_FOR_BUFFERS */ | 5329 | #endif /* USE_MMAP_FOR_BUFFERS */ |
| 5339 | 5330 | ||
| 5340 | Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); | 5331 | Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); |
| @@ -5360,13 +5351,10 @@ init_buffer (void) | |||
| 5360 | len++; | 5351 | len++; |
| 5361 | } | 5352 | } |
| 5362 | 5353 | ||
| 5354 | /* At this moment, we still don't know how to decode the directory | ||
| 5355 | name. So, we keep the bytes in unibyte form so that file I/O | ||
| 5356 | routines correctly get the original bytes. */ | ||
| 5363 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); | 5357 | bset_directory (current_buffer, make_unibyte_string (pwd, len)); |
| 5364 | if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) | ||
| 5365 | /* At this moment, we still don't know how to decode the | ||
| 5366 | directory name. So, we keep the bytes in multibyte form so | ||
| 5367 | that ENCODE_FILE correctly gets the original bytes. */ | ||
| 5368 | bset_directory | ||
| 5369 | (current_buffer, string_to_multibyte (BVAR (current_buffer, directory))); | ||
| 5370 | 5358 | ||
| 5371 | /* Add /: to the front of the name | 5359 | /* Add /: to the front of the name |
| 5372 | if it would otherwise be treated as magic. */ | 5360 | if it would otherwise be treated as magic. */ |
| @@ -5421,12 +5409,12 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, | |||
| 5421 | 5409 | ||
| 5422 | if (PER_BUFFER_IDX (offset) == 0) | 5410 | if (PER_BUFFER_IDX (offset) == 0) |
| 5423 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding | 5411 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding |
| 5424 | slot of buffer_local_flags */ | 5412 | slot of buffer_local_flags. */ |
| 5425 | emacs_abort (); | 5413 | emacs_abort (); |
| 5426 | } | 5414 | } |
| 5427 | 5415 | ||
| 5428 | 5416 | ||
| 5429 | /* initialize the buffer routines */ | 5417 | /* Initialize the buffer routines. */ |
| 5430 | void | 5418 | void |
| 5431 | syms_of_buffer (void) | 5419 | syms_of_buffer (void) |
| 5432 | { | 5420 | { |
| @@ -5816,7 +5804,8 @@ its value may not be a list of functions. */); | |||
| 5816 | 5804 | ||
| 5817 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), | 5805 | DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), |
| 5818 | Qstringp, | 5806 | Qstringp, |
| 5819 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); | 5807 | doc: /* Name of file visited in current buffer, or nil if not visiting a file. |
| 5808 | This should be an absolute file name. */); | ||
| 5820 | 5809 | ||
| 5821 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), | 5810 | DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), |
| 5822 | Qstringp, | 5811 | Qstringp, |
| @@ -6146,6 +6135,8 @@ If the value of the variable is t, undo information is not recorded. */); | |||
| 6146 | DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, | 6135 | DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, |
| 6147 | doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. | 6136 | doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. |
| 6148 | 6137 | ||
| 6138 | There is no reason to set this to nil except for debugging purposes. | ||
| 6139 | |||
| 6149 | Normally, the line-motion functions work by scanning the buffer for | 6140 | Normally, the line-motion functions work by scanning the buffer for |
| 6150 | newlines. Columnar operations (like `move-to-column' and | 6141 | newlines. Columnar operations (like `move-to-column' and |
| 6151 | `compute-motion') also work by scanning the buffer, summing character | 6142 | `compute-motion') also work by scanning the buffer, summing character |
| @@ -6195,13 +6186,16 @@ same format as a regular save would use. */); | |||
| 6195 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", | 6186 | DEFVAR_PER_BUFFER ("buffer-invisibility-spec", |
| 6196 | &BVAR (current_buffer, invisibility_spec), Qnil, | 6187 | &BVAR (current_buffer, invisibility_spec), Qnil, |
| 6197 | doc: /* Invisibility spec of this buffer. | 6188 | doc: /* Invisibility spec of this buffer. |
| 6198 | The default is t, which means that text is invisible | 6189 | The default is t, which means that text is invisible if it has a non-nil |
| 6199 | if it has a non-nil `invisible' property. | 6190 | `invisible' property. |
| 6200 | If the value is a list, a text character is invisible if its `invisible' | 6191 | This variable can also be a list. The list can have two kinds of elements: |
| 6201 | property is an element in that list (or is a list with members in common). | 6192 | `ATOM' and `(ATOM . ELLIPSIS)'. A text character is invisible if its |
| 6202 | If an element is a cons cell of the form (PROP . ELLIPSIS), | 6193 | `invisible' property is `ATOM', or has an `invisible' property that is a list |
| 6203 | then characters with property value PROP are invisible, | 6194 | that contains `ATOM'. |
| 6204 | and they have an ellipsis as well if ELLIPSIS is non-nil. */); | 6195 | If the `(ATOM . ELLIPSIS)' form is used, and `ELLIPSIS' is non-nil, an |
| 6196 | ellipsis will be displayed after the invisible characters. | ||
| 6197 | Setting this variable is very fast, much faster than scanning all the text in | ||
| 6198 | the buffer looking for properties to change. */); | ||
| 6205 | 6199 | ||
| 6206 | DEFVAR_PER_BUFFER ("buffer-display-count", | 6200 | DEFVAR_PER_BUFFER ("buffer-display-count", |
| 6207 | &BVAR (current_buffer, display_count), Qintegerp, | 6201 | &BVAR (current_buffer, display_count), Qintegerp, |
| @@ -6295,9 +6289,9 @@ The function `kill-all-local-variables' runs this before doing anything else. * | |||
| 6295 | 6289 | ||
| 6296 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, | 6290 | DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook, |
| 6297 | doc: /* Hook run when the buffer list changes. | 6291 | doc: /* Hook run when the buffer list changes. |
| 6298 | Functions running this hook are `get-buffer-create', | 6292 | Functions running this hook are, `get-buffer-create', |
| 6299 | `make-indirect-buffer', `rename-buffer', `kill-buffer', | 6293 | `make-indirect-buffer', `rename-buffer', `kill-buffer', |
| 6300 | and `bury-buffer-internal'. */); | 6294 | `bury-buffer-internal' and `select-window'. */); |
| 6301 | Vbuffer_list_update_hook = Qnil; | 6295 | Vbuffer_list_update_hook = Qnil; |
| 6302 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); | 6296 | DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook"); |
| 6303 | 6297 | ||
| @@ -6314,6 +6308,7 @@ and `bury-buffer-internal'. */); | |||
| 6314 | defsubr (&Sbuffer_local_value); | 6308 | defsubr (&Sbuffer_local_value); |
| 6315 | defsubr (&Sbuffer_local_variables); | 6309 | defsubr (&Sbuffer_local_variables); |
| 6316 | defsubr (&Sbuffer_modified_p); | 6310 | defsubr (&Sbuffer_modified_p); |
| 6311 | defsubr (&Sforce_mode_line_update); | ||
| 6317 | defsubr (&Sset_buffer_modified_p); | 6312 | defsubr (&Sset_buffer_modified_p); |
| 6318 | defsubr (&Sbuffer_modified_tick); | 6313 | defsubr (&Sbuffer_modified_tick); |
| 6319 | defsubr (&Sbuffer_chars_modified_tick); | 6314 | defsubr (&Sbuffer_chars_modified_tick); |