commit 03d16d6d4c0a3403f560b7d75c3f8f0bc75c528c (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Thu Apr 21 13:52:50 2022 +0800 Don't leave xm drag initiator info around * src/xterm.c (x_cleanup_drag_and_drop) (x_begin_drag_and_drop): Don't confuse GTK+ 2.x by leaving drag initiator info around after DND completes. diff --git a/src/xterm.c b/src/xterm.c index 0243b3cf96..69e9302973 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3707,6 +3707,11 @@ x_dnd_cleanup_drag_and_drop (void *frame) XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, XkbStateNotifyMask, 0); #endif + + /* Delete the Motif drag initiator info if it was set up. */ + if (x_dnd_motif_setup_p) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); unblock_input (); x_dnd_frame = NULL; @@ -9891,6 +9896,10 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, XkbStateNotifyMask, 0); #endif + /* Delete the Motif drag initiator info if it was set up. */ + if (x_dnd_motif_setup_p) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); quit (); } } @@ -9913,6 +9922,10 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, XkbStateNotifyMask, 0); #endif + /* Delete the Motif drag initiator info if it was set up. */ + if (x_dnd_motif_setup_p) + XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_XdndSelection); unblock_input (); if (x_dnd_return_frame == 3 commit 75052a0fa62031bcf956263e4ad19a3b19c48eb9 Merge: 26e448ae2b dbb2dd6939 Author: Stefan Kangas Date: Thu Apr 21 06:30:28 2022 +0200 Merge from origin/emacs-28 dbb2dd6939 ; Fix wording of "File Notifications" in the ELisp manual commit 26e448ae2b60bd34eebceca6dbd181ca1722be5b Merge: 8c282d68bd e6c2a2497d Author: Stefan Kangas Date: Thu Apr 21 06:30:28 2022 +0200 ; Merge from origin/emacs-28 The following commits were skipped: e6c2a2497d Update from gnulib 91d4898d5c Revert prompting changes in viper-cmd commit 8c282d68bde6d8ef348da5ca30f697f6a47e5b81 Author: Po Lu Date: Thu Apr 21 03:09:22 2022 +0000 Use a cache on Haiku to avoid constantly reading fonts during font lookup * src/haiku_font_support.cc (struct font_object_cache_bucket): New struct. (language_code_points): Make `int'. (hash_string): New function. (cache_font_object_data, lookup_font_object_data) (font_object_has_chars): New functions. (font_check_wanted_chars, font_check_one_of) (font_check_language): Lookup in cached font object instead. (be_init_font_data, be_evict_font_cache): New functions. * src/haiku_support.h (struct haiku_font_pattern): Make `uint32_t's ints instead. * src/haikufont.c (haikufont_apply_registry, syms_of_haikufont): Adjust for those changes. * src/haikuterm.c (haiku_frame_up_to_date): Clear font lookup cache every 50 updates. diff --git a/src/haiku_font_support.cc b/src/haiku_font_support.cc index 6bb934af5f..8da2437d66 100644 --- a/src/haiku_font_support.cc +++ b/src/haiku_font_support.cc @@ -27,15 +27,111 @@ along with GNU Emacs. If not, see . */ #include "haiku_support.h" +/* Cache used during font lookup. It contains an opened font object + we can look inside, and some previously determined information. */ +struct font_object_cache_bucket +{ + struct font_object_cache_bucket *next; + unsigned int hash; + + BFont *font_object; +}; + +static struct font_object_cache_bucket *font_object_cache[2048]; + /* Haiku doesn't expose font language data in BFont objects. Thus, we select a few representative characters for each supported `:lang' (currently Chinese, Korean and Japanese,) and test for those instead. */ -static uint32_t language_code_points[MAX_LANGUAGE][4] = - {{20154, 20754, 22996, 0}, /* Chinese. */ - {51312, 49440, 44544, 0}, /* Korean. */ - {26085, 26412, 12371, 0}, /* Japanese. */}; +static int language_code_points[MAX_LANGUAGE][3] = + {{20154, 20754, 22996}, /* Chinese. */ + {51312, 49440, 44544}, /* Korean. */ + {26085, 26412, 12371}, /* Japanese. */}; + +static unsigned int +hash_string (const char *name_or_style) +{ + unsigned int i; + + i = 3323198485ul; + for (; *name_or_style; ++name_or_style) + { + i ^= *name_or_style; + i *= 0x5bd1e995; + i ^= i >> 15; + } + return i; +} + +static struct font_object_cache_bucket * +cache_font_object_data (const char *family, const char *style, + BFont *font_object) +{ + uint32_t hash; + struct font_object_cache_bucket *bucket, *next; + + hash = hash_string (family) ^ hash_string (style); + bucket = font_object_cache[hash % 2048]; + + for (next = bucket; next; next = next->next) + { + if (next->hash == hash) + { + delete next->font_object; + next->font_object = font_object; + + return next; + } + } + + next = new struct font_object_cache_bucket; + next->font_object = font_object; + next->hash = hash; + next->next = bucket; + font_object_cache[hash % 2048] = next; + return next; +} + +static struct font_object_cache_bucket * +lookup_font_object_data (const char *family, const char *style) +{ + uint32_t hash; + struct font_object_cache_bucket *bucket, *next; + + hash = hash_string (family) ^ hash_string (style); + bucket = font_object_cache[hash % 2048]; + + for (next = bucket; next; next = next->next) + { + if (next->hash == hash) + return next; + } + + return NULL; +} + +static bool +font_object_has_chars (struct font_object_cache_bucket *cached, + int *chars, int nchars, bool just_one_of) +{ + int i; + + for (i = 0; i < nchars; ++i) + { + if (just_one_of + && cached->font_object->IncludesBlock (chars[i], + chars[i])) + return true; + + if (!just_one_of + && !cached->font_object->IncludesBlock (chars[i], + chars[i])) + return false; + } + + return !just_one_of; +} static void estimate_font_ascii (BFont *font, int *max_width, @@ -299,54 +395,86 @@ static bool font_check_wanted_chars (struct haiku_font_pattern *pattern, font_family family, char *style) { - BFont ft; + BFont *ft; + static struct font_object_cache_bucket *cached; + unicode_block wanted_block; - if (ft.SetFamilyAndStyle (family, style) != B_OK) - return false; + cached = lookup_font_object_data (family, style); + if (cached) + ft = cached->font_object; + else + { + ft = new BFont; - for (int i = 0; i < pattern->want_chars_len; ++i) - if (!ft.IncludesBlock (pattern->wanted_chars[i], - pattern->wanted_chars[i])) - return false; + if (ft->SetFamilyAndStyle (family, style) != B_OK) + { + delete ft; + return false; + } - return true; + cached = cache_font_object_data (family, style, ft); + } + + return font_object_has_chars (cached, pattern->wanted_chars, + pattern->want_chars_len, false); } static bool font_check_one_of (struct haiku_font_pattern *pattern, font_family family, char *style) { - BFont ft; + BFont *ft; + static struct font_object_cache_bucket *cached; + unicode_block wanted_block; - if (ft.SetFamilyAndStyle (family, style) != B_OK) - return false; + cached = lookup_font_object_data (family, style); + if (cached) + ft = cached->font_object; + else + { + ft = new BFont; + + if (ft->SetFamilyAndStyle (family, style) != B_OK) + { + delete ft; + return false; + } - for (int i = 0; i < pattern->need_one_of_len; ++i) - if (ft.IncludesBlock (pattern->need_one_of[i], - pattern->need_one_of[i])) - return true; + cached = cache_font_object_data (family, style, ft); + } - return false; + return font_object_has_chars (cached, pattern->need_one_of, + pattern->need_one_of_len, true); } static bool font_check_language (struct haiku_font_pattern *pattern, font_family family, char *style) { - BFont ft; + BFont *ft; + static struct font_object_cache_bucket *cached; - if (ft.SetFamilyAndStyle (family, style) != B_OK) - return false; + cached = lookup_font_object_data (family, style); + if (cached) + ft = cached->font_object; + else + { + ft = new BFont; + + if (ft->SetFamilyAndStyle (family, style) != B_OK) + { + delete ft; + return false; + } + + cached = cache_font_object_data (family, style, ft); + } if (pattern->language == MAX_LANGUAGE) return false; - for (uint32_t *ch = (uint32_t *) - &language_code_points[pattern->language]; *ch; ch++) - if (!ft.IncludesBlock (*ch, *ch)) - return false; - - return true; + return font_object_has_chars (cached, language_code_points[pattern->language], + 3, false); } static bool @@ -645,3 +773,33 @@ be_list_font_families (size_t *length) return array; } + +void +be_init_font_data (void) +{ + memset (&font_object_cache, 0, sizeof font_object_cache); +} + +/* Free the font object cache. This is called every 50 updates of a + frame. */ +void +be_evict_font_cache (void) +{ + struct font_object_cache_bucket *bucket, *last; + int i; + + for (i = 0; i < 2048; ++i) + { + bucket = font_object_cache[i]; + + while (bucket) + { + last = bucket; + bucket = bucket->next; + delete last->font_object; + delete last; + } + + font_object_cache[i] = NULL; + } +} diff --git a/src/haiku_support.h b/src/haiku_support.h index dfcf83bf3b..3f071f2b09 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -304,8 +304,8 @@ struct haiku_font_pattern enum haiku_font_slant slant; enum haiku_font_width width; enum haiku_font_language language; - uint32_t *wanted_chars; - uint32_t *need_one_of; + int *wanted_chars; + int *need_one_of; int oblique_seen_p; }; @@ -633,6 +633,8 @@ extern void BMenu_add_title (void *, const char *); extern int be_plain_font_height (void); extern int be_string_width_with_plain_font (const char *); +extern void be_init_font_data (void); +extern void be_evict_font_cache (void); extern int be_get_display_screens (void); extern bool be_use_subpixel_antialiasing (void); extern const char *be_find_setting (const char *); diff --git a/src/haikufont.c b/src/haikufont.c index 960ca466bc..7dd23fba7a 100644 --- a/src/haikufont.c +++ b/src/haikufont.c @@ -137,7 +137,7 @@ haikufont_apply_registry (struct haiku_font_pattern *pattern, for (l = 0; uniquifier[l]; ++l); - uint32_t *a = xmalloc (l * sizeof *a); + int *a = xmalloc (l * sizeof *a); for (l = 0; uniquifier[l]; ++l) a[l] = uniquifier[l]; @@ -1111,4 +1111,6 @@ syms_of_haikufont (void) font_cache = list (Qnil); staticpro (&font_cache); + + be_init_font_data (); } diff --git a/src/haikuterm.c b/src/haikuterm.c index 64c657fef5..213641d607 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -46,6 +46,10 @@ along with GNU Emacs. If not, see . */ struct haiku_display_info *x_display_list = NULL; extern frame_parm_handler haiku_frame_parm_handlers[]; +/* This is used to determine when to evict the font lookup cache, + which we do every 50 updates. */ +static int up_to_date_count; + static void **fringe_bmps; static int max_fringe_bmp = 0; @@ -231,6 +235,13 @@ haiku_frame_up_to_date (struct frame *f) FRAME_MOUSE_UPDATE (f); if (FRAME_DIRTY_P (f) && !buffer_flipping_blocked_p ()) haiku_flip_buffers (f); + + up_to_date_count++; + if (up_to_date_count == 50) + { + be_evict_font_cache (); + up_to_date_count = 0; + } unblock_input (); } commit ab530ddeb57084993fbf5f5857f3f8f3b4ec606c Author: Po Lu Date: Thu Apr 21 00:37:07 2022 +0000 Make some frame params work on Haiku tooltip frames * src/haiku_support.cc (RecomputeFeel): Handle tooltips. (BWindow_set_tooltip_decoration): Use RecomputeFeel instead of setting window feel by hand. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 3dc9eb88b7..75c68f5541 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -500,6 +500,7 @@ class EmacsWindow : public BWindow int window_id; bool *menus_begun = NULL; enum haiku_z_group z_group; + bool tooltip_p = false; EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS) @@ -535,7 +536,7 @@ class EmacsWindow : public BWindow void RecomputeFeel (void) { - if (override_redirect_p) + if (override_redirect_p || tooltip_p) SetFeel (kMenuWindowFeel); else if (parent) SetFeel (B_FLOATING_SUBSET_WINDOW_FEEL); @@ -3037,11 +3038,12 @@ BWindow_change_decoration (void *window, int decorate_p) void BWindow_set_tooltip_decoration (void *window) { - BWindow *w = (BWindow *) window; + EmacsWindow *w = (EmacsWindow *) window; if (!w->LockLooper ()) gui_abort ("Failed to lock window while setting ttip decoration"); + w->tooltip_p = true; + w->RecomputeFeel (); w->SetLook (B_BORDERED_WINDOW_LOOK); - w->SetFeel (kMenuWindowFeel); w->SetFlags (B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FRONT commit f98c3f4426fecf794f47f27aebe1f3b854fb1bfd Author: Paul Eggert Date: Wed Apr 20 12:03:19 2022 -0700 More encode-time pitfall doc fixes * doc/lispref/os.texi (Time Conversion): Improve discussion of encode-time pitfalls based on comments by Max Nikulin (Bug#54764#63). diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index cabae08970..4138dab09f 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1670,7 +1670,7 @@ any other extra arguments are ignored, so that @code{(apply convention, @var{dst} is @minus{}1 and @var{zone} defaults to the current time zone rule (@pxref{Time Zone Rules}). When modernizing an obsolescent caller, ensure that the more-modern -list equivalent contains 9 elements with a a @code{dst} element that +list equivalent contains 9 elements with a @code{dst} element that is @minus{}1, not @code{nil}. Year numbers less than 100 are not treated specially. If you want them @@ -1695,22 +1695,28 @@ Take care when doing so, as it is common for this to fail in some cases. For example: @lisp -;; Try to compute the time four years from now. +;; Try to compute the time one month from now. ;; Watch out; this might not work as expected. (let ((time (decode-time))) - (setf (decoded-time-year time) - (+ (decoded-time-year time) 4)) + (setf (decoded-time-month time) + (+ (decoded-time-month time) 1)) time) @end lisp @noindent Unfortunately, this code might not work as expected if the resulting -time is invalid due to daylight saving transitions, time zone changes, +time is invalid due to month length differences, +daylight saving transitions, time zone changes, or missing leap days or leap seconds. For example, if executed on -February 29, 2096 this code yields a nonexistent date because 2100 is -not a leap year. To avoid some (though not all) of the problem, you +January 30 this code yields a nonexistent date February 30, +which @code{encode-time} would adjust to early March. +Similarly, adding four years to February 29, 2096 would yield the +nonexistent date February 29, 2100; and adding one hour to 01:30 on +March 13, 2022 in New York would yield a timestamp 02:30 that does not +exist because clocks sprang forward from 02:00 to 03:00 that day. +To avoid some (though not all) of the problem, you can base calculations on the middle of the affected unit, e.g., start -at July 1 when adding years. Alternatively, you can use the +at the 15th of the month when adding months. Alternatively, you can use the @file{calendar} and @file{time-date} libraries. @end defun commit dbb2dd6939867abe50c0894be9ba4e09c96f6759 Author: Eli Zaretskii Date: Wed Apr 20 20:00:15 2022 +0300 ; Fix wording of "File Notifications" in the ELisp manual * doc/lispref/os.texi (File Notifications): Fix typos, punctuation, and wording. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 96cfff3f89..e7ce40b1f2 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -3088,21 +3088,21 @@ This function removes the tray notification given by its unique @cindex watch, for filesystem events Several operating systems support watching of filesystems for changes -of files. If configured properly, Emacs links a respective library -like @file{inotify}, @file{kqueue}, @file{gfilenotify}, or -@file{w32notify} statically. These libraries enable watching of -filesystems on the local machine. +to files or their attributes. If configured properly, Emacs links a +respective library like @file{inotify}, @file{kqueue}, +@file{gfilenotify}, or @file{w32notify} statically. These libraries +enable watching of filesystems on the local machine. It is also possible to watch filesystems on remote machines, -@pxref{Remote Files,, Remote Files, emacs, The GNU Emacs Manual} +@pxref{Remote Files,, Remote Files, emacs, The GNU Emacs Manual}. This does not depend on one of the libraries linked to Emacs. -Since all these libraries emit different events on notified file -changes, there is the Emacs library @code{filenotify} which provides a -unified interface. Lisp programs that want to receive file -notifications should always use this library in preference to the -native ones. - +Since all these libraries emit different events upon notified file +changes, Emacs provides a special library @code{filenotify} which +presents a unified interface to applications. Lisp programs that want +to receive file notifications should always use this library in +preference to the native ones. This section documents the +@code{filenotify} library functions and variables. @defun file-notify-add-watch file flags callback Add a watch for filesystem events pertaining to @var{file}. This @@ -3110,31 +3110,33 @@ arranges for filesystem events pertaining to @var{file} to be reported to Emacs. The returned value is a descriptor for the added watch. Its type -depends on the underlying library, it cannot be assumed to be an -integer as in the example below. It should be used for comparison by -@code{equal} only. +depends on the underlying library, and in general cannot be assumed to +be an integer as in the example below. It should be used for +comparison by @code{equal} only. If the @var{file} cannot be watched for some reason, this function signals a @code{file-notify-error} error. Sometimes, mounted filesystems cannot be watched for file changes. -This is not detected by this function, a non-@code{nil} return value -does not guarantee that changes on @var{file} will be notified. +This is not detected by this function, and so a non-@code{nil} return +value does not guarantee that changes on @var{file} will be actually +notified. @var{flags} is a list of conditions to set what will be watched for. It can include the following symbols: @table @code @item change -watch for file changes +watch for changes in file's contents @item attribute-change -watch for file attribute changes, like permissions or modification +watch for changes in file attributes, like permissions or modification time @end table If @var{file} is a directory, @code{change} watches for file creation -or deletion in that directory. Some of the file notification backends -report also file changes. This does not work recursively. +and deletion in that directory. Some of the native file notification +libraries also report file changes in that case. This does not work +recursively. When any event happens, Emacs will call the @var{callback} function passing it a single argument @var{event}, which is of the form @@ -3160,19 +3162,20 @@ reports attribute changes as well @item attribute-changed a @var{file} attribute was changed @item stopped -watching @var{file} has been stopped +watching @var{file} has stopped @end table Note that the @file{w32notify} library does not report @code{attribute-changed} events. When some file's attribute, like permissions or modification time, has changed, this library reports a @code{changed} event. Likewise, the @file{kqueue} library does not -report reliably file attribute changes when watching a directory. +reliably report file attribute changes when watching a directory. -The @code{stopped} event reports, that watching the file has been -stopped. This could be because @code{file-notify-rm-watch} was called -(see below), or because the file being watched was deleted, or due to -another error reported from the underlying library. +The @code{stopped} event means that watching the file has been +discontinued. This could be because @code{file-notify-rm-watch} was +called (see below), or because the file being watched was deleted, or +due to another error reported from the underlying library which makes +further watching impossible. @var{file} and @var{file1} are the name of the file(s) whose event is being reported. For example: @@ -3216,7 +3219,7 @@ being reported. For example: @end group @end example -Whether the action @code{renamed} is returned, depends on the used +Whether the action @code{renamed} is returned depends on the used watch library. Otherwise, the actions @code{deleted} and @code{created} could be returned in a random order. commit 25308a95f8869c4c0806e61f23c6463bf7ef5f62 Author: Eli Zaretskii Date: Wed Apr 20 19:36:59 2022 +0300 Improve documentation of 'scheme-indent-function' property * lisp/progmodes/scheme.el: Extend and clarify the commentary regarding the 'scheme-indent-function' property of special forms. diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index 9b98c4e6dd..cd397733d2 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -562,10 +562,20 @@ indentation." (lisp-indent-specform 2 state indent-point normal-indent) (lisp-indent-specform 1 state indent-point normal-indent))) -;; (put 'begin 'scheme-indent-function 0), say, causes begin to be indented -;; like defun if the first form is placed on the next line, otherwise -;; it is indented like any other form (i.e. forms line up under first). - +;; See `scheme-indent-function' (the function) for what these do. +;; In a nutshell: +;; . for forms with no `scheme-indent-function' property the 2nd +;; and subsequent lines will be indented with one space; +;; . if the value of the property is zero, then when the first form +;; is on a separate line, the next lines will be indented with 2 +;; spaces instead of the default one space; +;; . if the value is a positive integer N, the first N lines after +;; the first one will be indented with 4 spaces, and the rest +;; will be indented with 2 spaces; +;; . if the value is `defun', the indentation is like for `defun'; +;; . if the value is a function, it will be called to produce the +;; required indentation. +;; See also http://community.schemewiki.org/?emacs-indentation. (put 'begin 'scheme-indent-function 0) (put 'case 'scheme-indent-function 1) (put 'delay 'scheme-indent-function 0) commit 6713b07e088f21ee9ca277794d8093c8158a9ed5 Author: Jean Abou Samra Date: Tue Apr 19 23:40:29 2022 +0200 Define indentation behavior for a few more special Scheme forms * lisp/progmodes/scheme.el: Define 'scheme-indent-function' property for 'and-let*', 'with-syntax', 'eval-when;, and pattern matching macros. (Bug#55033) Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index 592e2d5057..9b98c4e6dd 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -576,12 +576,16 @@ indentation." (put 'letrec 'scheme-indent-function 1) (put 'let-values 'scheme-indent-function 1) ; SRFI 11 (put 'let*-values 'scheme-indent-function 1) ; SRFI 11 +(put 'and-let* 'scheme-indent-function 1) ; SRFI 2 (put 'sequence 'scheme-indent-function 0) ; SICP, not r4rs (put 'let-syntax 'scheme-indent-function 1) (put 'letrec-syntax 'scheme-indent-function 1) (put 'syntax-rules 'scheme-indent-function 1) (put 'syntax-case 'scheme-indent-function 2) ; not r5rs +(put 'with-syntax 'scheme-indent-function 1) (put 'library 'scheme-indent-function 1) ; R6RS +;; Part of at least Guile, Chez Scheme, Chicken +(put 'eval-when 'scheme-indent-function 1) (put 'call-with-input-file 'scheme-indent-function 1) (put 'call-with-port 'scheme-indent-function 1) @@ -605,6 +609,14 @@ indentation." ;; SRFI-8 (put 'receive 'scheme-indent-function 2) +;; SRFI-204 (withdrawn, but provided in many implementations, see the SRFI text) +(put 'match 'scheme-indent-function 1) +(put 'match-lambda 'scheme-indent-function 0) +(put 'match-lambda* 'scheme-indent-function 0) +(put 'match-let 'scheme-indent-function 'scheme-let-indent) +(put 'match-let* 'scheme-indent-function 1) +(put 'match-letrec 'scheme-indent-function 1) + ;;;; MIT Scheme specific indentation. (if scheme-mit-dialect commit e6c2a2497d8cc8c38c816507681d5d529cfdbf2e Author: Paul Eggert Date: Tue Apr 19 19:16:29 2022 -0700 Update from gnulib (cherry picked from commit 992cf3cb675e074079341cc54c3b16d37a8b9ca8) This is a partial backport from master: it only includes the changes below. * lib/mini-gmp.c (gmp_assert_nocarry): Avoid many Clang unused-variable warnings when building with optimisation. * lib/verify.h (_GL_HAVE__STATIC_ASSERT): Modify condition for using _Static_assert to cope with older Apple builds of Clang exposing misleading compiler version numbers. See discussion starting at https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg00779.html diff --git a/lib/mini-gmp.c b/lib/mini-gmp.c index 8577b59ef6..14cabd1231 100644 --- a/lib/mini-gmp.c +++ b/lib/mini-gmp.c @@ -90,6 +90,7 @@ see https://www.gnu.org/licenses/. */ #define gmp_assert_nocarry(x) do { \ mp_limb_t __cy = (x); \ assert (__cy == 0); \ + (void) (__cy); \ } while (0) #define gmp_clz(count, x) do { \ diff --git a/lib/verify.h b/lib/verify.h index 07b2f4866f..c2d2a56670 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -34,7 +34,7 @@ #ifndef __cplusplus # if (201112L <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ \ - && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__))) + && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) # define _GL_HAVE__STATIC_ASSERT 1 # endif # if (202000L <= __STDC_VERSION__ \ commit 30812fc08474980580996ec5e204aec116c3765b Author: Po Lu Date: Wed Apr 20 11:47:10 2022 +0000 Implement `below' z-group on Haiku * src/haiku_support.cc (BWindow_set_z_group): Handle Z_GROUP_BELOW by setting the B_AVOID_FRONT flag. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 18a6318216..3dc9eb88b7 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -4317,6 +4317,11 @@ BWindow_set_z_group (void *window, enum haiku_z_group z_group) { w->z_group = z_group; w->RecomputeFeel (); + + if (w->z_group == Z_GROUP_BELOW) + w->SetFlags (w->Flags () | B_AVOID_FRONT); + else + w->SetFlags (w->Flags () & ~B_AVOID_FRONT); } w->UnlockLooper (); commit c32e8b33f4fdd17856e5f7ae8e7e7c6d3b473342 Author: Lars Ingebrigtsen Date: Wed Apr 20 13:07:34 2022 +0200 Ensure forward progress in bibtex-map-entries * lisp/textmodes/bibtex.el (bibtex-map-entries): Ensure forward progress (bug#55036). diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index d02eca506a..b2e0b7f9d0 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -2298,11 +2298,17 @@ is non-nil, FUN is not called for @String entries." (set-marker-insertion-type end-marker t) (save-excursion (goto-char (point-min)) - (while (setq found (bibtex-skip-to-valid-entry)) - (set-marker end-marker (cdr found)) - (looking-at bibtex-any-entry-maybe-empty-head) - (funcall fun (bibtex-key-in-head "") (car found) end-marker) - (goto-char end-marker))))) + (let ((prev (point))) + (while (setq found (bibtex-skip-to-valid-entry)) + ;; If we have invalid entries, ensure that we have forward + ;; progress so that we don't infloop. + (if (= (point) prev) + (forward-line 1) + (setq prev (point)) + (set-marker end-marker (cdr found)) + (looking-at bibtex-any-entry-maybe-empty-head) + (funcall fun (bibtex-key-in-head "") (car found) end-marker) + (goto-char end-marker))))))) (defun bibtex-progress-message (&optional flag interval) "Echo a message about progress of current buffer. commit c2dc6db2fdd743befa5d6634967b5a1a994a9c6e Author: Lars Ingebrigtsen Date: Wed Apr 20 12:48:55 2022 +0200 Fix the outline level in the Emacs NEWS modes * lisp/textmodes/emacs-news-mode.el (emacs-news--mode-common): Fix the outline level (bug#54993). diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index d9c5b15bf4..2ebd4aa829 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -52,8 +52,11 @@ (defun emacs-news--mode-common () (setq-local font-lock-defaults '(emacs-news-mode-font-lock-keywords t)) - (setq-local outline-regexp "^\\*+ " + (setq-local outline-regexp "\\*+ " outline-minor-mode-cycle t + ;; We subtract one from the level, because we have a + ;; space after the asterisks. + outline-level (lambda () (1- (length (match-string 0)))) outline-minor-mode-highlight 'append) (outline-minor-mode)) commit 91d4898d5cceddd80456b6ce57ce2c5392aa1281 Author: Lars Ingebrigtsen Date: Tue Apr 19 13:48:06 2022 +0200 Revert prompting changes in viper-cmd * lisp/emulation/viper-cmd.el (viper-quote-region) (viper-read-string-with-history, viper-query-replace): Revert prompting changes done in 50512e3 -- the way viper prompts in command mode is special (bug#55007). Do not merge to master. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 2740a5b3e5..1f2f3ecfc3 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1786,7 +1786,7 @@ Undo previous insertion and inserts new." (do-not-change-default t)) (setq quote-str (viper-read-string-with-history - "Quote string" + "Quote string: " nil 'viper-quote-region-history ;; FIXME: Use comment-region. @@ -1995,17 +1995,24 @@ problems." #'viper-minibuffer-standard-hook (if (or (not (listp old)) (eq (car old) 'lambda)) (list old) old)))) - (val "")) + (val "") + (padding "") + temp-msg) (setq keymap (or keymap minibuffer-local-map) initial (or initial "") - viper-initial initial) + viper-initial initial + temp-msg (if default + (format "(default %s) " default) + "")) (setq viper-incomplete-ex-cmd nil) - (setq val (read-from-minibuffer (format-prompt prompt default) - nil - keymap nil history-var default)) - (setq minibuffer-setup-hook nil) + (setq val (read-from-minibuffer prompt + (concat temp-msg initial val padding) + keymap nil history-var)) + (setq minibuffer-setup-hook nil + padding (viper-array-to-string (this-command-keys)) + temp-msg "") ;; the following tries to be smart about what to put in history (if (not (string= val (car (symbol-value history-var)))) (push val (symbol-value history-var))) @@ -3819,7 +3826,7 @@ Null string will repeat previous search." (let (buffer buffer-name) (setq buffer-name (funcall viper-read-buffer-function - (format-prompt "Kill buffer" + (format "Kill buffer (%s): " (buffer-name (current-buffer))))) (setq buffer (if (null buffer-name) @@ -4165,8 +4172,8 @@ and regexp replace." (interactive) (let (str) (setq str (viper-read-string-with-history - (if viper-re-query-replace "Query replace regexp" - "Query replace") + (if viper-re-query-replace "Query replace regexp: " + "Query replace: ") nil ; no initial 'viper-replace1-history (car viper-replace1-history) ; default @@ -4181,7 +4188,7 @@ and regexp replace." (query-replace-regexp str (viper-read-string-with-history - (format-message "Query replace regexp `%s' with" str) + (format-message "Query replace regexp `%s' with: " str) nil ; no initial 'viper-replace1-history (car viper-replace1-history) ; default @@ -4189,7 +4196,7 @@ and regexp replace." (query-replace str (viper-read-string-with-history - (format-message "Query replace `%s' with" str) + (format-message "Query replace `%s' with: " str) nil ; no initial 'viper-replace1-history (car viper-replace1-history) ; default commit 11b88036e80a67add717db7a0d6184891349415e Author: Basil L. Contovounesios Date: Wed Apr 20 13:20:57 2022 +0300 ; Fix repeated lambda argnames in files-tests.el. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index c5b0fe0bbb..34c002be27 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -263,7 +263,7 @@ form.") nil)) (kill-emacs-args nil) ((symbol-function #'kill-emacs) - (lambda (&optional arg arg) (push arg kill-emacs-args))) + (lambda (&rest args) (push args kill-emacs-args))) (process (make-process :name "sleep" @@ -274,7 +274,7 @@ form.") (save-buffers-kill-emacs) (kill-process process) (should-not yes-or-no-p-prompts) - (should (equal kill-emacs-args '(nil))))) + (should (equal kill-emacs-args '((nil nil)))))) (ert-deftest files-tests-read-file-in-~ () "Test file prompting in directory named `~'. commit b8524003dc410557c0670b7f2a60e861eb819fed Author: Basil L. Contovounesios Date: Wed Apr 20 12:52:22 2022 +0300 Fix build for --enable-checking=structs * src/pdumper.c (dump_subr): Update Lisp_Subr hash after last change of 2022-04-18 "Port struct Lisp_Subr to C99". diff --git a/src/pdumper.c b/src/pdumper.c index 0b74e6431f..5923d9b1d8 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2853,7 +2853,7 @@ dump_bool_vector (struct dump_context *ctx, const struct Lisp_Vector *v) static dump_off dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr) { -#if CHECK_STRUCTS && !defined (HASH_Lisp_Subr_A212A8F82A) +#if CHECK_STRUCTS && !defined (HASH_Lisp_Subr_20B7443AD7) # error "Lisp_Subr changed. See CHECK_STRUCTS comment in config.h." #endif struct Lisp_Subr out; commit e4ed7e0ce97528b2130c33326179a10d6133ce92 Author: Po Lu Date: Wed Apr 20 16:06:06 2022 +0800 Reset Motif DND protocol numbers when writing targets table * src/xterm.c (xm_setup_dnd_targets): Set header.protocol to 0 when writing table. diff --git a/src/xterm.c b/src/xterm.c index 92c8ac09c9..0243b3cf96 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1662,9 +1662,17 @@ xm_setup_dnd_targets (struct x_display_info *dpyinfo, } if (!rc) - xm_write_targets_table (dpyinfo->display, drag_window, - dpyinfo->Xatom_MOTIF_DRAG_TARGETS, - &header, recs); + { + /* Some implementations of Motif DND set the protocol version of + just the targets table to 1 without actually changing the + data format. To avoid confusing Motif when that happens, set + it back to 0. There will probably be no more updates to the + protocol either. */ + header.protocol = 0; + xm_write_targets_table (dpyinfo->display, drag_window, + dpyinfo->Xatom_MOTIF_DRAG_TARGETS, + &header, recs); + } XUngrabServer (dpyinfo->display); commit 9e48d7468aacf18beea4cac759b97d300b0b2a0a Author: Po Lu Date: Wed Apr 20 07:37:19 2022 +0000 Implement `above' z-group on Haiku * src/haiku_support.cc (class EmacsWindow): New field `z_group'. (RecomputeFeel): New function. (ParentTo, BWindow_set_override_redirect): Use that instead instead of manually juggling the window feel around. (BWindow_set_z_group): New function. * src/haiku_support.h (enum haiku_z_group): New enum. * src/haikufns.c (haiku_set_parent_frame): Clean up coding style. (haiku_set_z_group): New function. (haiku_create_frame): Always set z group after window creation, like on X. (haiku_frame_parm_handlers): Add `haiku_set_z_group'. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index af37fe7a62..18a6318216 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -499,11 +499,13 @@ class EmacsWindow : public BWindow uint32 pre_override_redirect_workspaces; int window_id; bool *menus_begun = NULL; + enum haiku_z_group z_group; EmacsWindow () : BWindow (BRect (0, 0, 0, 0), "", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NO_SERVER_SIDE_WINDOW_MODIFIERS) { window_id = current_window_id++; + z_group = Z_GROUP_NONE; /* This pulse rate is used by scroll bars for repeating a button action while a button is held down. */ @@ -530,6 +532,19 @@ class EmacsWindow : public BWindow child_frame_lock.Unlock (); } + void + RecomputeFeel (void) + { + if (override_redirect_p) + SetFeel (kMenuWindowFeel); + else if (parent) + SetFeel (B_FLOATING_SUBSET_WINDOW_FEEL); + else if (z_group == Z_GROUP_ABOVE) + SetFeel (B_FLOATING_ALL_WINDOW_FEEL); + else + SetFeel (B_NORMAL_WINDOW_FEEL); + } + BRect CalculateZoomRect (void) { @@ -648,12 +663,17 @@ class EmacsWindow : public BWindow void Unparent (void) { + EmacsWindow *parent; + if (!child_frame_lock.Lock ()) gui_abort ("Failed to lock child frame state lock"); - this->SetFeel (B_NORMAL_WINDOW_FEEL); + + parent = this->parent; + this->parent = NULL; + RecomputeFeel (); UpwardsUnSubsetChildren (parent); this->RemoveFromSubset (this); - this->parent = NULL; + if (fullscreen_p) { fullscreen_p = 0; @@ -704,7 +724,7 @@ class EmacsWindow : public BWindow UnparentAndUnlink (); this->parent = window; - this->SetFeel (B_FLOATING_SUBSET_WINDOW_FEEL); + RecomputeFeel (); this->AddToSubset (this); if (!IsHidden () && this->parent) UpwardsSubsetChildren (parent); @@ -4116,9 +4136,8 @@ BWindow_set_override_redirect (void *window, bool override_redirect_p) if (override_redirect_p && !w->override_redirect_p) { w->override_redirect_p = true; - w->pre_override_redirect_feel = w->Feel (); w->pre_override_redirect_look = w->Look (); - w->SetFeel (kMenuWindowFeel); + w->RecomputeFeel (); w->SetLook (B_NO_BORDER_WINDOW_LOOK); w->pre_override_redirect_workspaces = w->Workspaces (); w->SetWorkspaces (B_ALL_WORKSPACES); @@ -4126,8 +4145,8 @@ BWindow_set_override_redirect (void *window, bool override_redirect_p) else if (w->override_redirect_p) { w->override_redirect_p = false; - w->SetFeel (w->pre_override_redirect_feel); w->SetLook (w->pre_override_redirect_look); + w->RecomputeFeel (); w->SetWorkspaces (w->pre_override_redirect_workspaces); } @@ -4286,3 +4305,20 @@ be_replay_menu_bar_event (void *menu_bar, messenger.SendMessage (&msg, &reply); return reply.what == BE_MENU_BAR_OPEN; } + +void +BWindow_set_z_group (void *window, enum haiku_z_group z_group) +{ + EmacsWindow *w = (EmacsWindow *) window; + + if (w->LockLooper ()) + { + if (w->z_group != z_group) + { + w->z_group = z_group; + w->RecomputeFeel (); + } + + w->UnlockLooper (); + } +} diff --git a/src/haiku_support.h b/src/haiku_support.h index 7f6f6e9b0d..dfcf83bf3b 100644 --- a/src/haiku_support.h +++ b/src/haiku_support.h @@ -38,21 +38,28 @@ along with GNU Emacs. If not, see . */ enum haiku_cursor { - CURSOR_ID_NO_CURSOR = 12, - CURSOR_ID_RESIZE_NORTH = 15, - CURSOR_ID_RESIZE_EAST = 16, - CURSOR_ID_RESIZE_SOUTH = 17, - CURSOR_ID_RESIZE_WEST = 18, - CURSOR_ID_RESIZE_NORTH_EAST = 19, - CURSOR_ID_RESIZE_NORTH_WEST = 20, - CURSOR_ID_RESIZE_SOUTH_EAST = 21, - CURSOR_ID_RESIZE_SOUTH_WEST = 22, - CURSOR_ID_RESIZE_NORTH_SOUTH = 23, - CURSOR_ID_RESIZE_EAST_WEST = 24, + CURSOR_ID_NO_CURSOR = 12, + CURSOR_ID_RESIZE_NORTH = 15, + CURSOR_ID_RESIZE_EAST = 16, + CURSOR_ID_RESIZE_SOUTH = 17, + CURSOR_ID_RESIZE_WEST = 18, + CURSOR_ID_RESIZE_NORTH_EAST = 19, + CURSOR_ID_RESIZE_NORTH_WEST = 20, + CURSOR_ID_RESIZE_SOUTH_EAST = 21, + CURSOR_ID_RESIZE_SOUTH_WEST = 22, + CURSOR_ID_RESIZE_NORTH_SOUTH = 23, + CURSOR_ID_RESIZE_EAST_WEST = 24, CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST = 25, CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST = 26 }; +enum haiku_z_group + { + Z_GROUP_ABOVE, + Z_GROUP_NONE, + Z_GROUP_BELOW, + }; + enum haiku_alert_type { HAIKU_EMPTY_ALERT = 0, @@ -459,6 +466,7 @@ extern void BWindow_send_behind (void *, void *); extern bool BWindow_is_active (void *); extern void BWindow_set_override_redirect (void *, bool); extern void BWindow_dimensions (void *, int *, int *); +extern void BWindow_set_z_group (void *, enum haiku_z_group); extern void BWindow_Flush (void *); extern void BFont_close (void *); diff --git a/src/haikufns.c b/src/haikufns.c index b19fdd5488..5fca46c41b 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -395,8 +395,8 @@ haiku_set_child_frame_border_width (struct frame *f, } static void -haiku_set_parent_frame (struct frame *f, - Lisp_Object new_value, Lisp_Object old_value) +haiku_set_parent_frame (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value) { struct frame *p = NULL; block_input (); @@ -421,6 +421,7 @@ haiku_set_parent_frame (struct frame *f, EmacsWindow_unparent (FRAME_HAIKU_WINDOW (f)); FRAME_OUTPUT_DATA (f)->parent_desc = NULL; } + if (!NILP (new_value)) { EmacsWindow_parent_to (FRAME_HAIKU_WINDOW (f), @@ -436,6 +437,43 @@ haiku_set_parent_frame (struct frame *f, unblock_input (); } +static void +haiku_set_z_group (struct frame *f, Lisp_Object new_value, + Lisp_Object old_value) +{ + int rc; + + /* Tooltip frames can't have Z groups, since the window feel is + overridden during frame creation. */ + if (FRAME_TOOLTIP_P (f)) + return; + + rc = 1; + block_input (); + + if (NILP (new_value)) + { + BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_NONE); + FRAME_Z_GROUP (f) = z_group_none; + } + else if (EQ (new_value, Qabove)) + { + BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_ABOVE); + FRAME_Z_GROUP (f) = z_group_above; + } + else if (EQ (new_value, Qbelow)) + { + BWindow_set_z_group (FRAME_HAIKU_WINDOW (f), Z_GROUP_BELOW); + FRAME_Z_GROUP (f) = z_group_below; + } + else + rc = 0; + + unblock_input (); + if (!rc) + error ("Invalid z-group specification"); +} + static void haiku_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { @@ -726,11 +764,11 @@ haiku_create_frame (Lisp_Object parms) RES_TYPE_NUMBER); if (FIXNUMP (tem)) store_frame_param (f, Qmin_height, tem); + adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qx_create_frame_1); - gui_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); gui_default_parameter (f, parms, Qno_focus_on_map, Qnil, NULL, NULL, RES_TYPE_BOOLEAN); gui_default_parameter (f, parms, Qno_accept_focus, Qnil, @@ -875,6 +913,9 @@ haiku_create_frame (Lisp_Object parms) || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) kset_default_minibuffer_frame (kb, frame); + gui_default_parameter (f, parms, Qz_group, Qnil, + NULL, NULL, RES_TYPE_SYMBOL); + for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) fset_param_alist (f, Fcons (XCAR (tem), f->param_alist)); @@ -2638,7 +2679,7 @@ frame_parm_handler haiku_frame_parm_handlers[] = NULL, /* set skip taskbar */ haiku_set_no_focus_on_map, haiku_set_no_accept_focus, - NULL, /* set z group */ + haiku_set_z_group, haiku_set_override_redirect, gui_set_no_special_glyphs, gui_set_alpha_background,