From 33d436eefa16dfd4cf53bd53fdd764b2896c649c Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 24 Mar 2023 00:17:10 -0700 Subject: Fix treesit_ensure_parsed (bug#62333) * src/treesit.c (treesit_ensure_parsed): Check for need_reparse after treesit_sync_visible_region runs, because as the comment says, treesit_sync_visible_region might modify need_reparse. --- src/treesit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/treesit.c b/src/treesit.c index 5a4fe3e8803..1bb52888f4b 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1016,11 +1016,6 @@ treesit_call_after_change_functions (TSTree *old_tree, TSTree *new_tree, static void treesit_ensure_parsed (Lisp_Object parser) { - /* Make sure this comes before everything else, see comment - (ref:notifier-inside-ensure-parsed) for more detail. */ - if (!XTS_PARSER (parser)->need_reparse) - return; - struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); /* Before we parse, catch up with the narrowing situation. */ @@ -1029,6 +1024,11 @@ treesit_ensure_parsed (Lisp_Object parser) because it might set the flag to true. */ treesit_sync_visible_region (parser); + /* Make sure this comes before everything else, see comment + (ref:notifier-inside-ensure-parsed) for more detail. */ + if (!XTS_PARSER (parser)->need_reparse) + return; + TSParser *treesit_parser = XTS_PARSER (parser)->parser; TSTree *tree = XTS_PARSER (parser)->tree; TSInput input = XTS_PARSER (parser)->input; -- cgit v1.2.3 From accb3871668201a1d7b9c54713b94b814c879271 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 24 Mar 2023 14:10:30 +0300 Subject: Fix system time sampling on MS-Windows * src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally call tzset to make sure we pick up all the changes of time zone, working around the MS CRT caching. --- src/timefns.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/timefns.c b/src/timefns.c index b3132e7bc34..87971cf4563 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -180,6 +180,15 @@ static timezone_t const utc_tz = 0; static struct tm * emacs_localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) { +#ifdef WINDOWSNT + /* The Windows CRT functions are "optimized for speed", so they don't + check for timezone and DST changes if they were last called less + than 1 minute ago (see http://support.microsoft.com/kb/821231). + So all Emacs features that repeatedly call time functions (e.g., + display-time) are in real danger of missing timezone and DST + changes. Calling tzset before each localtime call fixes that. */ + tzset (); +#endif tm = localtime_rz (tz, t, tm); if (!tm && errno == ENOMEM) memory_full (SIZE_MAX); -- cgit v1.2.3