diff options
| author | John Wiegley | 2016-02-15 14:11:03 -0800 |
|---|---|---|
| committer | John Wiegley | 2016-02-15 14:11:03 -0800 |
| commit | 220613e089ec012ae4ab319637365132ce8dc306 (patch) | |
| tree | 715595598dfd3d80ba7c4306a0ea8f010b320db4 /src | |
| parent | ca03b85b9c1b8908f2651eaf594780c7b5217f61 (diff) | |
| parent | d4b93e11a519cf71beca69654fda158d01a26c3b (diff) | |
| download | emacs-220613e089ec012ae4ab319637365132ce8dc306.tar.gz emacs-220613e089ec012ae4ab319637365132ce8dc306.zip | |
Merge from origin/emacs-25
d4b93e1 Minor fixes in global-auto-composition-mode
02b037b Allow arithmetic operators inside C++ template constructs.
44b16f6 Avoid crashes in semi-malformed 'condition-case'
652e5b4 Allow arithmetic operators inside C++ template constructs.
d9ea795 Fix regression with 'recent-keys' and keyboard macros
903603f Fix wording in a doc-view.el comment
cf79616 ; Spelling fixes
f8bf1b3 CONTRIBUTE cleanups and updates
f3aaca3 Port USE_STACK_LISP_OBJECTS fix to Clang
1834ac7 Port to x86 GCC 4.3.1 and earlier
8482949 Fix point movement under 'scroll-conservatively'
c1313b5 Replace colon in file name (not legal on Windows)
f7af26c Fix a typo in edt.texi
8badf95 Make 'mmap_realloc' on MS-Windows more reliable
856cd94 Grep alias `all' shall not match parent directory
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 50 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/w32heap.c | 51 | ||||
| -rw-r--r-- | src/xdisp.c | 2 |
6 files changed, 66 insertions, 49 deletions
diff --git a/src/emacs.c b/src/emacs.c index 628b9be3131..c512885076c 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1316,8 +1316,8 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1316 | #endif | 1316 | #endif |
| 1317 | 1317 | ||
| 1318 | #ifdef HAVE_NS | 1318 | #ifdef HAVE_NS |
| 1319 | /* Initialise the locale from user defaults. */ | 1319 | /* Initialize the locale from user defaults. */ |
| 1320 | ns_init_locale(); | 1320 | ns_init_locale (); |
| 1321 | #endif | 1321 | #endif |
| 1322 | 1322 | ||
| 1323 | /* Initialize and GC-protect Vinitial_environment and | 1323 | /* Initialize and GC-protect Vinitial_environment and |
diff --git a/src/eval.c b/src/eval.c index 6c912bc4762..26104a58277 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1245,7 +1245,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform, | |||
| 1245 | for (i = 0; i < clausenb; i++) | 1245 | for (i = 0; i < clausenb; i++) |
| 1246 | { | 1246 | { |
| 1247 | Lisp_Object clause = clauses[i]; | 1247 | Lisp_Object clause = clauses[i]; |
| 1248 | Lisp_Object condition = XCAR (clause); | 1248 | Lisp_Object condition = CONSP (clause) ? XCAR (clause) : Qnil; |
| 1249 | if (!CONSP (condition)) | 1249 | if (!CONSP (condition)) |
| 1250 | condition = Fcons (condition, Qnil); | 1250 | condition = Fcons (condition, Qnil); |
| 1251 | struct handler *c = push_handler (condition, CONDITION_CASE); | 1251 | struct handler *c = push_handler (condition, CONDITION_CASE); |
diff --git a/src/keyboard.c b/src/keyboard.c index baca4b56fb5..3431cd8fbd2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3220,33 +3220,37 @@ record_char (Lisp_Object c) | |||
| 3220 | else | 3220 | else |
| 3221 | store_kbd_macro_char (c); | 3221 | store_kbd_macro_char (c); |
| 3222 | 3222 | ||
| 3223 | if (!recorded) | 3223 | /* recent_keys should not include events from keyboard macros. */ |
| 3224 | { | 3224 | if (NILP (Vexecuting_kbd_macro)) |
| 3225 | total_keys += total_keys < NUM_RECENT_KEYS; | ||
| 3226 | ASET (recent_keys, recent_keys_index, c); | ||
| 3227 | if (++recent_keys_index >= NUM_RECENT_KEYS) | ||
| 3228 | recent_keys_index = 0; | ||
| 3229 | } | ||
| 3230 | else if (recorded < 0) | ||
| 3231 | { | 3225 | { |
| 3232 | /* We need to remove one or two events from recent_keys. | 3226 | if (!recorded) |
| 3233 | To do this, we simply put nil at those events and move the | ||
| 3234 | recent_keys_index backwards over those events. Usually, | ||
| 3235 | users will never see those nil events, as they will be | ||
| 3236 | overwritten by the command keys entered to see recent_keys | ||
| 3237 | (e.g. C-h l). */ | ||
| 3238 | |||
| 3239 | while (recorded++ < 0 && total_keys > 0) | ||
| 3240 | { | 3227 | { |
| 3241 | if (total_keys < NUM_RECENT_KEYS) | 3228 | total_keys += total_keys < NUM_RECENT_KEYS; |
| 3242 | total_keys--; | 3229 | ASET (recent_keys, recent_keys_index, c); |
| 3243 | if (--recent_keys_index < 0) | 3230 | if (++recent_keys_index >= NUM_RECENT_KEYS) |
| 3244 | recent_keys_index = NUM_RECENT_KEYS - 1; | 3231 | recent_keys_index = 0; |
| 3245 | ASET (recent_keys, recent_keys_index, Qnil); | 3232 | } |
| 3233 | else if (recorded < 0) | ||
| 3234 | { | ||
| 3235 | /* We need to remove one or two events from recent_keys. | ||
| 3236 | To do this, we simply put nil at those events and move the | ||
| 3237 | recent_keys_index backwards over those events. Usually, | ||
| 3238 | users will never see those nil events, as they will be | ||
| 3239 | overwritten by the command keys entered to see recent_keys | ||
| 3240 | (e.g. C-h l). */ | ||
| 3241 | |||
| 3242 | while (recorded++ < 0 && total_keys > 0) | ||
| 3243 | { | ||
| 3244 | if (total_keys < NUM_RECENT_KEYS) | ||
| 3245 | total_keys--; | ||
| 3246 | if (--recent_keys_index < 0) | ||
| 3247 | recent_keys_index = NUM_RECENT_KEYS - 1; | ||
| 3248 | ASET (recent_keys, recent_keys_index, Qnil); | ||
| 3249 | } | ||
| 3246 | } | 3250 | } |
| 3247 | } | ||
| 3248 | 3251 | ||
| 3249 | num_nonmacro_input_events++; | 3252 | num_nonmacro_input_events++; |
| 3253 | } | ||
| 3250 | 3254 | ||
| 3251 | /* Write c to the dribble file. If c is a lispy event, write | 3255 | /* Write c to the dribble file. If c is a lispy event, write |
| 3252 | the event's symbol to the dribble file, in <brackets>. Bleaugh. | 3256 | the event's symbol to the dribble file, in <brackets>. Bleaugh. |
diff --git a/src/lisp.h b/src/lisp.h index 2221acd5827..8aa286159d7 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4526,6 +4526,12 @@ extern void *record_xmalloc (size_t) ATTRIBUTE_ALLOC_SIZE ((1)); | |||
| 4526 | This feature is experimental and requires careful debugging. | 4526 | This feature is experimental and requires careful debugging. |
| 4527 | Build with CPPFLAGS='-DUSE_STACK_LISP_OBJECTS=0' to disable it. */ | 4527 | Build with CPPFLAGS='-DUSE_STACK_LISP_OBJECTS=0' to disable it. */ |
| 4528 | 4528 | ||
| 4529 | #if (!defined USE_STACK_LISP_OBJECTS \ | ||
| 4530 | && defined __GNUC__ && !defined __clang__ \ | ||
| 4531 | && !(4 < __GNUC__ + (3 < __GNUC_MINOR__ + (2 <= __GNUC_PATCHLEVEL__)))) | ||
| 4532 | /* Work around GCC bugs 36584 and 35271, which were fixed in GCC 4.3.2. */ | ||
| 4533 | # define USE_STACK_LISP_OBJECTS false | ||
| 4534 | #endif | ||
| 4529 | #ifndef USE_STACK_LISP_OBJECTS | 4535 | #ifndef USE_STACK_LISP_OBJECTS |
| 4530 | # define USE_STACK_LISP_OBJECTS true | 4536 | # define USE_STACK_LISP_OBJECTS true |
| 4531 | #endif | 4537 | #endif |
diff --git a/src/w32heap.c b/src/w32heap.c index 00da86a9598..69706a3a57d 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -652,15 +652,19 @@ mmap_alloc (void **var, size_t nbytes) | |||
| 652 | { | 652 | { |
| 653 | /* Now, commit pages for NBYTES. */ | 653 | /* Now, commit pages for NBYTES. */ |
| 654 | *var = VirtualAlloc (p, nbytes, MEM_COMMIT, PAGE_READWRITE); | 654 | *var = VirtualAlloc (p, nbytes, MEM_COMMIT, PAGE_READWRITE); |
| 655 | if (*var == NULL) | ||
| 656 | p = *var; | ||
| 655 | } | 657 | } |
| 656 | 658 | ||
| 657 | if (!p) | 659 | if (!p) |
| 658 | { | 660 | { |
| 659 | if (GetLastError () == ERROR_NOT_ENOUGH_MEMORY) | 661 | DWORD e = GetLastError (); |
| 662 | |||
| 663 | if (e == ERROR_NOT_ENOUGH_MEMORY) | ||
| 660 | errno = ENOMEM; | 664 | errno = ENOMEM; |
| 661 | else | 665 | else |
| 662 | { | 666 | { |
| 663 | DebPrint (("mmap_alloc: error %ld\n", GetLastError ())); | 667 | DebPrint (("mmap_alloc: error %ld\n", e)); |
| 664 | errno = EINVAL; | 668 | errno = EINVAL; |
| 665 | } | 669 | } |
| 666 | } | 670 | } |
| @@ -683,6 +687,7 @@ void * | |||
| 683 | mmap_realloc (void **var, size_t nbytes) | 687 | mmap_realloc (void **var, size_t nbytes) |
| 684 | { | 688 | { |
| 685 | MEMORY_BASIC_INFORMATION memInfo, m2; | 689 | MEMORY_BASIC_INFORMATION memInfo, m2; |
| 690 | void *old_ptr; | ||
| 686 | 691 | ||
| 687 | if (*var == NULL) | 692 | if (*var == NULL) |
| 688 | return mmap_alloc (var, nbytes); | 693 | return mmap_alloc (var, nbytes); |
| @@ -694,12 +699,14 @@ mmap_realloc (void **var, size_t nbytes) | |||
| 694 | return mmap_alloc (var, nbytes); | 699 | return mmap_alloc (var, nbytes); |
| 695 | } | 700 | } |
| 696 | 701 | ||
| 702 | memset (&memInfo, 0, sizeof (memInfo)); | ||
| 697 | if (VirtualQuery (*var, &memInfo, sizeof (memInfo)) == 0) | 703 | if (VirtualQuery (*var, &memInfo, sizeof (memInfo)) == 0) |
| 698 | DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", GetLastError ())); | 704 | DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", GetLastError ())); |
| 699 | 705 | ||
| 700 | /* We need to enlarge the block. */ | 706 | /* We need to enlarge the block. */ |
| 701 | if (memInfo.RegionSize < nbytes) | 707 | if (memInfo.RegionSize < nbytes) |
| 702 | { | 708 | { |
| 709 | memset (&m2, 0, sizeof (m2)); | ||
| 703 | if (VirtualQuery (*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0) | 710 | if (VirtualQuery (*var + memInfo.RegionSize, &m2, sizeof(m2)) == 0) |
| 704 | DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", | 711 | DebPrint (("mmap_realloc: VirtualQuery error = %ld\n", |
| 705 | GetLastError ())); | 712 | GetLastError ())); |
| @@ -715,31 +722,31 @@ mmap_realloc (void **var, size_t nbytes) | |||
| 715 | MEM_COMMIT, PAGE_READWRITE); | 722 | MEM_COMMIT, PAGE_READWRITE); |
| 716 | if (!p /* && GetLastError() != ERROR_NOT_ENOUGH_MEMORY */) | 723 | if (!p /* && GetLastError() != ERROR_NOT_ENOUGH_MEMORY */) |
| 717 | { | 724 | { |
| 718 | DebPrint (("realloc enlarge: VirtualAlloc error %ld\n", | 725 | DebPrint (("realloc enlarge: VirtualAlloc (%p + %I64x, %I64x) error %ld\n", |
| 726 | *var, (uint64_t)memInfo.RegionSize, | ||
| 727 | (uint64_t)(nbytes - memInfo.RegionSize), | ||
| 719 | GetLastError ())); | 728 | GetLastError ())); |
| 720 | errno = ENOMEM; | 729 | DebPrint (("next region: %p %p %I64x %x\n", m2.BaseAddress, |
| 730 | m2.AllocationBase, m2.RegionSize, m2.AllocationProtect)); | ||
| 721 | } | 731 | } |
| 732 | else | ||
| 733 | return *var; | ||
| 734 | } | ||
| 735 | /* Else we must actually enlarge the block by allocating a new | ||
| 736 | one and copying previous contents from the old to the new one. */ | ||
| 737 | old_ptr = *var; | ||
| 738 | |||
| 739 | if (mmap_alloc (var, nbytes)) | ||
| 740 | { | ||
| 741 | CopyMemory (*var, old_ptr, memInfo.RegionSize); | ||
| 742 | mmap_free (&old_ptr); | ||
| 722 | return *var; | 743 | return *var; |
| 723 | } | 744 | } |
| 724 | else | 745 | else |
| 725 | { | 746 | { |
| 726 | /* Else we must actually enlarge the block by allocating a | 747 | /* We failed to reallocate the buffer. */ |
| 727 | new one and copying previous contents from the old to the | 748 | *var = old_ptr; |
| 728 | new one. */ | 749 | return NULL; |
| 729 | void *old_ptr = *var; | ||
| 730 | |||
| 731 | if (mmap_alloc (var, nbytes)) | ||
| 732 | { | ||
| 733 | CopyMemory (*var, old_ptr, memInfo.RegionSize); | ||
| 734 | mmap_free (&old_ptr); | ||
| 735 | return *var; | ||
| 736 | } | ||
| 737 | else | ||
| 738 | { | ||
| 739 | /* We failed to enlarge the buffer. */ | ||
| 740 | *var = old_ptr; | ||
| 741 | return NULL; | ||
| 742 | } | ||
| 743 | } | 750 | } |
| 744 | } | 751 | } |
| 745 | 752 | ||
| @@ -751,7 +758,7 @@ mmap_realloc (void **var, size_t nbytes) | |||
| 751 | { | 758 | { |
| 752 | /* Let's give some memory back to the system and release | 759 | /* Let's give some memory back to the system and release |
| 753 | some pages. */ | 760 | some pages. */ |
| 754 | void *old_ptr = *var; | 761 | old_ptr = *var; |
| 755 | 762 | ||
| 756 | if (mmap_alloc (var, nbytes)) | 763 | if (mmap_alloc (var, nbytes)) |
| 757 | { | 764 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 840699d00fb..fed58799eaa 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -16920,7 +16920,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 16920 | if (scroll_conservatively > SCROLL_LIMIT) | 16920 | if (scroll_conservatively > SCROLL_LIMIT) |
| 16921 | { | 16921 | { |
| 16922 | int window_total_lines | 16922 | int window_total_lines |
| 16923 | = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) * frame_line_height; | 16923 | = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; |
| 16924 | int margin = | 16924 | int margin = |
| 16925 | scroll_margin > 0 | 16925 | scroll_margin > 0 |
| 16926 | ? min (scroll_margin, window_total_lines / 4) | 16926 | ? min (scroll_margin, window_total_lines / 4) |