commit 61a5bbc6836337479f5d8dba1897380b1c63bc25 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Mon Feb 7 14:58:32 2022 +0800 Really fix extended frame synchronization * src/xterm.c (XTframe_up_to_date): Make sure the extended counter ends up even. diff --git a/src/xterm.c b/src/xterm.c index d3d8dc468c..49fc2b1bb7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1848,6 +1848,12 @@ x_update_end (struct frame *f) static void XTframe_up_to_date (struct frame *f) { +#ifdef HAVE_XSYNC + XSyncValue add; + XSyncValue current; + Bool overflow_p; +#endif + eassert (FRAME_X_P (f)); block_input (); FRAME_MOUSE_UPDATE (f); @@ -1867,12 +1873,15 @@ XTframe_up_to_date (struct frame *f) if (FRAME_X_OUTPUT (f)->ext_sync_end_pending_p && FRAME_X_EXTENDED_COUNTER (f) != None) { - XSyncValue add; - Bool overflow_p; + current = FRAME_X_OUTPUT (f)->current_extended_counter_value; + + if (XSyncValueLow32 (current) % 2) + XSyncIntToValue (&add, 1); + else + XSyncIntToValue (&add, 2); - XSyncIntToValue (&add, 1); XSyncValueAdd (&FRAME_X_OUTPUT (f)->current_extended_counter_value, - add, add, &overflow_p); + current, add, &overflow_p); if (overflow_p) emacs_abort (); commit f91a911ef339975a39ae5e4b41eeab0be7824b25 Author: Tassilo Horn Date: Mon Feb 7 06:52:04 2022 +0100 ; Fix previous commit (6e5d79c048) diff --git a/lisp/paren.el b/lisp/paren.el index b0a2eb8dc5..398e51e1b8 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -276,7 +276,7 @@ It is the default value of `show-paren-data-function'." "Redirect focus from child frame." (redirect-frame-focus show-paren--context-child-frame - (frame-parent corfu--frame))) + (frame-parent show-paren--context-child-frame))) (defun show-paren--context-child-frame-buffer (text) (with-current-buffer commit de419bba04601b163def31308d63c51ed90b1458 Author: Lars Ingebrigtsen Date: Mon Feb 7 04:57:27 2022 +0100 Fix the Scroll key binding on Windows * lisp/bindings.el (global-map): Fix the binding on Windows (bug#38007). * lisp/scroll-lock.el (scroll-lock-mode): The event is `scroll' on Windows, not `Scroll_Lock'. diff --git a/lisp/bindings.el b/lisp/bindings.el index 26b17035ef..8ae8c3d60e 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1160,7 +1160,9 @@ if `inhibit-field-text-motion' is non-nil." ;(define-key global-map [delete] 'backward-delete-char) ;; natural bindings for terminal keycaps --- defined in X keysym order -(define-key global-map [Scroll_Lock] 'scroll-lock-mode) +(define-key global-map + (if (eq system-type 'windows-nt) [scroll] [Scroll_Lock]) + #'scroll-lock-mode) (define-key global-map [C-S-backspace] 'kill-whole-line) (define-key global-map [home] 'move-beginning-of-line) (define-key global-map [C-home] 'beginning-of-buffer) diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el index d41e335233..3f5f777f53 100644 --- a/lisp/scroll-lock.el +++ b/lisp/scroll-lock.el @@ -55,7 +55,7 @@ will scroll the buffer by the respective amount of lines instead and point will be kept vertically fixed relative to window boundaries during scrolling. -Note that the default key binding to Scroll_Lock will not work on +Note that the default key binding to `scroll' will not work on MS-Windows systems if `w32-scroll-lock-modifier' is non-nil." :lighter " ScrLck" :keymap scroll-lock-mode-map commit cb09a1120e94bda3f4ddad644bbd1a1f1f9641f7 Author: Lars Ingebrigtsen Date: Mon Feb 7 04:51:06 2022 +0100 Make the eintr.html target match what's on the web * doc/lispintro/Makefile.in (HTML_TARGETS, eintr.html): Make the name match the URL at https://www.gnu.org/software/emacs/manual/eintr.html (bug#38817). diff --git a/doc/lispintro/Makefile.in b/doc/lispintro/Makefile.in index d554f3d7a6..42e6d2c1c8 100644 --- a/doc/lispintro/Makefile.in +++ b/doc/lispintro/Makefile.in @@ -63,7 +63,7 @@ ENVADD = \ MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)" DVI_TARGETS = emacs-lisp-intro.dvi -HTML_TARGETS = emacs-lisp-intro.html +HTML_TARGETS = eintr.html PDF_TARGETS = emacs-lisp-intro.pdf PS_TARGETS = emacs-lisp-intro.ps @@ -95,7 +95,7 @@ emacs-lisp-intro.dvi: ${srcs} emacs-lisp-intro.pdf: ${srcs} $(ENVADD) $(TEXI2PDF) $< -emacs-lisp-intro.html: ${srcs} +eintr.html: ${srcs} $(AM_V_GEN)$(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) -o $@ $< emacs-lisp-intro.ps: emacs-lisp-intro.dvi diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 9d4520b040..466d7f0e60 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -1,8 +1,6 @@ \input texinfo @c -*- mode: texinfo; coding: utf-8 -*- @comment %**start of header @setfilename ../../info/eintr.info -@c setfilename emacs-lisp-intro.info -@c sethtmlfilename emacs-lisp-intro.html @settitle Programming in Emacs Lisp @include docstyle.texi @syncodeindex vr cp commit f655bd20084474df5472eaf28368b7185abe98e6 Author: Lars Ingebrigtsen Date: Mon Feb 7 01:59:18 2022 +0100 Give a better error in locate-default-make-command-line * lisp/locate.el (locate-default-make-command-line): Error out more nicely. diff --git a/lisp/locate.el b/lisp/locate.el index d4847b9c05..20ef052184 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -238,6 +238,8 @@ that is, with a prefix arg, you get the default behavior." ;; Functions (defun locate-default-make-command-line (search-string) + (unless (executable-find locate-command) + (error "Can't find the %s command" locate-command)) (list locate-command search-string)) (defun locate-word-at-point () commit 130cd70d9bea68099e9748af59fe812c248ca1f5 Author: Lars Ingebrigtsen Date: Mon Feb 7 01:38:41 2022 +0100 Improve the ediff-diff-options documentation * lisp/vc/ediff-diff.el (ediff-diff-options): * doc/misc/ediff.texi (Patch and Diff Programs): Note that setting this variable directly is probably the wrong thing to do (bug#6512). diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi index d81ba158a1..39b09b29b3 100644 --- a/doc/misc/ediff.texi +++ b/doc/misc/ediff.texi @@ -1866,7 +1866,8 @@ These variables specify the options to pass to the above utilities. In @code{ediff-diff-options}, it may be useful to specify options such as @samp{-w} that ignore certain kinds of changes. However, Ediff does not let you use the option @samp{-c}, as it doesn't recognize this -format yet. +format yet. (If you alter this variable, it should be done via the +Customize interface instead of using @code{setq} directly.) @item ediff-coding-system-for-read @vindex ediff-coding-system-for-read diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index ca56a2851d..07b853817d 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -85,7 +85,10 @@ options after the default ones. This variable is not for customizing the look of the differences produced by the command \\[ediff-show-diff-output]. Use the variable -`ediff-custom-diff-options' for that." +`ediff-custom-diff-options' for that. + +Setting this variable directly may not yield the expected +results. It should be set via the Customize interface instead." :set #'ediff-set-diff-options :type 'string) commit ab5b2e63fa0b966570cc505fa4a77d16cf3f45d6 Author: Po Lu Date: Mon Feb 7 03:00:25 2022 +0000 Respect `x-cursor-fore-pixel' on Haiku * src/haikufns.c (haiku_set_cursor_color): Respect `x-cursor-fore-pixel'. (syms_of_haikufns): Declare variable `x-cursor-fore-pixel'. diff --git a/src/haikufns.c b/src/haikufns.c index eb736f1153..8aad2cbd7f 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -1393,7 +1393,7 @@ haiku_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) CHECK_STRING (arg); block_input (); - Emacs_Color color; + Emacs_Color color, fore_pixel; if (haiku_get_color (SSDATA (arg), &color)) { @@ -1403,6 +1403,17 @@ haiku_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } FRAME_CURSOR_COLOR (f) = color; + + if (STRINGP (Vx_cursor_fore_pixel)) + { + if (haiku_get_color (SSDATA (Vx_cursor_fore_pixel), + &fore_pixel)) + error ("Bad color %s", Vx_cursor_fore_pixel); + FRAME_OUTPUT_DATA (f)->cursor_fg = fore_pixel.pixel; + } + else + FRAME_OUTPUT_DATA (f)->cursor_fg = FRAME_BACKGROUND_PIXEL (f); + if (FRAME_VISIBLE_P (f)) { gui_update_cursor (f, 0); @@ -2685,6 +2696,10 @@ syms_of_haikufns (void) doc: /* SKIP: real doc in xfns.c. */); Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40)); + DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel, + doc: /* SKIP: real doc in xfns.c. */); + Vx_cursor_fore_pixel = Qnil; + #ifdef USE_BE_CAIRO DEFVAR_LISP ("cairo-version-string", Vcairo_version_string, doc: /* Version info for cairo. */); commit e9217d0f348ec1be6950630795ff940f5b556f8e Author: Po Lu Date: Mon Feb 7 10:37:08 2022 +0800 Clean up more code from PGTK port * lisp/term/pgtk-win.el (pgtk-disown-selection-internal) (pgtk-get-selection-internal): Fix declarations for new calling conventions. * src/gtkutil.c (xg_frame_set_char_size, x_wm_set_size_hint): Clean up meaningless variables on PGTK. * src/pgtkfns.c (Fx_create_frame, syms_of_pgtkfns): Clean up meaningless variables and fix copied doc strings to use "skip". * src/pgtkim.c (im_context_commit_cb) (im_context_retrieve_surrounding_cb) (im_context_delete_surrounding_cb, make_color_string) (im_context_preedit_changed_cb, im_context_preedit_end_cb) (im_context_preedit_start_cb): Fix coding style. * src/pgtkselect.c (pgtk_selection_usable) (Fpgtk_disown_selection_internal, Fpgtk_get_selection_internal): Remove unused arguments. (syms_of_pgtkselect): Fix doc strings and old style variable declarations. * src/pgtkterm.c (x_set_offset, x_set_parent_frame) (syms_of_pgtkterm): Clean up doc strings and remove meaningless variables. diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el index 25f3a851dc..8e17864284 100644 --- a/lisp/term/pgtk-win.el +++ b/lisp/term/pgtk-win.el @@ -290,6 +290,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; Any display name is OK. (add-to-list 'display-format-alist '(".*" . pgtk)) + (cl-defmethod handle-args-function (args &context (window-system pgtk)) (x-handle-args args)) @@ -297,10 +298,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") (x-create-frame-with-faces params)) (declare-function pgtk-own-selection-internal "pgtkselect.c" (selection value &optional frame)) -(declare-function pgtk-disown-selection-internal "pgtkselect.c" (selection &optional time_object terminal)) +(declare-function pgtk-disown-selection-internal "pgtkselect.c" (selection &optional terminal)) (declare-function pgtk-selection-owner-p "pgtkselect.c" (&optional selection terminal)) (declare-function pgtk-selection-exists-p "pgtkselect.c" (&optional selection terminal)) -(declare-function pgtk-get-selection-internal "pgtkselect.c" (selection-symbol target-type &optional time_stamp terminal)) +(declare-function pgtk-get-selection-internal "pgtkselect.c" (selection-symbol target-type &optional terminal)) (cl-defmethod gui-backend-set-selection (selection value &context (window-system pgtk)) diff --git a/src/gtkutil.c b/src/gtkutil.c index 6912ea1e96..95c422bbd9 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1170,7 +1170,11 @@ xg_frame_set_char_size (struct frame *f, int width, int height) else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f)) { was_visible = true; +#ifndef HAVE_PGTK hide_child_frame = EQ (x_gtk_resize_child_frames, Qhide); +#else + hide_child_frame = false; +#endif if (outer_width != gwidth || outer_height != gheight) { @@ -1927,12 +1931,12 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) else if (win_gravity == StaticGravity) size_hints.win_gravity = GDK_GRAVITY_STATIC; - if (x_gtk_use_window_move) - { - if (flags & PPosition) hint_flags |= GDK_HINT_POS; - if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS; - if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE; - } + if (flags & PPosition) + hint_flags |= GDK_HINT_POS; + if (flags & USPosition) + hint_flags |= GDK_HINT_USER_POS; + if (flags & USSize) + hint_flags |= GDK_HINT_USER_SIZE; if (user_position) { diff --git a/src/pgtkfns.c b/src/pgtkfns.c index 15e14f75e4..534f1dc2a9 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -1583,12 +1583,9 @@ This function is an internal primitive--use `make-frame' instead. */ ) RES_TYPE_BOOLEAN); f->no_split = minibuffer_only || EQ (tem, Qt); - /* Create the X widget or window. */ - /* x_window (f); */ xg_create_frame_widgets (f); pgtk_set_event_handler (f); - #define INSTALL_CURSOR(FIELD, NAME) \ FRAME_X_OUTPUT (f)->FIELD = gdk_cursor_new_for_display (FRAME_X_DISPLAY (f), GDK_ ## NAME) @@ -1766,14 +1763,10 @@ This function is an internal primitive--use `make-frame' instead. */ ) return unbind_to (count, frame); } -/** - * x_frame_restack: - * - * Restack frame F1 below frame F2, above if ABOVE_FLAG is non-nil. In - * practice this is a two-step action: The first step removes F1's - * window-system window from the display. The second step reinserts - * F1's window below (above if ABOVE_FLAG is true) that of F2. - */ +/* Restack frame F1 below frame F2, above if ABOVE_FLAG is non-nil. + In practice this is a two-step action: The first step removes F1's + window-system window from the display. The second step reinserts + F1's window below (above if ABOVE_FLAG is true) that of F2. */ static void pgtk_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) { @@ -1782,7 +1775,6 @@ pgtk_frame_restack (struct frame *f1, struct frame *f2, bool above_flag) unblock_input (); } - DEFUN ("pgtk-frame-restack", Fpgtk_frame_restack, Spgtk_frame_restack, 2, 3, 0, doc: /* Restack FRAME1 below FRAME2. This means that if both frames are visible and the display areas of @@ -3874,7 +3866,7 @@ syms_of_pgtkfns (void) DEFSYM (Qresize_mode, "resize-mode"); DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel, - doc: /* A string indicating the foreground color of the cursor box. */); + doc: /* SKIP: real doc in xfns.c. */); Vx_cursor_fore_pixel = Qnil; DEFVAR_LISP ("pgtk-icon-type-alist", Vpgtk_icon_type_alist, @@ -3898,14 +3890,7 @@ When you miniaturize a Group, Summary or Article frame, Gnus.tiff will be used as the image of the icon representing the frame. */); Vpgtk_icon_type_alist = list1 (Qt); - - /* Provide x-toolkit also for GTK. Internally GTK does not use Xt so it - is not an X toolkit in that sense (USE_X_TOOLKIT is not defined). - But for a user it is a toolkit for X, and indeed, configure - accepts --with-x-toolkit=gtk. */ - Fprovide (intern_c_string ("x-toolkit"), Qnil); Fprovide (intern_c_string ("gtk"), Qnil); - Fprovide (intern_c_string ("move-toolbar"), Qnil); DEFVAR_LISP ("gtk-version-string", Vgtk_version_string, doc: /* Version info for GTK+. */); @@ -3998,52 +3983,21 @@ be used as the image of the icon representing the frame. */); /* This is not ifdef:ed, so other builds than GTK can customize it. */ DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog, - doc: /* Non-nil means prompt with the old GTK file selection dialog. -If nil or if the file selection dialog is not available, the new GTK file -chooser is used instead. To turn off all file dialogs set the -variable `use-file-dialog'. */); + doc: /* SKIP: real doc in xfns.c. */); x_gtk_use_old_file_dialog = false; DEFVAR_BOOL ("x-gtk-show-hidden-files", x_gtk_show_hidden_files, - doc: /* If non-nil, the GTK file chooser will by default show hidden files. -Note that this is just the default, there is a toggle button on the file -chooser to show or not show hidden files on a case by case basis. */); + doc: /* SKIP: real doc in xfns.c. */); x_gtk_show_hidden_files = false; DEFVAR_BOOL ("x-gtk-file-dialog-help-text", x_gtk_file_dialog_help_text, - doc: /* If non-nil, the GTK file chooser will show additional help text. -If more space for files in the file chooser dialog is wanted, set this to nil -to turn the additional text off. */); + doc: /* SKIP: real doc in xfns.c. */); x_gtk_file_dialog_help_text = true; DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size, - doc: /* Maximum size for tooltips. -Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); + doc: /* SKIP: real doc in xfns.c. */); Vx_max_tooltip_size = Fcons (make_fixnum (80), make_fixnum (40)); - DEFVAR_LISP ("x-gtk-resize-child-frames", x_gtk_resize_child_frames, - doc: /* If non-nil, resize child frames specially with GTK builds. -If this is nil, resize child frames like any other frames. This is the -default and usually works with most desktops. Some desktop environments -(GNOME shell in particular when using the mutter window manager), -however, may refuse to resize a child frame when Emacs is built with -GTK3. For those environments, the two settings below are provided. - -If this equals the symbol 'hide', Emacs temporarily hides the child -frame during resizing. This approach seems to work reliably, may -however induce some flicker when the frame is made visible again. - -If this equals the symbol 'resize-mode', Emacs uses GTK's resize mode to -always trigger an immediate resize of the child frame. This method is -deprecated by GTK and may not work in future versions of that toolkit. -It also may freeze Emacs when used with other desktop environments. It -avoids, however, the unpleasant flicker induced by the hiding approach. - -This variable is considered a temporary workaround and will be hopefully -eliminated in future versions of Emacs. */); - x_gtk_resize_child_frames = Qnil; - - DEFSYM (Qmono, "mono"); DEFSYM (Qassq_delete_all, "assq-delete-all"); diff --git a/src/pgtkim.c b/src/pgtkim.c index 8577ba2116..e1fffafb61 100644 --- a/src/pgtkim.c +++ b/src/pgtkim.c @@ -25,7 +25,9 @@ along with GNU Emacs. If not, see . */ #include "pgtkterm.h" static void -im_context_commit_cb (GtkIMContext * imc, gchar * str, gpointer user_data) +im_context_commit_cb (GtkIMContext *imc, + gchar *str, + gpointer user_data) { struct pgtk_display_info *dpyinfo = user_data; struct frame *f = dpyinfo->im.focused_frame; @@ -39,21 +41,21 @@ im_context_commit_cb (GtkIMContext * imc, gchar * str, gpointer user_data) } static gboolean -im_context_retrieve_surrounding_cb (GtkIMContext * imc, gpointer user_data) +im_context_retrieve_surrounding_cb (GtkIMContext *imc, gpointer user_data) { gtk_im_context_set_surrounding (imc, "", -1, 0); return TRUE; } static gboolean -im_context_delete_surrounding_cb (GtkIMContext * imc, int offset, int n_chars, +im_context_delete_surrounding_cb (GtkIMContext *imc, int offset, int n_chars, gpointer user_data) { return TRUE; } static Lisp_Object -make_color_string (PangoAttrColor * pac) +make_color_string (PangoAttrColor *pac) { char buf[256]; sprintf (buf, "#%02x%02x%02x", @@ -62,7 +64,7 @@ make_color_string (PangoAttrColor * pac) } static void -im_context_preedit_changed_cb (GtkIMContext * imc, gpointer user_data) +im_context_preedit_changed_cb (GtkIMContext *imc, gpointer user_data) { struct pgtk_display_info *dpyinfo = user_data; struct frame *f = dpyinfo->im.focused_frame; @@ -149,7 +151,7 @@ im_context_preedit_changed_cb (GtkIMContext * imc, gpointer user_data) } static void -im_context_preedit_end_cb (GtkIMContext * imc, gpointer user_data) +im_context_preedit_end_cb (GtkIMContext *imc, gpointer user_data) { struct pgtk_display_info *dpyinfo = user_data; struct frame *f = dpyinfo->im.focused_frame; @@ -163,7 +165,7 @@ im_context_preedit_end_cb (GtkIMContext * imc, gpointer user_data) } static void -im_context_preedit_start_cb (GtkIMContext * imc, gpointer user_data) +im_context_preedit_start_cb (GtkIMContext *imc, gpointer user_data) { } diff --git a/src/pgtkselect.c b/src/pgtkselect.c index 24fed19cd2..2660ea3ed3 100644 --- a/src/pgtkselect.c +++ b/src/pgtkselect.c @@ -230,82 +230,9 @@ pgtk_selection_usable (void) if (pgtk_enable_selection_on_multi_display) return true; - /* - * https://github.com/GNOME/gtk/blob/gtk-3-24/gdk/wayland/gdkselection-wayland.c#L1033 - * - * Gdk uses gdk_display_get_default() when handling selections, so - * selections don't work properly on multi-display environment. - * - * ---------------- - * #include - * - * static GtkWidget *top1, *top2; - * - * int main (int argc, char **argv) - * { - * GtkWidget *w; - * GtkTextBuffer *buf; - * - * gtk_init (&argc, &argv); - * - * static char *text = "\ - * It is fine today.\n\ - * It will be fine tomorrow too.\n\ - * It is too hot."; - * - * top1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - * gtk_window_set_title (GTK_WINDOW (top1), "default"); - * gtk_widget_show (top1); - * w = gtk_text_view_new (); - * gtk_container_add (GTK_CONTAINER (top1), w); - * gtk_widget_show (w); - * buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w)); - * gtk_text_buffer_insert_at_cursor (buf, text, strlen (text)); - * gtk_text_buffer_add_selection_clipboard (buf, gtk_widget_get_clipboard (w, GDK_SELECTION_PRIMARY)); - * - * unsetenv ("GDK_BACKEND"); - * GdkDisplay *gdpy; - * const char *dpyname2; - * if (strcmp (G_OBJECT_TYPE_NAME (gtk_widget_get_window (top1)), "GdkWaylandWindow") == 0) - * dpyname2 = ":0"; - * else - * dpyname2 = "wayland-0"; - * gdpy = gdk_display_open (dpyname2); - * top2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - * gtk_window_set_title (GTK_WINDOW (top2), dpyname2); - * gtk_window_set_screen (GTK_WINDOW (top2), gdk_display_get_default_screen (gdpy)); - * gtk_widget_show (top2); - * w = gtk_text_view_new (); - * gtk_container_add (GTK_CONTAINER (top2), w); - * gtk_widget_show (w); - * buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w)); - * gtk_text_buffer_insert_at_cursor (buf, text, strlen (text)); - * gtk_text_buffer_add_selection_clipboard (buf, gtk_widget_get_clipboard (w, GDK_SELECTION_PRIMARY)); - * - * gtk_main (); - * - * return 0; - * } - * ---------------- - * - * This code fails if - * GDK_BACKEND=x11 ./test - * and select on both of windows. - * - * ---------------- - * (test:15345): GLib-GObject-CRITICAL **: 01:56:38.041: g_object_ref: assertion 'G_IS_OBJECT (object)' failed - * - * (test:15345): GLib-GObject-CRITICAL **: 01:56:38.042: g_object_ref: assertion 'G_IS_OBJECT (object)' failed - * - * (test:15345): GLib-GObject-CRITICAL **: 01:56:39.113: g_object_ref: assertion 'G_IS_OBJECT (object)' failed - * - * (test:15345): GLib-GObject-CRITICAL **: 01:56:39.113: g_object_ref: assertion 'G_IS_OBJECT (object)' failed - * ---------------- - * (gtk-3.24.10) - * - * This function checks whether selections work by the number of displays. - * If you use more than 2 displays, then selection is disabled. - */ + /* Gdk uses `gdk_display_get_default' when handling selections, so + selections don't work properly when Emacs is connected to + multiple displays. */ GdkDisplayManager *dpyman = gdk_display_manager_get (); GSList *list = gdk_display_manager_list_displays (dpyman); @@ -408,21 +335,15 @@ nil, it defaults to the selected frame. */) } -DEFUN ("pgtk-disown-selection-internal", Fpgtk_disown_selection_internal, Spgtk_disown_selection_internal, 1, 3, 0, +DEFUN ("pgtk-disown-selection-internal", Fpgtk_disown_selection_internal, + Spgtk_disown_selection_internal, 1, 2, 0, doc: /* If we own the selection SELECTION, disown it. Disowning it means there is no such selection. -Sets the last-change time for the selection to TIME-OBJECT (by default -the time of the last event). - TERMINAL should be a terminal object or a frame specifying the X server to query. If omitted or nil, that stands for the selected -frame's display, or the first available X display. - -On Nextstep, the TIME-OBJECT and TERMINAL arguments are unused. -On MS-DOS, all this does is return non-nil if we own the selection. -On PGTK, the TIME-OBJECT is unused. */) - (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) +frame's display, or the first available X display. */) + (Lisp_Object selection, Lisp_Object terminal) { struct frame *f = frame_for_pgtk_selection (terminal); GtkClipboard *cb; @@ -503,29 +424,25 @@ On Nextstep, TERMINAL is unused. */) } -DEFUN ("pgtk-get-selection-internal", Fpgtk_get_selection_internal, Spgtk_get_selection_internal, 2, 4, 0, - doc: /* Return text selected from some X window. +DEFUN ("pgtk-get-selection-internal", Fpgtk_get_selection_internal, + Spgtk_get_selection_internal, 2, 3, 0, + doc: /* Return text selected from some program. SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) TARGET-TYPE is the type of data desired, typically `STRING'. -TIME-STAMP is the time to use in the XConvertSelection call for foreign -selections. If omitted, defaults to the time for the last event. - TERMINAL should be a terminal object or a frame specifying the X server to query. If omitted or nil, that stands for the selected -frame's display, or the first available X display. - -On Nextstep, TIME-STAMP and TERMINAL are unused. -On PGTK, TIME-STAMP is unused. */) +frame's display, or the first available display. */) (Lisp_Object selection_symbol, Lisp_Object target_type, - Lisp_Object time_stamp, Lisp_Object terminal) + Lisp_Object terminal) { struct frame *f = frame_for_pgtk_selection (terminal); GtkClipboard *cb; CHECK_SYMBOL (selection_symbol); CHECK_SYMBOL (target_type); + if (EQ (target_type, QMULTIPLE)) error ("Retrieving MULTIPLE selections is currently unimplemented"); if (!f) @@ -603,21 +520,23 @@ syms_of_pgtkselect (void) defsubr (&Spgtk_selection_owner_p); DEFVAR_LISP ("pgtk-sent-selection-hooks", Vpgtk_sent_selection_hooks, - "A list of functions to be called when Emacs answers a selection request.\n\ -The functions are called with four arguments:\n\ - - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD');\n\ - - the selection-type which Emacs was asked to convert the\n\ - selection into before sending (for example, `STRING' or `LENGTH');\n\ - - a flag indicating success or failure for responding to the request.\n\ -We might have failed (and declined the request) for any number of reasons,\n\ -including being asked for a selection that we no longer own, or being asked\n\ -to convert into a type that we don't know about or that is inappropriate.\n\ -This hook doesn't let you change the behavior of Emacs's selection replies,\n\ -it merely informs you that they have happened."); + doc: /* A list of functions to be called when Emacs answers a selection request +The functions are called with four arguments: + - the selection name (typically `PRIMARY', `SECONDARY', or `CLIPBOARD'); + - the selection-type which Emacs was asked to convert the + selection into before sending (for example, `STRING' or `LENGTH'); + - a flag indicating success or failure for responding to the request. +We might have failed (and declined the request) for any number of reasons, +including being asked for a selection that we no longer own, or being asked +to convert into a type that we don't know about or that is inappropriate. +This hook doesn't let you change the behavior of Emacs's selection replies, +it merely informs you that they have happened. */); Vpgtk_sent_selection_hooks = Qnil; DEFVAR_BOOL ("pgtk-enable-selection-on-multi-display", pgtk_enable_selection_on_multi_display, - doc: /* Enable selection on multi display environment. -This may cause crash. */); + doc: /* Enable selections when connected to multiple displays. +This may cause crashes due to a GTK bug, which assumes that clients +will connect to a single display. It might also cause selections to +not arrive at the correct display. */); pgtk_enable_selection_on_multi_display = false; } diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 169d3f8a03..9d15b671dd 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -450,8 +450,6 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity) External: Position the window -------------------------------------------------------------------------- */ { - int modified_top, modified_left; - if (change_gravity > 0) { f->top_pos = yoff; @@ -469,44 +467,23 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity) block_input (); x_wm_set_size_hint (f, 0, false); - if (x_gtk_use_window_move) + if (change_gravity != 0) { - if (change_gravity != 0) + if (FRAME_GTK_OUTER_WIDGET (f)) { - if (FRAME_GTK_OUTER_WIDGET (f)) - { - gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), - f->left_pos, f->top_pos); - } - else - { - GtkWidget *fixed = FRAME_GTK_WIDGET (f); - GtkWidget *parent = gtk_widget_get_parent (fixed); - gtk_fixed_move (GTK_FIXED (parent), fixed, - f->left_pos, f->top_pos); - } + gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), + f->left_pos, f->top_pos); + } + else + { + GtkWidget *fixed = FRAME_GTK_WIDGET (f); + GtkWidget *parent = gtk_widget_get_parent (fixed); + gtk_fixed_move (GTK_FIXED (parent), fixed, + f->left_pos, f->top_pos); } - unblock_input (); - return; - } - - modified_left = f->left_pos; - modified_top = f->top_pos; - - if (FRAME_GTK_OUTER_WIDGET (f)) - { - gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), - modified_left, modified_top); - } - else - { - GtkWidget *fixed = FRAME_GTK_WIDGET (f); - GtkWidget *parent = gtk_widget_get_parent (fixed); - gtk_fixed_move (GTK_FIXED (parent), fixed, - modified_left, modified_top); } - unblock_input (); + return; } static void @@ -902,14 +879,6 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, g_object_unref (fixed); - if (FRAME_GTK_OUTER_WIDGET (f)) - { - if (EQ (x_gtk_resize_child_frames, Qresize_mode)) - gtk_container_set_resize_mode - (GTK_CONTAINER (FRAME_GTK_OUTER_WIDGET (f)), - p ? GTK_RESIZE_IMMEDIATE : GTK_RESIZE_QUEUE); - } - unblock_input (); fset_parent_frame (f, new_value); @@ -6942,80 +6911,46 @@ syms_of_pgtkterm (void) Fput (Qcontrol, Qmodifier_value, make_fixnum (ctrl_modifier)); DEFVAR_LISP ("x-ctrl-keysym", Vx_ctrl_keysym, - doc: /* Which keys Emacs uses for the ctrl modifier. -This should be one of the symbols `ctrl', `alt', `hyper', `meta', -`super'. For example, `ctrl' means use the Ctrl_L and Ctrl_R keysyms. -The default is nil, which is the same as `ctrl'. */ ); + doc: /* SKIP: real doc in xterm.c. */); Vx_ctrl_keysym = Qnil; DEFVAR_LISP ("x-alt-keysym", Vx_alt_keysym, - doc: /* Which keys Emacs uses for the alt modifier. -This should be one of the symbols `ctrl', `alt', `hyper', `meta', -`super'. For example, `alt' means use the Alt_L and Alt_R keysyms. -The default is nil, which is the same as `alt'. */ ); + doc: /* SKIP: real doc in xterm.c. */); Vx_alt_keysym = Qnil; DEFVAR_LISP ("x-hyper-keysym", Vx_hyper_keysym, - doc: /* Which keys Emacs uses for the hyper modifier. -This should be one of the symbols `ctrl', `alt', `hyper', `meta', -`super'. For example, `hyper' means use the Hyper_L and Hyper_R -keysyms. The default is nil, which is the same as `hyper'. */ ); + doc: /* SKIP: real doc in xterm.c. */); Vx_hyper_keysym = Qnil; DEFVAR_LISP ("x-meta-keysym", Vx_meta_keysym, - doc: /* Which keys Emacs uses for the meta modifier. -This should be one of the symbols `ctrl', `alt', `hyper', `meta', -`super'. For example, `meta' means use the Meta_L and Meta_R keysyms. -The default is nil, which is the same as `meta'. */ ); + doc: /* SKIP: real doc in xterm.c. */); Vx_meta_keysym = Qnil; DEFVAR_LISP ("x-super-keysym", Vx_super_keysym, - doc: /* Which keys Emacs uses for the super modifier. -This should be one of the symbols `ctrl', `alt', `hyper', `meta', -`super'. For example, `super' means use the Super_L and Super_R -keysyms. The default is nil, which is the same as `super'. */ ); + doc: /* SKIP: real doc in xterm.c. */); Vx_super_keysym = Qnil; - /* TODO: move to common code */ - DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, - doc: /* Which toolkit scroll bars Emacs uses, if any. -A value of nil means Emacs doesn't use toolkit scroll bars. -With the X Window system, the value is a symbol describing the -X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. -With MS Windows or Nextstep, the value is t. */ ); - /* Vx_toolkit_scroll_bars = Qt; */ - Vx_toolkit_scroll_bars = intern_c_string ("gtk"); + DEFVAR_BOOL ("x-use-underline-position-properties", + x_use_underline_position_properties, + doc: /* SKIP: real doc in xterm.c. */); + x_use_underline_position_properties = 1; - DEFVAR_BOOL ("x-use-underline-position-properties", x_use_underline_position_properties, - doc: /*Non-nil means make use of UNDERLINE_POSITION font properties. -A value of nil means ignore them. If you encounter fonts with bogus -UNDERLINE_POSITION font properties, for example 7x13 on XFree prior -to 4.1, set this to nil. */); - x_use_underline_position_properties = 0; - - DEFVAR_BOOL ("x-underline-at-descent-line", x_underline_at_descent_line, - doc: /* Non-nil means to draw the underline at the same place as the descent line. -A value of nil means to draw the underline according to the value of the -variable `x-use-underline-position-properties', which is usually at the -baseline level. The default value is nil. */); + DEFVAR_BOOL ("x-underline-at-descent-line", + x_underline_at_descent_line, + doc: /* SKIP: real doc in xterm.c. */); x_underline_at_descent_line = 0; - DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move, - doc: /* Non-nil means rely on gtk_window_move to set frame positions. -If this variable is t (the default), the GTK build uses the function -gtk_window_move to set or store frame positions and disables some time -consuming frame position adjustments. In newer versions of GTK, Emacs -always uses gtk_window_move and ignores the value of this variable. */); - x_gtk_use_window_move = true; - + DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars, + doc: /* SKIP: real doc in xterm.c. */); + Vx_toolkit_scroll_bars = intern_c_string ("gtk"); DEFVAR_LISP ("pgtk-wait-for-event-timeout", Vpgtk_wait_for_event_timeout, - doc: /* How long to wait for X events. + doc: /* How long to wait for GTK events. -Emacs will wait up to this many seconds to receive X events after -making changes which affect the state of the graphical interface. -Under some window managers this can take an indefinite amount of time, -so it is important to limit the wait. +Emacs will wait up to this many seconds to receive some GTK events +after making changes which affect the state of the graphical +interface. Under some window managers this can take an indefinite +amount of time, so it is important to limit the wait. If set to a non-float value, there will be no wait at all. */); Vpgtk_wait_for_event_timeout = make_float (0.1); commit 905dad0a3186a464d0c7d249cb185e55be43dfd7 Author: Po Lu Date: Mon Feb 7 09:56:55 2022 +0800 * doc/emacs/xresources.texi (Table of Resources): Improve wording. diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index c7c6c072ee..893fef16ed 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -375,14 +375,14 @@ displaying the preview text. @item @code{synchronizeResize} (class @code{SynchronizeResize}) If @samp{off} or @samp{false}, Emacs will not try to tell the window -manager when it has finished redrawing the display in response to a -request to resize a frame. Otherwise, the window manager will -postpone drawing a frame that was just resized until its contents are -updated, which prevents blank areas of a frame that have not yet been -painted from being displayed. If set to @samp{extended}, it will -enable use of extended frame synchronization, which might be supported -by some compositing window managers which don't support basic -synchronization. +manager when it has finished redrawing the display in response to a a +frame being resized. Otherwise, the window manager will postpone +drawing a frame that was just resized until its contents are updated, +which prevents blank areas of a frame that have not yet been painted +from being displayed. If set to @samp{extended}, it will enable use +of an alternative frame synchronization protocol, which might be +supported by some compositing window managers that don't support the +protocol Emacs uses by default. @item @code{verticalScrollBars} (class @code{ScrollBars}) Give frames scroll bars on the left if @samp{left}, on the right if commit 011fa3a4cb6407603f3a77511977b9563f3438ba Author: Po Lu Date: Mon Feb 7 09:42:08 2022 +0800 Correct implementation of extended frame synchronization * src/xterm.c (handle_one_xevent): Use value provided in the extended synchronization message as the current counter value. diff --git a/src/xterm.c b/src/xterm.c index 167e3a44d2..d3d8dc468c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9139,7 +9139,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, FRAME_X_OUTPUT (f)->sync_end_pending_p = true; } else if (event->xclient.data.l[4] == 1) - FRAME_X_OUTPUT (f)->ext_sync_end_pending_p = true; + { + XSyncIntsToValue (&FRAME_X_OUTPUT (f)->current_extended_counter_value, + event->xclient.data.l[2], event->xclient.data.l[3]); + FRAME_X_OUTPUT (f)->ext_sync_end_pending_p = true; + } *finish = X_EVENT_DROP; goto done; commit 838da4aef8768ff74c419e0ecd6498b9dad24641 Author: Lars Ingebrigtsen Date: Mon Feb 7 01:31:15 2022 +0100 Make dired-directory and dired-subdir-alist buffer-local * lisp/dired.el (dired-directory): (dired-subdir-alist): Make buffer-local (bug#7118) (dired-readin): (dired-mode): * lisp/dired-x.el (dired-virtual): Adjust usage. * lisp/locate.el (locate-mode): * lisp/find-lisp.el (find-lisp-find-dired-internal): * lisp/find-dired.el (find-dired): Adjust usage. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index bdf416b3ed..56036b6c16 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -639,8 +639,8 @@ you can relist single subdirs using \\[dired-do-redisplay]." ":\n")) (dired-mode dirname (or switches dired-listing-switches)) (setq mode-name "Virtual Dired" - revert-buffer-function 'dired-virtual-revert) - (setq-local dired-subdir-alist nil) + revert-buffer-function 'dired-virtual-revert + dired-subdir-alist nil) (dired-build-subdir-alist) (goto-char (point-min)) (dired-initial-position dirname)) diff --git a/lisp/dired.el b/lisp/dired.el index 5f1bfef12c..bca3018923 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -408,7 +408,7 @@ action argument symbol is `window-height' and its value is nil." "24.3") (defvar dired-file-version-alist) ;;;###autoload -(defvar dired-directory nil +(defvar-local dired-directory nil "The directory name or wildcard spec that this Dired directory lists. Local to each Dired buffer. May be a list, in which case the car is the directory name and the cdr is the list of files to mention. @@ -455,7 +455,7 @@ The directory name must be absolute, but need not be fully expanded.") (defvar dired-re-dot "^.* \\.\\.?/?$") ;; The subdirectory names in the next two lists are expanded. -(defvar dired-subdir-alist nil +(defvar-local dired-subdir-alist nil "Alist of listed directories and their buffer positions. Alist elements have the form (DIRNAME . STARTMARKER), where DIRNAME is the absolute name of the directory and STARTMARKER is @@ -1336,7 +1336,7 @@ wildcards, erases the buffer, and builds the subdir-alist anew (goto-char (point-min)) ;; Must first make alist buffer local and set it to nil because ;; dired-build-subdir-alist will call dired-clear-alist first - (setq-local dired-subdir-alist nil) + (setq dired-subdir-alist nil) (dired-build-subdir-alist)) (let ((attributes (file-attributes dirname))) (if (eq (car attributes) t) @@ -2365,7 +2365,7 @@ Keybindings: (setq-local buffer-stale-function #'dired-buffer-stale-p) (setq-local buffer-auto-revert-by-notification t) (setq-local page-delimiter "\n\n") - (setq-local dired-directory (or dirname default-directory)) + (setq dired-directory (or dirname default-directory)) ;; list-buffers uses this to display the dir being edited in this buffer. (setq list-buffers-directory (expand-file-name (if (listp dired-directory) diff --git a/lisp/find-dired.el b/lisp/find-dired.el index c67138a800..c04545e44e 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -234,8 +234,8 @@ it finishes, type \\[kill-find]." (dired-simple-subdir-alist) ;; else we have an ancient tree dired (or classic dired, where ;; this does no harm) - (setq-local dired-subdir-alist - (list (cons default-directory (point-min-marker))))) + (setq dired-subdir-alist + (list (cons default-directory (point-min-marker))))) (setq-local dired-subdir-switches find-ls-subdir-switches) (setq buffer-read-only nil) ;; Subdir headlerline must come first because the first marker in diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el index d4d899aced..0a712c0b81 100644 --- a/lisp/find-lisp.el +++ b/lisp/find-lisp.el @@ -231,8 +231,8 @@ It is a function which takes two arguments, the directory and its parent." (dired-simple-subdir-alist) ;; else we have an ancient tree dired (or classic dired, where ;; this does no harm) - (setq-local dired-subdir-alist - (list (cons default-directory (point-min-marker))))) + (setq dired-subdir-alist + (list (cons default-directory (point-min-marker))))) (find-lisp-insert-directory dir file-predicate directory-predicate 'ignore) (goto-char (point-min)) diff --git a/lisp/locate.el b/lisp/locate.el index 95b66f275a..d4847b9c05 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -461,13 +461,11 @@ Specific `locate-mode' commands, such as \\[locate-find-directory], do not work in subdirectories. \\{locate-mode-map}" - ;; Avoid clobbering this variable - (make-local-variable 'dired-subdir-alist) (setq default-directory "/" buffer-read-only t) (add-to-invisibility-spec '(dired . t)) (dired-alist-add-1 default-directory (point-min-marker)) - (setq-local dired-directory "/") + (setq dired-directory "/") (setq-local dired-subdir-switches locate-ls-subdir-switches) (setq dired-switches-alist nil) ;; This should support both Unix and Windoze style names commit 69efc36c6beae586ca9ec429229f35bcc5c69b5b Author: Stefan Monnier Date: Sun Feb 6 19:20:36 2022 -0500 Fix eval-tests/backtrace-in-batch-mode test * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Fix the zero-arg case. diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index e233e09e29..85ed5f2176 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -53,10 +53,11 @@ of the build process." (progn (princ " (") (setq args (cons func args)))) - (while (progn - (prin1 (car args)) - (setq args (cdr args))) - (princ " ")) + (if args + (while (progn + (prin1 (car args)) + (setq args (cdr args))) + (princ " "))) (princ ")\n")))))) (defalias 'debug-early commit 0d36eaa7c6112ee4fb86f7cbf578a7ba0b5dc331 Author: Lars Ingebrigtsen Date: Mon Feb 7 00:26:25 2022 +0100 Make async connect_network_socket failures use Qfailed * src/process.c (connect_network_socket): Mark the process as Qfailed instead of using the error symbol (since this is what's defined for the status) (bug#53814). diff --git a/src/process.c b/src/process.c index 7c7f608284..e912595393 100644 --- a/src/process.c +++ b/src/process.c @@ -3599,7 +3599,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, { Lisp_Object data = get_file_errno_data (err, contact, xerrno); - pset_status (p, list2 (Fcar (data), Fcdr (data))); + pset_status (p, list2 (Qfailed, data)); unbind_to (count, Qnil); return; } commit dcb3b85ec7689a032a308951203f4fa98f93a7a5 Author: Bob Rogers Date: Mon Feb 7 00:08:36 2022 +0100 Remove outdated comments from ietf-drums.el * lisp/mail/ietf-drums.el: Remove outdated comments (bug#53811). diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 473f95ca50..db77aba172 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -25,16 +25,6 @@ ;; library is based on draft-ietf-drums-msg-fmt-05.txt, released on ;; 1998-08-05. -;; Pending a real regression self test suite, Simon Josefsson added -;; various self test expressions snipped from bug reports, and their -;; expected value, below. I you believe it could be useful, please -;; add your own test cases, or write a real self test suite, or just -;; remove this. - -;; -;; (ietf-drums-parse-address "'foo' ") -;; => ("foo@example.com" . "'foo'") - ;;; Code: (eval-when-compile (require 'cl-lib)) commit e9ba08be215f88868d9e8c7ef736b0eb83d6ddff Author: Ioannis Kappas Date: Sun Feb 6 23:54:07 2022 +0100 ansi-color: don't get stuck on \e * lisp/ansi-color.el (ansi-color--control-seq-fragment-regexp): New constant. * test/lisp/ansi-color-tests.el (ansi-color-incomplete-sequences-test): Test for \e that doesn't start a valid ANSI escape sequence (bug#53808). Code amended (and test code written) by . Code by Ioannis Kappas is small enough to be Copyright-paperwork-exempt: yes diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 3973d9db08..b273e1f634 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -347,6 +347,10 @@ version of that color." "\e\\[[\x30-\x3F]*[\x20-\x2F]*[\x40-\x7E]" "Regexp matching an ANSI control sequence.") +(defconst ansi-color--control-seq-fragment-regexp + "\e\\[[\x30-\x3F]*[\x20-\x2F]*\\|\e" + "Regexp matching a partial ANSI control sequence.") + (defconst ansi-color-parameter-regexp "\\([0-9]*\\)[m;]" "Regexp that matches SGR control sequence parameters.") @@ -492,7 +496,11 @@ This function can be added to `comint-preoutput-filter-functions'." ;; save context, add the remainder of the string to the result (let ((fragment "")) (push (substring string start - (if (string-match "\033" string start) + (if (string-match + (concat "\\(?:" + ansi-color--control-seq-fragment-regexp + "\\)\\'") + string start) (let ((pos (match-beginning 0))) (setq fragment (substring string pos)) pos) @@ -549,7 +557,9 @@ This function can be added to `comint-preoutput-filter-functions'." (put-text-property start (length string) 'font-lock-face face string)) ;; save context, add the remainder of the string to the result - (if (string-match "\033" string start) + (if (string-match + (concat "\\(?:" ansi-color--control-seq-fragment-regexp "\\)\\'") + string start) (let ((pos (match-beginning 0))) (setcar (cdr context) (substring string pos)) (push (substring string start pos) result)) @@ -685,7 +695,11 @@ it will override BEGIN, the start of the region. Set (while (re-search-forward ansi-color-control-seq-regexp end-marker t) (delete-region (match-beginning 0) (match-end 0))) ;; save context, add the remainder of the string to the result - (if (re-search-forward "\033" end-marker t) + (set-marker start (point)) + (while (re-search-forward ansi-color--control-seq-fragment-regexp + end-marker t)) + (if (and (/= (point) start) + (= (point) end-marker)) (set-marker start (match-beginning 0)) (set-marker start nil))))) @@ -742,10 +756,12 @@ being deleted." ;; Otherwise, strip. (delete-region esc-beg esc-end)))) ;; search for the possible start of a new escape sequence - (if (re-search-forward "\033" end-marker t) + (while (re-search-forward ansi-color--control-seq-fragment-regexp + end-marker t)) + (if (and (/= (point) start-marker) + (= (point) end-marker)) (progn - (while (re-search-forward "\033" end-marker t)) - (backward-char) + (goto-char (match-beginning 0)) (funcall ansi-color-apply-face-function start-marker (point) (ansi-color--face-vec-face face-vec)) diff --git a/test/lisp/ansi-color-tests.el b/test/lisp/ansi-color-tests.el index 71b706c763..2ff7fc6aaf 100644 --- a/test/lisp/ansi-color-tests.el +++ b/test/lisp/ansi-color-tests.el @@ -171,7 +171,25 @@ strings with `eq', this function compares them with `equal'." (insert str) (ansi-color-apply-on-region opoint (point)))) (should (ansi-color-tests-equal-props - propertized-str (buffer-string)))))) + propertized-str (buffer-string)))) + + ;; \e not followed by '[' and invalid ANSI escape seqences + (dolist (fun (list ansi-filt ansi-app)) + (with-temp-buffer + (should (equal (funcall fun "\e") "")) + (should (equal (funcall fun "\e[33m test \e[0m") + (with-temp-buffer + (concat "\e" (funcall fun "\e[33m test \e[0m")))))) + (with-temp-buffer + (should (equal (funcall fun "\e[") "")) + (should (equal (funcall fun "\e[33m Z \e[0m") + (with-temp-buffer + (concat "\e[" (funcall fun "\e[33m Z \e[0m")))))) + (with-temp-buffer + (should (equal (funcall fun "\e a \e\e[\e[") "\e a \e\e[")) + (should (equal (funcall fun "\e[33m Z \e[0m") + (with-temp-buffer + (concat "\e[" (funcall fun "\e[33m Z \e[0m"))))))))) (provide 'ansi-color-tests) commit bff8354ec4d63a5073c12fc531f8584ed06f0ebc Author: Stefan Monnier Date: Sun Feb 6 13:06:22 2022 -0500 (debug-early-backtrace): Tweak the non-evald output * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the non-evald output more like what is used in `debug.el`. diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index a81b29d105..e233e09e29 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -31,6 +31,8 @@ ;; 29, before which there was no backtrace available during early ;; bootstrap. +;;; Code: + (defalias 'debug-early-backtrace #'(lambda () "Print a trace of Lisp function calls currently active. commit e95ca5cf071ba66300994f031408539218664a58 Author: Stefan Monnier Date: Sun Feb 6 13:04:35 2022 -0500 (debug-early-backtrace): Tweak the non-evald output * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the non-evald output more like what is used in `debug.el`. diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index e557643e46..a81b29d105 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -47,18 +47,15 @@ of the build process." (progn (princ " ") (prin1 func) - (princ "(") - (while args - (prin1 (car args)) - (setq args (cdr args)) - (if args - (princ " "))) - (princ ")\n")) - (while args - (princ " ") - (prin1 (car args)) - (princ "\n") - (setq args (cdr args))))))))) + (princ "(")) + (progn + (princ " (") + (setq args (cons func args)))) + (while (progn + (prin1 (car args)) + (setq args (cdr args))) + (princ " ")) + (princ ")\n")))))) (defalias 'debug-early #'(lambda (&rest args) commit 0f38e2393dd3f1731f6d1d7bc098a1c774eb6800 Author: Juri Linkov Date: Sun Feb 6 19:58:43 2022 +0200 Use mode-line-window-selected-p in tab-line-tab-name-format-default. * lisp/tab-line.el (tab-line-tab-name-format-default): Use the recently added function 'mode-line-window-selected-p' for the face 'tab-line-tab-current' (bug#53629). diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 24033945f0..4d9b5e0ab7 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -486,7 +486,7 @@ which the tab will represent." (funcall tab-line-tab-name-function tab tabs) (cdr (assq 'name tab)))) (face (if selected-p - (if (eq (selected-window) (old-selected-window)) + (if (mode-line-window-selected-p) 'tab-line-tab-current 'tab-line-tab) 'tab-line-tab-inactive))) commit 1efc94e7ce01ee4cfecb8576739326227c814ba6 Author: Juri Linkov Date: Sun Feb 6 19:55:03 2022 +0200 * lisp/tab-bar.el (tab-bar-new-tab-choice): Add const 'window'. Update doc. (tab-bar-new-tab-to): Remove window parameters 'window-side' and 'window-atom' from the old window. Move split-window/delete-window inside ignore-window-parameters (bug#53662). diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 06ad8f60af..0910502758 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -474,6 +474,9 @@ you can use the command `toggle-frame-tab-bar'." If t, start a new tab with the current buffer, i.e. the buffer that was current before calling the command that adds a new tab (this is the same what `make-frame' does by default). +If the value is the symbol `window', then keep the selected +window as a single window on the new tab, and keep all its +window parameters except 'window-atom' and 'window-side'. If the value is a string, use it as a buffer name to switch to if such buffer exists, or switch to a buffer visiting the file or directory that the string specifies. If the value is a function, @@ -481,6 +484,7 @@ call it with no arguments and switch to the buffer that it returns. If nil, duplicate the contents of the tab that was active before calling the command that adds a new tab." :type '(choice (const :tag "Current buffer" t) + (const :tag "Current window" window) (string :tag "Buffer" "*scratch*") (directory :tag "Directory" :value "~/") (file :tag "File" :value "~/.emacs") @@ -1361,12 +1365,17 @@ After the tab is created, the hooks in ;; Handle the case when it's called in the active minibuffer. (when (minibuffer-selected-window) (select-window (minibuffer-selected-window))) + ;; Remove window parameters that can cause problems + ;; with `delete-other-windows' and `split-window'. + (set-window-parameter nil 'window-atom nil) + (set-window-parameter nil 'window-side nil) (let ((ignore-window-parameters t)) - (delete-other-windows)) - (unless (eq tab-bar-new-tab-choice 'window) - ;; Create a new window to get rid of old window parameters - ;; (e.g. prev/next buffers) of old window. - (split-window) (delete-window)) + (delete-other-windows) + (unless (eq tab-bar-new-tab-choice 'window) + ;; Create a new window to get rid of old window parameters + ;; (e.g. prev/next buffers) of old window. + (split-window) (delete-window))) + (let ((buffer (if (functionp tab-bar-new-tab-choice) (funcall tab-bar-new-tab-choice) commit 8b35f64ff90adcbb55bb9fe9a0871b99a873200a Author: Michael Albinus Date: Sun Feb 6 18:50:16 2022 +0100 Adapt em-tramp-tests.el * test/lisp/eshell/em-tramp-tests.el (tramp): Require. (em-tramp-test/su-default, em-tramp-test/su-user) (em-tramp-test/su-login, em-tramp-test/sudo-basic) (em-tramp-test/sudo-user): Adapt tests. diff --git a/test/lisp/eshell/em-tramp-tests.el b/test/lisp/eshell/em-tramp-tests.el index 7f054da514..8969c1e229 100644 --- a/test/lisp/eshell/em-tramp-tests.el +++ b/test/lisp/eshell/em-tramp-tests.el @@ -21,6 +21,7 @@ (require 'ert) (require 'em-tramp) +(require 'tramp) (ert-deftest em-tramp-test/su-default () "Test Eshell `su' command with no arguments." @@ -29,7 +30,8 @@ `(eshell-trap-errors (eshell-named-command "cd" - (list ,(format "/su:root@localhost:%s" default-directory))))))) + (list ,(format "/su:root@%s:%s" + tramp-default-host default-directory))))))) (ert-deftest em-tramp-test/su-user () "Test Eshell `su' command with USER argument." @@ -38,7 +40,8 @@ `(eshell-trap-errors (eshell-named-command "cd" - (list ,(format "/su:USER@localhost:%s" default-directory))))))) + (list ,(format "/su:USER@%s:%s" + tramp-default-host default-directory))))))) (ert-deftest em-tramp-test/su-login () "Test Eshell `su' command with -/-l/--login option." @@ -50,7 +53,7 @@ `(eshell-trap-errors (eshell-named-command "cd" - (list "/su:root@localhost:~/"))))))) + (list ,(format "/su:root@%s:~/" tramp-default-host)))))))) (defun mock-eshell-named-command (&rest args) "Dummy function to test Eshell `sudo' command rewriting." @@ -62,11 +65,11 @@ #'mock-eshell-named-command)) (should (equal (catch 'eshell-external (eshell/sudo "echo" "hi")) - `(,(format "/sudo:root@localhost:%s" default-directory) + `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory) ("echo" ("hi"))))) (should (equal (catch 'eshell-external (eshell/sudo "echo" "-u" "hi")) - `(,(format "/sudo:root@localhost:%s" default-directory) + `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory) ("echo" ("-u" "hi"))))))) (ert-deftest em-tramp-test/sudo-user () @@ -75,11 +78,11 @@ #'mock-eshell-named-command)) (should (equal (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "hi")) - `(,(format "/sudo:USER@localhost:%s" default-directory) + `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory) ("echo" ("hi"))))) (should (equal (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "-u" "hi")) - `(,(format "/sudo:USER@localhost:%s" default-directory) + `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory) ("echo" ("-u" "hi"))))))) ;;; em-tramp-tests.el ends here commit 1850121629d19515130225232bbc020a168aee2e Author: Mattias EngdegÄrd Date: Sun Feb 6 17:58:54 2022 +0100 Avoid deprecation warning in NS-specific code * src/macfont.m (mac_font_create_preferred_family_for_attributes): CTGetCoreTextVersion is obsolete and its use elicits a warning in macOS 11.6; use NSProcessInfo instead. diff --git a/src/macfont.m b/src/macfont.m index f623c3ca2f..34e48afb98 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -3570,7 +3570,10 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no if (languages && CFArrayGetCount (languages) > 0) { - if (CTGetCoreTextVersion () >= kCTVersionNumber10_9) + if ([[NSProcessInfo processInfo] + isOperatingSystemAtLeastVersion: + ((NSOperatingSystemVersion){ + .majorVersion = 10, .minorVersion = 9})]) values[num_values++] = CFArrayGetValueAtIndex (languages, 0); else { commit ead36d8d36553f7f7bbed1dd3d28eda926c51bac Author: Mattias EngdegÄrd Date: Sun Feb 6 17:57:46 2022 +0100 ; * src/alloc.c (mark_memory): Fix outdated comment. diff --git a/src/alloc.c b/src/alloc.c index e01ea36e64..5d7b484f6e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4925,8 +4925,8 @@ mark_maybe_pointer (void *p, bool symbol_only) miss objects if __alignof__ were used. */ #define GC_POINTER_ALIGNMENT alignof (void *) -/* Mark Lisp objects referenced from the address range START+OFFSET..END - or END+OFFSET..START. */ +/* Mark Lisp objects referenced from the address range START..END + or END..START. */ static void ATTRIBUTE_NO_SANITIZE_ADDRESS mark_memory (void const *start, void const *end) commit b0fd3ec2c0131e79b1c62e1f1beb6f29cf076120 Author: Po Lu Date: Sun Feb 6 13:08:06 2022 +0000 Ensure bar cursors are always visible on Haiku * src/haikuterm.c (haiku_draw_window_cursor): Adjust bar cursor colors like X. diff --git a/src/haikuterm.c b/src/haikuterm.c index 2436558e31..0c7e08585e 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -1687,7 +1687,7 @@ haiku_draw_window_cursor (struct window *w, int cursor_width, bool on_p, bool active_p) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - + struct face *face; struct glyph *phys_cursor_glyph; struct glyph *cursor_glyph; @@ -1741,7 +1741,26 @@ haiku_draw_window_cursor (struct window *w, BView_draw_lock (view); BView_StartClip (view); - BView_SetHighColor (view, FRAME_CURSOR_COLOR (f).pixel); + + if (cursor_type == BAR_CURSOR) + { + cursor_glyph = get_phys_cursor_glyph (w); + face = FACE_FROM_ID (f, cursor_glyph->face_id); + } + + /* If the glyph's background equals the color we normally draw the + bar cursor in, our cursor in its normal color is invisible. Use + the glyph's foreground color instead in this case, on the + assumption that the glyph's colors are chosen so that the glyph + is legible. */ + + /* xterm.c only does this for bar cursors, and nobody has + complained, so it would be best to do that here as well. */ + if (cursor_type == BAR_CURSOR + && face->background == FRAME_CURSOR_COLOR (f).pixel) + BView_SetHighColor (view, face->foreground); + else + BView_SetHighColor (view, FRAME_CURSOR_COLOR (f).pixel); haiku_clip_to_row (w, glyph_row, TEXT_AREA); switch (cursor_type) @@ -1754,7 +1773,6 @@ haiku_draw_window_cursor (struct window *w, BView_FillRectangle (view, fx, fy, w->phys_cursor_width, h); break; case BAR_CURSOR: - cursor_glyph = get_phys_cursor_glyph (w); if (cursor_glyph->resolved_level & 1) BView_FillRectangle (view, fx + cursor_glyph->pixel_width - w->phys_cursor_width, fy, w->phys_cursor_width, h); commit dc5930ba973c9d921e9124b7afa1a65bba568b45 Author: Po Lu Date: Sun Feb 6 20:10:46 2022 +0800 Fix the GTK 2 build * src/gtkutil.c (xg_filter_key): Remove call to GTK3-only function without GTK 3. * src/xfns.c (select_visual): Avoid 32-bit visuals on GTK 2. diff --git a/src/gtkutil.c b/src/gtkutil.c index 2b5f78aa32..6912ea1e96 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4055,7 +4055,7 @@ xg_update_frame_menubar (struct frame *f) gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req); req.height *= xg_get_scale (f); -#ifndef HAVE_PGTK +#if !defined HAVE_PGTK && defined HAVE_GTK3 if (FRAME_DISPLAY_INFO (f)->n_planes == 32) { GdkScreen *screen = gtk_widget_get_screen (x->menubar_widget); @@ -6387,8 +6387,10 @@ xg_filter_key (struct frame *frame, XEvent *xkey) NULL, NULL, &consumed); xg_add_virtual_mods (dpyinfo, &xg_event->key); xg_event->key.state &= ~consumed; +#if GTK_CHECK_VERSION (3, 6, 0) xg_event->key.is_modifier = gdk_x11_keymap_key_is_modifier (keymap, xg_event->key.hardware_keycode); +#endif } #endif diff --git a/src/xfns.c b/src/xfns.c index 2b8a1abdfe..7878ee62f5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6508,7 +6508,7 @@ select_visual (struct x_display_info *dpyinfo) vinfo_template.screen = XScreenNumberOfScreen (screen); -#if !defined USE_X_TOOLKIT +#if !defined USE_X_TOOLKIT && !(defined USE_GTK && !defined HAVE_GTK3) /* First attempt to use 32-bit visual if available */ vinfo_template.depth = 32; commit 37751569902a8c1073bea64059f01540221d7361 Author: Po Lu Date: Sun Feb 6 19:51:05 2022 +0800 Disable extended frame synchronization by default * doc/emacs/xresources.texi (Table of Resources): Document new possible value of `synchronizeResize'. * src/xfns.c (Fx_create_frame): Set synchronization protocol according to `synchronizeResize'. diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index 5e01c955d1..c7c6c072ee 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -379,7 +379,10 @@ manager when it has finished redrawing the display in response to a request to resize a frame. Otherwise, the window manager will postpone drawing a frame that was just resized until its contents are updated, which prevents blank areas of a frame that have not yet been -painted from being displayed. +painted from being displayed. If set to @samp{extended}, it will +enable use of extended frame synchronization, which might be supported +by some compositing window managers which don't support basic +synchronization. @item @code{verticalScrollBars} (class @code{ScrollBars}) Give frames scroll bars on the left if @samp{left}, on the right if diff --git a/src/xfns.c b/src/xfns.c index 1ed4f03205..2b8a1abdfe 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4815,15 +4815,25 @@ This function is an internal primitive--use `make-frame' instead. */) XSyncValue initial_value; XSyncCounter counters[2]; + AUTO_STRING (synchronizeResize, "synchronizeResize"); + AUTO_STRING (SynchronizeResize, "SynchronizeResize"); + + Lisp_Object value = gui_display_get_resource (dpyinfo, + synchronizeResize, + SynchronizeResize, + Qnil, Qnil); + XSyncIntToValue (&initial_value, 0); counters[0] = FRAME_X_BASIC_COUNTER (f) = XSyncCreateCounter (FRAME_X_DISPLAY (f), initial_value); - counters[1] - = FRAME_X_EXTENDED_COUNTER (f) - = XSyncCreateCounter (FRAME_X_DISPLAY (f), - initial_value); + + if (STRINGP (value) && !strcmp (SSDATA (value), "extended")) + counters[1] + = FRAME_X_EXTENDED_COUNTER (f) + = XSyncCreateCounter (FRAME_X_DISPLAY (f), + initial_value); FRAME_X_OUTPUT (f)->current_extended_counter_value = initial_value; @@ -4831,7 +4841,9 @@ This function is an internal primitive--use `make-frame' instead. */) XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), dpyinfo->Xatom_net_wm_sync_request_counter, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *) &counters, 2); + (unsigned char *) &counters, + ((STRINGP (value) + && !strcmp (SSDATA (value), "extended")) ? 2 : 1)); #endif } #endif commit 30c6074d5a8ba16cab90528f703039c2eddf82c1 Author: Po Lu Date: Sun Feb 6 18:53:22 2022 +0800 Add support for EWMH extended frame synchronization * src/xfns.c (Fx_create_frame): Populate both counter variables. * src/xterm.c (XTframe_up_to_date): (handle_one_xevent): Support extended synchronization. (x_free_frame_resources): Destroy extended counter. (x_term_init): Intern new atom _NET_WM_FRAME_DRAWN. * src/xterm.h (struct x_display_info): New atom `_NET_WM_FRAME_DRAWN'. (struct x_output): New fields for extended counter tracking. (FRAME_X_EXTENDED_COUNTER): New macro. diff --git a/src/xfns.c b/src/xfns.c index 51e4ed0e2f..1ed4f03205 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4813,15 +4813,25 @@ This function is an internal primitive--use `make-frame' instead. */) { #ifndef HAVE_GTK3 XSyncValue initial_value; + XSyncCounter counters[2]; XSyncIntToValue (&initial_value, 0); - FRAME_X_BASIC_COUNTER (f) = XSyncCreateCounter (FRAME_X_DISPLAY (f), - initial_value); + counters[0] + = FRAME_X_BASIC_COUNTER (f) + = XSyncCreateCounter (FRAME_X_DISPLAY (f), + initial_value); + counters[1] + = FRAME_X_EXTENDED_COUNTER (f) + = XSyncCreateCounter (FRAME_X_DISPLAY (f), + initial_value); + + FRAME_X_OUTPUT (f)->current_extended_counter_value + = initial_value; XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), dpyinfo->Xatom_net_wm_sync_request_counter, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *) &FRAME_X_BASIC_COUNTER (f), 1); + (unsigned char *) &counters, 2); #endif } #endif diff --git a/src/xterm.c b/src/xterm.c index 67b9f5b38c..167e3a44d2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1856,13 +1856,33 @@ XTframe_up_to_date (struct frame *f) #ifdef HAVE_XSYNC if (FRAME_X_OUTPUT (f)->sync_end_pending_p - && FRAME_X_BASIC_COUNTER (f)) + && FRAME_X_BASIC_COUNTER (f) != None) { XSyncSetCounter (FRAME_X_DISPLAY (f), FRAME_X_BASIC_COUNTER (f), FRAME_X_OUTPUT (f)->pending_basic_counter_value); FRAME_X_OUTPUT (f)->sync_end_pending_p = false; } + + if (FRAME_X_OUTPUT (f)->ext_sync_end_pending_p + && FRAME_X_EXTENDED_COUNTER (f) != None) + { + XSyncValue add; + Bool overflow_p; + + XSyncIntToValue (&add, 1); + XSyncValueAdd (&FRAME_X_OUTPUT (f)->current_extended_counter_value, + add, add, &overflow_p); + + if (overflow_p) + emacs_abort (); + + XSyncSetCounter (FRAME_X_DISPLAY (f), + FRAME_X_EXTENDED_COUNTER (f), + FRAME_X_OUTPUT (f)->current_extended_counter_value); + + FRAME_X_OUTPUT (f)->ext_sync_end_pending_p = false; + } #endif unblock_input (); } @@ -9112,9 +9132,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (f) { - XSyncIntsToValue (&FRAME_X_OUTPUT (f)->pending_basic_counter_value, - event->xclient.data.l[2], event->xclient.data.l[3]); - FRAME_X_OUTPUT (f)->sync_end_pending_p = true; + if (event->xclient.data.l[4] == 0) + { + XSyncIntsToValue (&FRAME_X_OUTPUT (f)->pending_basic_counter_value, + event->xclient.data.l[2], event->xclient.data.l[3]); + FRAME_X_OUTPUT (f)->sync_end_pending_p = true; + } + else if (event->xclient.data.l[4] == 1) + FRAME_X_OUTPUT (f)->ext_sync_end_pending_p = true; *finish = X_EVENT_DROP; goto done; @@ -14788,6 +14813,10 @@ x_free_frame_resources (struct frame *f) if (FRAME_X_BASIC_COUNTER (f) != None) XSyncDestroyCounter (FRAME_X_DISPLAY (f), FRAME_X_BASIC_COUNTER (f)); + + if (FRAME_X_EXTENDED_COUNTER (f) != None) + XSyncDestroyCounter (FRAME_X_DISPLAY (f), + FRAME_X_EXTENDED_COUNTER (f)); #endif unload_color (f, FRAME_FOREGROUND_PIXEL (f)); @@ -15993,6 +16022,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) ATOM_REFS_INIT ("_NET_WORKAREA", Xatom_net_workarea) ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST", Xatom_net_wm_sync_request) ATOM_REFS_INIT ("_NET_WM_SYNC_REQUEST_COUNTER", Xatom_net_wm_sync_request_counter) + ATOM_REFS_INIT ("_NET_WM_FRAME_DRAWN", Xatom_net_wm_frame_drawn) /* Session management */ ATOM_REFS_INIT ("SM_CLIENT_ID", Xatom_SM_CLIENT_ID) ATOM_REFS_INIT ("_XSETTINGS_SETTINGS", Xatom_xsettings_prop) diff --git a/src/xterm.h b/src/xterm.h index 25ea257b51..d3678054a8 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -503,7 +503,7 @@ struct x_display_info Xatom_net_wm_state_hidden, Xatom_net_wm_state_skip_taskbar, Xatom_net_frame_extents, Xatom_net_current_desktop, Xatom_net_workarea, Xatom_net_wm_opaque_region, Xatom_net_wm_ping, Xatom_net_wm_sync_request, - Xatom_net_wm_sync_request_counter; + Xatom_net_wm_sync_request_counter, Xatom_net_wm_frame_drawn; /* XSettings atoms and windows. */ Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; @@ -814,9 +814,12 @@ struct x_output #ifdef HAVE_XSYNC XSyncCounter basic_frame_counter; + XSyncCounter extended_frame_counter; XSyncValue pending_basic_counter_value; + XSyncValue current_extended_counter_value; - bool_bf sync_end_pending_p; + bool_bf sync_end_pending_p : 1; + bool_bf ext_sync_end_pending_p : 1; #endif /* Relief GCs, colors etc. */ @@ -983,6 +986,7 @@ extern void x_mark_frame_dirty (struct frame *f); #ifdef HAVE_XSYNC #define FRAME_X_BASIC_COUNTER(f) FRAME_X_OUTPUT (f)->basic_frame_counter +#define FRAME_X_EXTENDED_COUNTER(f) FRAME_X_OUTPUT (f)->extended_frame_counter #endif /* This is the Colormap which frame F uses. */ commit 8d4154742fbcbd9f12ddde8d6ea59cf03da866a3 Author: Eli Zaretskii Date: Sun Feb 6 12:34:14 2022 +0200 ; * etc/NEWS: Fix entry for 'find-library-include-other-files'. diff --git a/etc/NEWS b/etc/NEWS index c3313dc92b..cd5bd8b71c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -137,8 +137,9 @@ An autoload definition appears just as a (defun . NAME) and the --- ** New user option 'find-library-include-other-files'. -If non-nil, commands like 'M-x find-library' will only include library -files in the completion alternatives. +If set to nil, commands like 'M-x find-library' will only include library +files in the completion candidates. The default is t, which preserves +previous behavior, whereby non-library files could also be included. ** New command 'sqlite-mode-open-file' for examining an sqlite3 file. This uses the new 'sqlite-mode' which allows listing the tables in a commit 47ddaaab02b1011c6028442c9df0676393de9e99 Author: Eli Zaretskii Date: Sun Feb 6 12:26:36 2022 +0200 Fix infloop in 'redisplay_window' when buffer is narrowed * src/xdisp.c (redisplay_window): Ensure window-start point is in the accessible portion of the buffer when passing it to 'window_start_acceptable_p'. (Bug#14582) diff --git a/src/xdisp.c b/src/xdisp.c index db9bc512a9..cafc50e755 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -18754,9 +18754,8 @@ window_start_acceptable_p (Lisp_Object window, ptrdiff_t startp) struct text_pos ignored; /* Is STARTP in invisible text? */ - if (startp > BEGV - && ((invprop = Fget_char_property (startpos, Qinvisible, window)), - TEXT_PROP_MEANS_INVISIBLE (invprop) != 0)) + if ((invprop = Fget_char_property (startpos, Qinvisible, window)), + TEXT_PROP_MEANS_INVISIBLE (invprop) != 0) return false; /* Is STARTP covered by a replacing 'display' property? */ @@ -19285,10 +19284,12 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* If current starting point was originally the beginning of a line but no longer is, or if the starting point is invisible but the buffer wants it always visible, find a new starting point. */ - else if ((w->start_at_line_beg - && !(CHARPOS (startp) <= BEGV - || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n')) - || !window_start_acceptable_p (window, CHARPOS (startp))) + else if (w->start_at_line_beg + && ((CHARPOS (startp) > BEGV + && FETCH_BYTE (BYTEPOS (startp) - 1) != '\n') + || (CHARPOS (startp) >= BEGV + && CHARPOS (startp) <= ZV + && !window_start_acceptable_p (window, CHARPOS (startp))))) { #ifdef GLYPH_DEBUG debug_method_add (w, "recenter 1"); commit 6e5d79c048c6009c925f8d8f59b3b3e062ffc9d4 Author: Tassilo Horn Date: Sun Feb 6 11:10:08 2022 +0100 Display show-paren-context-when-offscreen in child frame * etc/NEWS: Extend section about the new `show-paren-context-when-offscreen' custom option. * lisp/paren.el (show-paren-context-when-offscreen): Allow special value `child-frame'. (show-paren-function): Handle `child-frame' value of `show-paren-context-when-offscreen'. (show-paren--context-child-frame): New defvar. (show-paren--context-child-frame-redirect-focus): New function. (show-paren--context-child-frame-buffer): New function. (show-paren--context-child-frame-parameters): New defvar. (show-paren--delete-context-child-frame): New function. (show-paren--show-context-in-child-frame): New function. diff --git a/etc/NEWS b/etc/NEWS index 6c5aeacb7b..c3313dc92b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -438,6 +438,11 @@ When non-nil, if the point is in a closing delimiter and the opening delimiter is offscreen, shows some context around the opening delimiter in the echo area. Default nil. +May also be set to the symbol 'child-frame' in which case the context +is shown in a child frame at the top left of the current window on +graphical frames. On non-graphical frames, the context is shown in +the echo area. + ** Comint +++ diff --git a/lisp/paren.el b/lisp/paren.el index 0065bba72e..b0a2eb8dc5 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -89,11 +89,21 @@ its position." :type 'boolean) (defcustom show-paren-context-when-offscreen nil - "If non-nil, show context in the echo area when the openparen is offscreen. + "If non-nil, show context around the opening paren if it is offscreen. The context is usually the line that contains the openparen, except if the openparen is on its own line, in which case the -context includes the previous nonblank line." - :type 'boolean +context includes the previous nonblank line. + +By default, the context is shown in the echo area. + +If set to the symbol `child-frame', the context is shown in a +child frame at the top left of the window. You might want to +customize the `child-frame-border' face (especially the +background color) to give the child frame a distinguished border. +On non-graphical frames, the context is shown in the echo area." + :type '(choice (const :tag "Off" nil) + (const :tag "In echo area" t) + (const :tag "Child frame" child-frame)) :version "29.1") (defvar show-paren--idle-timer nil) @@ -260,6 +270,103 @@ It is the default value of `show-paren-data-function'." (if (= dir 1) pos (1+ pos)) mismatch))))))) +(defvar show-paren--context-child-frame nil) + +(defun show-paren--context-child-frame-redirect-focus () + "Redirect focus from child frame." + (redirect-frame-focus + show-paren--context-child-frame + (frame-parent corfu--frame))) + +(defun show-paren--context-child-frame-buffer (text) + (with-current-buffer + (get-buffer-create " *show-paren context*") + ;; Redirect focus to parent. + (add-hook 'pre-command-hook + #'show-paren--delete-context-child-frame + nil t) + ;; Use an empty keymap. + (use-local-map (make-keymap)) + (dolist (var '((mode-line-format . nil) + (header-line-format . nil) + (tab-line-format . nil) + (tab-bar-format . nil) ;; Emacs 28 tab-bar-format + (frame-title-format . "") + (truncate-lines . t) + (cursor-in-non-selected-windows . nil) + (cursor-type . nil) + (show-trailing-whitespace . nil) + (display-line-numbers . nil) + (left-fringe-width . nil) + (right-fringe-width . nil) + (left-margin-width . 0) + (right-margin-width . 0) + (fringes-outside-margins . 0) + (buffer-read-only . t))) + (set (make-local-variable (car var)) (cdr var))) + (let ((inhibit-modification-hooks t) + (inhibit-read-only t)) + (erase-buffer) + (insert text) + (goto-char (point-min))) + (current-buffer))) + +(defvar show-paren--context-child-frame-parameters + `((visibility . nil) + (width . 0) (height . 0) + (min-width . t) (min-height . t) + (no-accept-focus . t) + (no-focus-on-map . t) + (border-width . 0) + (child-frame-border-width . 1) + (left-fringe . 0) + (right-fringe . 0) + (vertical-scroll-bars . nil) + (horizontal-scroll-bars . nil) + (menu-bar-lines . 0) + (tool-bar-lines . 0) + (tab-bar-lines . 0) + (no-other-frame . t) + (no-other-window . t) + (no-delete-other-windows . t) + (unsplittable . t) + (undecorated . t) + (cursor-type . nil) + (no-special-glyphs . t) + (desktop-dont-save . t))) + +(defun show-paren--delete-context-child-frame () + (when show-paren--context-child-frame + (delete-frame show-paren--context-child-frame)) + (remove-hook 'post-command-hook + #'show-paren--delete-context-child-frame)) + +(defun show-paren--show-context-in-child-frame (text) + "Show TEXT in a child-frame at the top-left of the current window." + (let ((minibuffer (minibuffer-window (window-frame))) + (buffer (show-paren--context-child-frame-buffer text)) + (x (window-pixel-left)) + (y (window-pixel-top)) + (window-min-height 1) + (window-min-width 1) + after-make-frame-functions) + (show-paren--delete-context-child-frame) + (setq show-paren--context-child-frame + (make-frame + `((parent-frame . ,(window-frame)) + (minibuffer . ,minibuffer) + ,@show-paren--context-child-frame-parameters))) + (let ((win (frame-root-window show-paren--context-child-frame))) + (set-window-buffer win buffer) + (set-window-dedicated-p win t) + (set-frame-size show-paren--context-child-frame + (string-width text) + (length (string-lines text))) + (set-frame-position show-paren--context-child-frame x y) + (make-frame-visible show-paren--context-child-frame) + (add-hook 'post-command-hook + #'show-paren--delete-context-child-frame)))) + (defun show-paren-function () "Highlight the parentheses until the next input arrives." (let ((data (and show-paren-mode (funcall show-paren-data-function)))) @@ -299,8 +406,8 @@ It is the default value of `show-paren-data-function'." ;; Otherwise, turn off any such highlighting. (if (or (not here-beg) (and (not show-paren-highlight-openparen) - (> here-end (point)) - (<= here-beg (point)) + (> here-end (point)) + (<= here-beg (point)) (integerp there-beg))) (delete-overlay show-paren--overlay-1) (move-overlay show-paren--overlay-1 @@ -315,7 +422,7 @@ It is the default value of `show-paren-data-function'." (delete-overlay show-paren--overlay) (if highlight-expression (move-overlay show-paren--overlay - (if (< there-beg here-beg) here-end here-beg) + (if (< there-beg here-beg) here-end here-beg) (if (< there-beg here-beg) there-beg there-end) (current-buffer)) (move-overlay show-paren--overlay @@ -330,7 +437,12 @@ It is the default value of `show-paren-data-function'." (let ((open-paren-line-string (blink-paren-open-paren-line-string openparen)) (message-log-max nil)) - (minibuffer-message "Matches %s" open-paren-line-string)))) + (if (and (eq show-paren-context-when-offscreen + 'child-frame) + (display-graphic-p)) + (show-paren--show-context-in-child-frame + open-paren-line-string) + (minibuffer-message "Matches %s" open-paren-line-string))))) ;; Always set the overlay face, since it varies. (overlay-put show-paren--overlay 'priority show-paren-priority) (overlay-put show-paren--overlay 'face face)))))) commit 372d0e0cc1fccddea94b6eebfb59967221a70778 Author: Michael Albinus Date: Sun Feb 6 09:43:13 2022 +0100 Make usage of su and sudo consistent in eshell (bug#53783) * lisp/eshell/em-tramp.el (eshell/su, eshell/sudo): Use `tramp-default-host' instead of "localhost". diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index 2afd4fe066..aebbc36e71 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -71,7 +71,7 @@ Become another USER during a login session.") (throw 'eshell-replace-command (let ((user "root") (host (or (file-remote-p default-directory 'host) - "localhost")) + tramp-default-host)) (dir (file-local-name (expand-file-name default-directory))) (prefix (file-remote-p default-directory))) (dolist (arg args) @@ -106,7 +106,7 @@ Execute a COMMAND as the superuser or another USER.") (throw 'eshell-external (let* ((user (or user "root")) (host (or (file-remote-p default-directory 'host) - "localhost")) + tramp-default-host)) (dir (file-local-name (expand-file-name default-directory))) (prefix (file-remote-p default-directory)) (default-directory