From d1e8ce8bb6fadf3d034ae437ff1c1b81be7d5209 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 13 Feb 2020 19:00:36 +0000 Subject: Make after-change-functions called from call-process get the correct BEG This fixes bug #39585. * src/callproc.c (call_process): Supply the correct CHARPOS to signal_after_change (twice). --- src/callproc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/callproc.c b/src/callproc.c index 07dcc4c3ae4..8883415f3f5 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -811,7 +811,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) { insert_1_both (buf, nread, nread, 0, 0, 0); - signal_after_change (PT, 0, nread); + signal_after_change (PT - nread, 0, nread); } else { /* We have to decode the input. */ @@ -854,7 +854,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, TEMP_SET_PT_BOTH (PT + process_coding.produced_char, PT_BYTE + process_coding.produced); - signal_after_change (PT, 0, process_coding.produced_char); + signal_after_change (PT - process_coding.produced_char, + 0, process_coding.produced_char); carryover = process_coding.carryover_bytes; if (carryover > 0) memcpy (buf, process_coding.carryover, -- cgit v1.2.1 From 75a9eee8b80099670cd78273d0df69115422daa4 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Thu, 13 Feb 2020 22:43:03 +0100 Subject: ; * src/editfns.c (Fbuffer_size): Tiny clarification. --- src/editfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/editfns.c b/src/editfns.c index 05ad3925813..ddf190b1752 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -863,7 +863,7 @@ instead. This does not take narrowing into account; to count the number of characters in the accessible portion of the current buffer, use `(- (point-max) (point-min))', and to count the number of characters -in some other BUFFER, use +in the accessible portion of some other BUFFER, use `(with-current-buffer BUFFER (- (point-max) (point-min)))'. */) (Lisp_Object buffer) { -- cgit v1.2.1 From 888ffd960c06d56a409a7ff15b1d930d25c56089 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 16 Feb 2020 09:50:26 +0900 Subject: Fix unexec failure on macOS 10.15.4 * src/unexmacosx.c (unexec_regions_merge): Align region start addresses to page boundaries and then merge regions. --- src/unexmacosx.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 8d132417e89..59cbe3c18b9 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -503,22 +503,34 @@ unexec_regions_sort_compare (const void *a, const void *b) static void unexec_regions_merge (void) { - int i, n; - unexec_region_info r; - vm_size_t padsize; - qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), &unexec_regions_sort_compare); - n = 0; - r = unexec_regions[0]; - padsize = r.range.address & (pagesize - 1); - if (padsize) + + /* Align each region start address to a page boundary. */ + for (unexec_region_info *cur = unexec_regions; + cur < unexec_regions + num_unexec_regions; cur++) { - r.range.address -= padsize; - r.range.size += padsize; - r.filesize += padsize; + vm_size_t padsize = cur->range.address & (pagesize - 1); + if (padsize) + { + cur->range.address -= padsize; + cur->range.size += padsize; + cur->filesize += padsize; + + unexec_region_info *prev = cur == unexec_regions ? NULL : cur - 1; + if (prev + && prev->range.address + prev->range.size > cur->range.address) + { + prev->range.size = cur->range.address - prev->range.address; + if (prev->filesize > prev->range.size) + prev->filesize = prev->range.size; + } + } } - for (i = 1; i < num_unexec_regions; i++) + + int n = 0; + unexec_region_info r = unexec_regions[0]; + for (int i = 1; i < num_unexec_regions; i++) { if (r.range.address + r.range.size == unexec_regions[i].range.address && r.range.size - r.filesize < 2 * pagesize) @@ -530,17 +542,6 @@ unexec_regions_merge (void) { unexec_regions[n++] = r; r = unexec_regions[i]; - padsize = r.range.address & (pagesize - 1); - if (padsize) - { - if ((unexec_regions[n-1].range.address - + unexec_regions[n-1].range.size) == r.range.address) - unexec_regions[n-1].range.size -= padsize; - - r.range.address -= padsize; - r.range.size += padsize; - r.filesize += padsize; - } } } unexec_regions[n++] = r; -- cgit v1.2.1