diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/buffer.c b/src/buffer.c index b020edb9962..356a308fce6 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -550,11 +550,11 @@ even if it is dead. The return value is never nil. */) | |||
| 550 | b->indirections = 0; | 550 | b->indirections = 0; |
| 551 | 551 | ||
| 552 | BUF_GAP_SIZE (b) = 20; | 552 | BUF_GAP_SIZE (b) = 20; |
| 553 | BLOCK_INPUT; | 553 | block_input (); |
| 554 | /* We allocate extra 1-byte at the tail and keep it always '\0' for | 554 | /* We allocate extra 1-byte at the tail and keep it always '\0' for |
| 555 | anchoring a search. */ | 555 | anchoring a search. */ |
| 556 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); | 556 | alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); |
| 557 | UNBLOCK_INPUT; | 557 | unblock_input (); |
| 558 | if (! BUF_BEG_ADDR (b)) | 558 | if (! BUF_BEG_ADDR (b)) |
| 559 | buffer_memory_full (BUF_GAP_SIZE (b) + 1); | 559 | buffer_memory_full (BUF_GAP_SIZE (b) + 1); |
| 560 | 560 | ||
| @@ -1341,9 +1341,13 @@ A non-nil FLAG means mark the buffer modified. */) | |||
| 1341 | /* If buffer becoming modified, lock the file. | 1341 | /* If buffer becoming modified, lock the file. |
| 1342 | If buffer becoming unmodified, unlock the file. */ | 1342 | If buffer becoming unmodified, unlock the file. */ |
| 1343 | 1343 | ||
| 1344 | fn = BVAR (current_buffer, file_truename); | 1344 | struct buffer *b = current_buffer->base_buffer |
| 1345 | ? current_buffer->base_buffer | ||
| 1346 | : current_buffer; | ||
| 1347 | |||
| 1348 | fn = BVAR (b, file_truename); | ||
| 1345 | /* Test buffer-file-name so that binding it to nil is effective. */ | 1349 | /* Test buffer-file-name so that binding it to nil is effective. */ |
| 1346 | if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename))) | 1350 | if (!NILP (fn) && ! NILP (BVAR (b, filename))) |
| 1347 | { | 1351 | { |
| 1348 | bool already = SAVE_MODIFF < MODIFF; | 1352 | bool already = SAVE_MODIFF < MODIFF; |
| 1349 | if (!already && !NILP (flag)) | 1353 | if (!already && !NILP (flag)) |
| @@ -1919,7 +1923,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1919 | 1923 | ||
| 1920 | bset_name (b, Qnil); | 1924 | bset_name (b, Qnil); |
| 1921 | 1925 | ||
| 1922 | BLOCK_INPUT; | 1926 | block_input (); |
| 1923 | if (b->base_buffer) | 1927 | if (b->base_buffer) |
| 1924 | { | 1928 | { |
| 1925 | /* Notify our base buffer that we don't share the text anymore. */ | 1929 | /* Notify our base buffer that we don't share the text anymore. */ |
| @@ -1942,7 +1946,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1942 | b->width_run_cache = 0; | 1946 | b->width_run_cache = 0; |
| 1943 | } | 1947 | } |
| 1944 | bset_width_table (b, Qnil); | 1948 | bset_width_table (b, Qnil); |
| 1945 | UNBLOCK_INPUT; | 1949 | unblock_input (); |
| 1946 | bset_undo_list (b, Qnil); | 1950 | bset_undo_list (b, Qnil); |
| 1947 | 1951 | ||
| 1948 | /* Run buffer-list-update-hook. */ | 1952 | /* Run buffer-list-update-hook. */ |
| @@ -5028,7 +5032,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 5028 | { | 5032 | { |
| 5029 | void *p; | 5033 | void *p; |
| 5030 | 5034 | ||
| 5031 | BLOCK_INPUT; | 5035 | block_input (); |
| 5032 | #if defined USE_MMAP_FOR_BUFFERS | 5036 | #if defined USE_MMAP_FOR_BUFFERS |
| 5033 | p = mmap_alloc ((void **) &b->text->beg, nbytes); | 5037 | p = mmap_alloc ((void **) &b->text->beg, nbytes); |
| 5034 | #elif defined REL_ALLOC | 5038 | #elif defined REL_ALLOC |
| @@ -5039,12 +5043,12 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 5039 | 5043 | ||
| 5040 | if (p == NULL) | 5044 | if (p == NULL) |
| 5041 | { | 5045 | { |
| 5042 | UNBLOCK_INPUT; | 5046 | unblock_input (); |
| 5043 | memory_full (nbytes); | 5047 | memory_full (nbytes); |
| 5044 | } | 5048 | } |
| 5045 | 5049 | ||
| 5046 | b->text->beg = (unsigned char *) p; | 5050 | b->text->beg = (unsigned char *) p; |
| 5047 | UNBLOCK_INPUT; | 5051 | unblock_input (); |
| 5048 | } | 5052 | } |
| 5049 | 5053 | ||
| 5050 | /* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means | 5054 | /* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means |
| @@ -5056,7 +5060,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5056 | void *p; | 5060 | void *p; |
| 5057 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 | 5061 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 |
| 5058 | + delta); | 5062 | + delta); |
| 5059 | BLOCK_INPUT; | 5063 | block_input (); |
| 5060 | #if defined USE_MMAP_FOR_BUFFERS | 5064 | #if defined USE_MMAP_FOR_BUFFERS |
| 5061 | p = mmap_realloc ((void **) &b->text->beg, nbytes); | 5065 | p = mmap_realloc ((void **) &b->text->beg, nbytes); |
| 5062 | #elif defined REL_ALLOC | 5066 | #elif defined REL_ALLOC |
| @@ -5067,12 +5071,12 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5067 | 5071 | ||
| 5068 | if (p == NULL) | 5072 | if (p == NULL) |
| 5069 | { | 5073 | { |
| 5070 | UNBLOCK_INPUT; | 5074 | unblock_input (); |
| 5071 | memory_full (nbytes); | 5075 | memory_full (nbytes); |
| 5072 | } | 5076 | } |
| 5073 | 5077 | ||
| 5074 | BUF_BEG_ADDR (b) = (unsigned char *) p; | 5078 | BUF_BEG_ADDR (b) = (unsigned char *) p; |
| 5075 | UNBLOCK_INPUT; | 5079 | unblock_input (); |
| 5076 | } | 5080 | } |
| 5077 | 5081 | ||
| 5078 | 5082 | ||
| @@ -5081,7 +5085,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) | |||
| 5081 | static void | 5085 | static void |
| 5082 | free_buffer_text (struct buffer *b) | 5086 | free_buffer_text (struct buffer *b) |
| 5083 | { | 5087 | { |
| 5084 | BLOCK_INPUT; | 5088 | block_input (); |
| 5085 | 5089 | ||
| 5086 | #if defined USE_MMAP_FOR_BUFFERS | 5090 | #if defined USE_MMAP_FOR_BUFFERS |
| 5087 | mmap_free ((void **) &b->text->beg); | 5091 | mmap_free ((void **) &b->text->beg); |
| @@ -5092,7 +5096,7 @@ free_buffer_text (struct buffer *b) | |||
| 5092 | #endif | 5096 | #endif |
| 5093 | 5097 | ||
| 5094 | BUF_BEG_ADDR (b) = NULL; | 5098 | BUF_BEG_ADDR (b) = NULL; |
| 5095 | UNBLOCK_INPUT; | 5099 | unblock_input (); |
| 5096 | } | 5100 | } |
| 5097 | 5101 | ||
| 5098 | 5102 | ||