commit d90fd58c026b9007970730d431ae04b4925c30d7 (HEAD, refs/remotes/origin/master) Merge: 32dc552a53 821c240075 Author: Stefan Kangas Date: Sun Feb 6 06:49:39 2022 +0100 Merge from origin/emacs-28 821c240075 Fix ietf-drums-get-comment doc string 638247baa4 Fix typo in display.texi commit 32dc552a53586ec314b1271a2d4541b2e8d4838a Author: Po Lu Date: Sun Feb 6 13:40:21 2022 +0800 * lwlib/xlwmenu.c (pop_up_menu): Work around motion problems on XI2. diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 369162c7fe..8c5794c043 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -2742,4 +2742,6 @@ pop_up_menu (XlwMenuWidget mw, XButtonPressedEvent *event) ((XMotionEvent*)event)->is_hint = 0; handle_motion_event (mw, (XMotionEvent*)event); + + XlwMenuRedisplay ((XlwMenuWidget) mw, NULL, None); } commit a645c3bee74ce40f32b9f37f9b564b30fbe4dd7f Author: Po Lu Date: Sun Feb 6 11:28:29 2022 +0800 ; * src/xfns.c (x_encode_text): Fix comment. diff --git a/src/xfns.c b/src/xfns.c index baa643bde0..51e4ed0e2f 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1949,7 +1949,7 @@ x_set_scroll_bar_background (struct frame *f, Lisp_Object value, Lisp_Object old /* Encode Lisp string STRING as a text in a format appropriate for - XICCC (X Inter Client Communication Conventions). + the ICCCM (Inter Client Communication Conventions Manual). If STRING contains only ASCII characters, do no conversion and return the string data of STRING. Otherwise, encode the text by commit a3ee390cf7787abde7e6b625f2cd32bad3d29e90 Author: Bob Rogers Date: Sun Feb 6 04:07:51 2022 +0100 Add ietf-drums tests, fix parse-address decoding * test/lisp/mail/ietf-drums-tests.el (ietf-drums-tests): Test most of lisp/mail/ietf-drums.el functionality. * lisp/mail/ietf-drums.el: (ietf-drums-parse-address): Bug fix: Require rfc2047 when needed (bug#53811). diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 952707226f..9bdc0533e3 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -191,6 +191,8 @@ the Content-Transfer-Encoding header of a mail." "Parse STRING and return a MAILBOX / DISPLAY-NAME pair. If DECODE, the DISPLAY-NAME will have RFC2047 decoding performed (that's the \"=?utf...q...=?\") stuff." + (when decode + (require 'rfc2047)) (with-temp-buffer (let (display-name mailbox c display-string) (ietf-drums-init string) diff --git a/test/lisp/mail/ietf-drums-tests.el b/test/lisp/mail/ietf-drums-tests.el new file mode 100644 index 0000000000..4cc38b8763 --- /dev/null +++ b/test/lisp/mail/ietf-drums-tests.el @@ -0,0 +1,162 @@ +;;; ietf-drums-tests.el --- Test suite for ietf-drums.el -*- lexical-binding:t -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. + +;; Author: Bob Rogers + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'ietf-drums) + +(ert-deftest ietf-drums-tests () + "Test ietf-drums functionality." + + ;; ietf-drums-remove-comments + (should (equal (ietf-drums-remove-comments "random string") "random string")) + (should (equal (ietf-drums-remove-comments "random \"non comment\" string") + "random \"non comment\" string")) + (should (equal (ietf-drums-remove-comments "random (comment) string") + "random string")) + (should (equal (ietf-drums-remove-comments "random (comment) (string)") + "random ")) + (should (equal (ietf-drums-remove-comments + "random (first) (second (and)) (third) not fourth") + "random not fourth")) + + ;; ietf-drums-remove-whitespace + (should (equal (ietf-drums-remove-whitespace "random string") + "randomstring")) + (should (equal (ietf-drums-remove-whitespace "random (comment) string") + "random(comment)string")) + (should (equal (ietf-drums-remove-whitespace "random \"non comment\" string") + "random\"non comment\"string")) + (should (equal (ietf-drums-remove-whitespace "random (comment)\r\n(string)") + "random(comment)(string)")) + (should (equal (ietf-drums-remove-whitespace + "random (first) (second (and)) (third) not fourth") + "random(first)(second (and))(third)notfourth")) + + ;; ietf-drums-strip + (should (equal (ietf-drums-strip "random string") "randomstring")) + (should (equal (ietf-drums-strip "random \"non comment\" string") + "random\"non comment\"string")) + (should (equal (ietf-drums-strip "random (comment) string") + "randomstring")) + (should (equal (ietf-drums-strip "random (comment) (string)") + "random")) + (should (equal (ietf-drums-strip + "random (first) (second (and)) (third) not fourth") + "randomnotfourth")) + + ;; ietf-drums-strip-cte + (should (equal (ietf-drums-strip-cte "random \"non comment\" string") + ;; [the " " is still in there because it was quoted + ;; through the "strip". -- rgr, 5-Feb-22.] + "randomnon commentstring")) + (should (equal (ietf-drums-strip-cte "ran(d)do[s;t:r],,in=g") + "randomstring")) + + ;; ietf-drums-quote-string + (should (equal (ietf-drums-quote-string "Bob") "Bob")) + (should (equal (ietf-drums-quote-string "Foo Bar") "\"Foo Bar\"")) + + ;; ietf-drums-get-comment + (should (equal (ietf-drums-get-comment "random string") nil)) + (should (equal (ietf-drums-get-comment "random (comment) string") "comment")) + (should (equal (ietf-drums-get-comment "random \"non comment\" string") nil)) + (should (equal (ietf-drums-get-comment "\"still (non) comment\" string") + nil)) + (should (equal (ietf-drums-get-comment "random (comment)\r\nstring") + "comment")) + (should (equal (ietf-drums-get-comment "random (comment) (string)") "string")) + (should (equal (ietf-drums-get-comment + "random (first) (second (and)) (third) not fourth") + "third")) + + ;; ietf-drums-make-address + (should (equal (ietf-drums-make-address "Bob Rogers" "rogers@rgrjr.com") + "\"Bob Rogers\" ")) + (should (equal (ietf-drums-make-address nil "rogers@rgrjr.com") + "rogers@rgrjr.com")) + + ;; ietf-drums-parse-address + (should (equal (ietf-drums-parse-address "foo@example.com") + '("foo@example.com"))) + (should (equal (ietf-drums-parse-address "") + '("foo@example.com"))) + (should (equal (ietf-drums-parse-address "'foo' ") + '("foo@example.com" . "'foo'"))) + (should (equal (ietf-drums-parse-address "foo ") + '("foo@example.com" . "foo"))) + (should (equal (ietf-drums-parse-address "foo bar") + ;; [contrary to RFC2822, which wants the display-name + ;; before the address. -- rgr, 5-Feb-22.] + '("foo@example.com" . "foo bar"))) + (should (equal (ietf-drums-parse-address " foo ") + ;; [ditto. -- rgr, 5-Feb-22.] + '("foo@example.com" . "foo"))) + (should (equal (ietf-drums-parse-address "foo@example.com (foo)") + '("foo@example.com" . "foo"))) + (should (equal (ietf-drums-parse-address "Bar Baz ") + '("barbaz@example.com" . "Bar Baz"))) + (should (equal (ietf-drums-parse-address "barbaz@example.com (Bar Baz)") + '("barbaz@example.com" . "Bar Baz"))) + (should (equal (ietf-drums-parse-address + "Bar Baz (ignored) ") + '("barbaz@example.com" . "Bar Baz"))) + (should (equal (ietf-drums-parse-address " Bar Baz") + '("barbaz@example.com" . "Bar Baz"))) + (should (equal (ietf-drums-parse-address + "(Bar Baz not ignored) barbaz@example.com") + ;; [not strictly RFC2822, which expects the name + ;; comment after the address. -- rgr, 5-Feb-22.] + '("barbaz@example.com" . "Bar Baz not ignored"))) + (should (equal (ietf-drums-parse-address + "(ignored) (Bar Baz not ignored)") + '("barbaz@example.com" . "Bar Baz not ignored"))) + (should (equal (ietf-drums-parse-address + "(ignored) barbaz@example.com (Bar Baz not ignored)") + '("barbaz@example.com" . "Bar Baz not ignored"))) + ;; Test for RFC2047 token decoding. + (should (equal (ietf-drums-parse-address + "=?utf-8?B?0JfQtNGA0LDMgdCy0YHRgtCy0YPQudGC0LUh?= " + t) + '("foo@goo.ru" . "Здра́вствуйте!"))) + + ;; ietf-drums-parse-addresses + ;; Note that it's not worth getting too elaborate here, as the heavy + ;; lifting is all done by ietf-drums-parse-address. + (should (equal (ietf-drums-parse-addresses "foo@example.com") + '(("foo@example.com")))) + (should (equal (ietf-drums-parse-addresses + "foo@example.com, bar@example.com") + '(("foo@example.com") ("bar@example.com")))) + (should (equal (ietf-drums-parse-addresses + "foo@example.com, quux, bar@example.com") + '(("foo@example.com") ("bar@example.com")))) + (should (equal (ietf-drums-parse-addresses + "foo@example.com, Quux Dude , bar@example.com") + '(("foo@example.com") ("quux@noop.org" . "Quux Dude") + ("bar@example.com"))))) + +(provide 'ietf-drums-tests) + +;;; ietf-drums-tests.el ends here commit 50e51beabb2420ba3f844742352a98c7987c4932 Author: Po Lu Date: Sun Feb 6 10:43:38 2022 +0800 Allow disabling frame resize synchronization * doc/emacs/xresources.texi (Table of Resources): Document new parameter `synchronizeResize'. * etc/NEWS: Announce frame resize synchronization. * src/xterm.c (x_term_init): Don't enable XSync if the X resource `synchronizeResize' is off or false. diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index bb362ca3ea..5e01c955d1 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -373,6 +373,14 @@ Use some location on display specific to the input method for displaying the preview text. @end table +@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. + @item @code{verticalScrollBars} (class @code{ScrollBars}) Give frames scroll bars on the left if @samp{left}, on the right if @samp{right}; don't have scroll bars if @samp{off} (@pxref{Scroll Bars}). diff --git a/etc/NEWS b/etc/NEWS index b432da5d48..6c5aeacb7b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -182,6 +182,14 @@ and pop-up menus. This controls the style of the pre-edit and status areas of X input methods. ++++ +** On X11, Emacs now tries to synchronize window resize with the window manager. +This leads to less flicker and empty areas of a frame being displayed +when a frame is being resized. Unfortunately, it does not work on +some ancient buggy window managers, so if Emacs appears to freeze, but +is still responive to input, you can turn it off by setting the X +resource "synchronizeResize" to "off". + +++ ** New frame parameter 'alpha-background' and X resource "alphaBackground". This controls the opacity of the text background when running on a diff --git a/src/xterm.c b/src/xterm.c index 0d0a08d078..67b9f5b38c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -15681,8 +15681,22 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->xsync_supported_p = XSyncInitialize (dpyinfo->display, &dpyinfo->xsync_major, &dpyinfo->xsync_minor); -#endif + { + AUTO_STRING (synchronizeResize, "synchronizeResize"); + AUTO_STRING (SynchronizeResize, "SynchronizeResize"); + + Lisp_Object value = gui_display_get_resource (dpyinfo, + synchronizeResize, + SynchronizeResize, + Qnil, Qnil); + + if (STRINGP (value) && + (!strcmp (SSDATA (value), "false") + || !strcmp (SSDATA (value), "off"))) + dpyinfo->xsync_supported_p = false; + } +#endif /* See if a private colormap is requested. */ if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) { commit b38c0d6a2ff2dca89e9bf5feed49b7708ebf9942 Author: Po Lu Date: Sun Feb 6 09:18:59 2022 +0800 Clean up lots of #ifdef'd out code in PGTK files Most of them are either relics from X or from the NS code pgtkfns.c was copied from whole. * src/pgtkfns.c (x_icon): (pgtk_set_scroll_bar_foreground): (pgtk_set_scroll_bar_background): (Fx_create_frame): (pgtk_window_is_ancestor): (x_create_tip_frame): * src/pgtkselect.c (syms_of_pgtkselect): * src/pgtkterm.c (pgtk_iconify_frame): (x_set_frame_alpha): (button_event): Remove defined out code that cannot make sense. * src/pgtkmenu.c (show_help_event): Remove ifdef'd out code and reword comment. diff --git a/src/pgtkfns.c b/src/pgtkfns.c index c7987afc7d..15e14f75e4 100644 --- a/src/pgtkfns.c +++ b/src/pgtkfns.c @@ -682,40 +682,6 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { } - -static void -x_icon (struct frame *f, Lisp_Object parms) -/* -------------------------------------------------------------------------- - Strangely-named function to set icon position parameters in frame. - This is irrelevant under macOS, but might be needed under GNUstep, - depending on the window manager used. Note, this is not a standard - frame parameter-setter; it is called directly from x-create-frame. - -------------------------------------------------------------------------- */ -{ -#if 0 - Lisp_Object icon_x, icon_y; - struct pgtk_display_info *dpyinfo = check_pgtk_display_info (Qnil); - - FRAME_X_OUTPUT (f)->icon_top = -1; - FRAME_X_OUTPUT (f)->icon_left = -1; - - /* Set the position of the icon. */ - icon_x = - gui_display_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); - icon_y = - gui_display_get_arg (dpyinfo, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); - if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) - { - CHECK_NUMBER (icon_x); - CHECK_NUMBER (icon_y); - FRAME_X_OUTPUT (f)->icon_top = XFIXNUM (icon_y); - FRAME_X_OUTPUT (f)->icon_left = XFIXNUM (icon_x); - } - else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) - error ("Both left and top icon corners of icon must be specified"); -#endif -} - /** * x_set_undecorated: * @@ -892,13 +858,10 @@ pgtk_set_scroll_bar_foreground (struct frame *f, Lisp_Object new_value, if (!pgtk_parse_color (f, SSDATA (new_value), &rgb)) error ("Unknown color."); - /* On pgtk, this frame parameter should be ignored, and honor gtk theme. */ -#if 0 char css[64]; sprintf (css, "scrollbar slider { background-color: #%06x; }", (unsigned int) rgb.pixel & 0xffffff); gtk_css_provider_load_from_data (css_provider, css, -1, NULL); -#endif update_face_from_frame_parameter (f, Qscroll_bar_foreground, new_value); } @@ -925,13 +888,13 @@ pgtk_set_scroll_bar_background (struct frame *f, Lisp_Object new_value, if (!pgtk_parse_color (f, SSDATA (new_value), &rgb)) error ("Unknown color."); - /* On pgtk, this frame parameter should be ignored, and honor gtk theme. */ -#if 0 + /* On pgtk, this frame parameter should be ignored, and honor + gtk theme. (It honors the GTK theme if not explictly set, so + I see no harm in letting users tinker a bit more.) */ char css[64]; sprintf (css, "scrollbar trough { background-color: #%06x; }", (unsigned int) rgb.pixel & 0xffffff); gtk_css_provider_load_from_data (css_provider, css, -1, NULL); -#endif update_face_from_frame_parameter (f, Qscroll_bar_background, new_value); } @@ -1378,9 +1341,6 @@ This function is an internal primitive--use `make-frame' instead. */ ) f->output_method = output_pgtk; FRAME_X_OUTPUT (f) = xzalloc (sizeof *FRAME_X_OUTPUT (f)); -#if 0 - FRAME_X_OUTPUT (f)->icon_bitmap = -1; -#endif FRAME_FONTSET (f) = -1; FRAME_X_OUTPUT (f)->white_relief.pixel = -1; FRAME_X_OUTPUT (f)->black_relief.pixel = -1; @@ -1478,12 +1438,8 @@ This function is an internal primitive--use `make-frame' instead. */ ) error ("Invalid frame font"); } - /* Frame contents get displaced if an embedded X window has a border. */ -#if 0 - if (!FRAME_X_EMBEDDED_P (f)) -#endif - gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), - "borderWidth", "BorderWidth", RES_TYPE_NUMBER); + gui_default_parameter (f, parms, Qborder_width, make_fixnum (0), + "borderWidth", "BorderWidth", RES_TYPE_NUMBER); if (NILP (Fassq (Qinternal_border_width, parms))) { @@ -1627,10 +1583,6 @@ This function is an internal primitive--use `make-frame' instead. */ ) RES_TYPE_BOOLEAN); f->no_split = minibuffer_only || EQ (tem, Qt); -#if 0 - x_icon_verify (f, parms); -#endif - /* Create the X widget or window. */ /* x_window (f); */ xg_create_frame_widgets (f); @@ -1658,11 +1610,6 @@ This function is an internal primitive--use `make-frame' instead. */ ) #undef INSTALL_CURSOR - x_icon (f, parms); -#if 0 - x_make_gc (f); -#endif - /* Now consider the frame official. */ f->terminal->reference_count++; FRAME_DISPLAY_INFO (f)->reference_count++; @@ -1819,21 +1766,6 @@ This function is an internal primitive--use `make-frame' instead. */ ) return unbind_to (count, frame); } - -#if 0 -static int -pgtk_window_is_ancestor (PGTKWindow * win, PGTKWindow * candidate) -/* Test whether CANDIDATE is an ancestor window of WIN. */ -{ - if (candidate == NULL) - return 0; - else if (win == candidate) - return 1; - else - return pgtk_window_is_ancestor (win,[candidate parentWindow]); -} -#endif - /** * x_frame_restack: * @@ -2817,9 +2749,6 @@ x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct counts etc. */ f->output_method = output_pgtk; f->output_data.pgtk = xzalloc (sizeof *f->output_data.pgtk); -#if 0 - f->output_data.pgtk->icon_bitmap = -1; -#endif FRAME_FONTSET (f) = -1; f->output_data.pgtk->white_relief.pixel = -1; f->output_data.pgtk->black_relief.pixel = -1; @@ -2945,10 +2874,6 @@ x_create_tip_frame (struct pgtk_display_info *dpyinfo, Lisp_Object parms, struct gtk_window_set_type_hint (GTK_WINDOW (tip_window), GDK_WINDOW_TYPE_HINT_TOOLTIP); f->output_data.pgtk->current_cursor = f->output_data.pgtk->text_cursor; -#if 0 - x_make_gc (f); -#endif - gui_default_parameter (f, parms, Qauto_raise, Qnil, "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); gui_default_parameter (f, parms, Qauto_lower, Qnil, diff --git a/src/pgtkmenu.c b/src/pgtkmenu.c index d1b1bfffb3..18aaf57302 100644 --- a/src/pgtkmenu.c +++ b/src/pgtkmenu.c @@ -141,31 +141,15 @@ popup_deactivate_callback (GtkWidget *widget, gpointer client_data) static void show_help_event (struct frame *f, GtkWidget *widget, Lisp_Object help) { - /* Don't show this tooltip. - * Tooltips are always tied to main widget, so stacking order - * on Wayland is: - * (above) - * - menu - * - tooltip - * - main widget - * (below) - * This is applicable to tooltips for menu, and menu tooltips - * are shown below menus. - * As a workaround, I entrust Gtk with menu tooltips, and - * let emacs not to show menu tooltips. - */ - -#if 0 - Lisp_Object frame; - - if (f) - { - XSETFRAME (frame, f); - kbd_buffer_store_help_event (frame, help); - } - else - show_help_echo (help, Qnil, Qnil, Qnil); -#endif + /* Don't show help echo on PGTK, as tooltips are always transient + for the main widget, so on Wayland the menu will display above + and obscure the tooltip. FIXME: this is some low hanging fruit + for fixing. After you fix Fx_show_tip in pgtkterm.c so that it + can display tooltips above menus, copy the definition of this + function from xmenu.c. + + As a workaround, GTK is used to display menu tooltips, outside + the Emacs help echo machinery. */ } /* Callback called when menu items are highlighted/unhighlighted diff --git a/src/pgtkselect.c b/src/pgtkselect.c index 23a79895d5..24fed19cd2 100644 --- a/src/pgtkselect.c +++ b/src/pgtkselect.c @@ -36,10 +36,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) #include "pgtkselect.h" #include -#if 0 -static Lisp_Object Vselection_alist; -#endif - static GQuark quark_primary_data = 0; static GQuark quark_primary_size = 0; static GQuark quark_secondary_data = 0; @@ -606,11 +602,6 @@ syms_of_pgtkselect (void) defsubr (&Spgtk_selection_exists_p); defsubr (&Spgtk_selection_owner_p); -#if 0 - Vselection_alist = Qnil; - staticpro (&Vselection_alist); -#endif - 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\ diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 23ad3c318c..169d3f8a03 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -582,10 +582,6 @@ pgtk_iconify_frame (struct frame *f) block_input (); -#if 0 - x_set_bitmap_icon (f); -#endif - if (FRAME_GTK_OUTER_WIDGET (f)) { if (!FRAME_VISIBLE_P (f)) @@ -600,21 +596,9 @@ pgtk_iconify_frame (struct frame *f) /* Make sure the X server knows where the window should be positioned, in case the user deiconifies with the window manager. */ - if (!FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) -#if 0 - && !FRAME_X_EMBEDDED_P (f) -#endif - ) + if (!FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) x_set_offset (f, f->left_pos, f->top_pos, 0); -#if 0 - if (!FRAME_VISIBLE_P (f)) - { - /* If the frame was withdrawn, before, we must map it. */ - XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); - } -#endif - SET_FRAME_ICONIFIED (f, true); SET_FRAME_VISIBLE (f, 0); @@ -4600,22 +4584,6 @@ x_set_frame_alpha (struct frame *f) else if (alpha < alpha_min && alpha_min <= 1.0) alpha = alpha_min; -#if 0 - /* If there is a parent from the window manager, put the property there - also, to work around broken window managers that fail to do that. - Do this unconditionally as this function is called on reparent when - alpha has not changed on the frame. */ - - if (!FRAME_PARENT_FRAME (f)) - { - Window parent = x_find_topmost_parent (f); - if (parent != None) - XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity, - XA_CARDINAL, 32, PropModeReplace, - (unsigned char *) &opac, 1); - } -#endif - set_opacity_recursively (FRAME_WIDGET (f), &alpha); /* without this, blending mode is strange on wayland. */ gtk_widget_queue_resize_no_redraw (FRAME_WIDGET (f)); @@ -6152,9 +6120,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) dpyinfo = FRAME_DISPLAY_INFO (frame); dpyinfo->last_mouse_glyph_frame = NULL; -#if 0 - x_display_set_last_user_time (dpyinfo, event->button.time); -#endif if (gui_mouse_grabbed (dpyinfo)) f = dpyinfo->last_mouse_frame; @@ -6183,14 +6148,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) } } - /* xg_event_is_for_scrollbar() doesn't work correctly on sway, and - * we shouldn't need it. - */ -#if 0 - if (f && xg_event_is_for_scrollbar (f, event)) - f = 0; -#endif - if (f) { /* Is this in the tab-bar? */ @@ -6232,11 +6189,6 @@ button_event (GtkWidget * widget, GdkEvent * event, gpointer * user_data) if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; } -#if 0 - if (FRAME_X_EMBEDDED_P (f)) - xembed_send_message (f, event->button.time, - XEMBED_REQUEST_FOCUS, 0, 0, 0); -#endif } if (event->type == GDK_BUTTON_PRESS) commit 9c1d6b1d6a24338517756437757cc4aaaa4da4e5 Author: Po Lu Date: Sun Feb 6 08:58:23 2022 +0800 Handle window state changes on PGTK * src/pgtkterm.c (window_state_event): Set fullscreen, sticky, and iconification status according to the new window state. (bug#53793) diff --git a/src/pgtkterm.c b/src/pgtkterm.c index d0a2980bc1..23ad3c318c 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -5694,6 +5694,32 @@ window_state_event (GtkWidget *widget, } } + if (event->window_state.new_window_state + & GDK_WINDOW_STATE_FULLSCREEN) + store_frame_param (f, Qfullscreen, Qfullboth); + else if (event->window_state.new_window_state + & GDK_WINDOW_STATE_MAXIMIZED) + store_frame_param (f, Qfullscreen, Qmaximized); + else + store_frame_param (f, Qfullscreen, Qnil); + + if (event->window_state.new_window_state + & GDK_WINDOW_STATE_ICONIFIED) + SET_FRAME_ICONIFIED (f, true); + else + { + FRAME_X_OUTPUT (f)->has_been_visible = true; + inev.ie.kind = DEICONIFY_EVENT; + XSETFRAME (inev.ie.frame_or_window, f); + SET_FRAME_ICONIFIED (f, false); + } + + if (event->window_state.new_window_state + & GDK_WINDOW_STATE_STICKY) + store_frame_param (f, Qsticky, Qt); + else + store_frame_param (f, Qsticky, Qnil); + if (inev.ie.kind != NO_EVENT) evq_enqueue (&inev); return FALSE; commit eb351e3795bb89fc5bdb4e6a1db0b53563a2ebaf Author: Po Lu Date: Sun Feb 6 08:39:02 2022 +0800 Minor changes to xsync support * src/xfns.c (append_wm_protocols): Don't append _NET_WM_SYNC_REQUEST unless the display supports our version of XSync. * src/xterm.c (handle_one_xevent): Don't handle _NET_WM_SYNC_REQUEST unless the display supports that. (x_free_frame_resources): Test basic counter against None. diff --git a/src/xfns.c b/src/xfns.c index bfb61c1205..baa643bde0 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2402,7 +2402,7 @@ append_wm_protocols (struct x_display_info *dpyinfo, if (!found_wm_ping) protos[num_protos++] = dpyinfo->Xatom_net_wm_ping; #if !defined HAVE_GTK3 && defined HAVE_XSYNC - if (!found_wm_sync_request) + if (!found_wm_sync_request && dpyinfo->xsync_supported_p) protos[num_protos++] = dpyinfo->Xatom_net_wm_sync_request; #endif diff --git a/src/xterm.c b/src/xterm.c index 4b4eae53be..0d0a08d078 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9103,7 +9103,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, #if defined HAVE_XSYNC && !defined HAVE_GTK3 if (event->xclient.data.l[0] == dpyinfo->Xatom_net_wm_sync_request - && event->xclient.format == 32) + && event->xclient.format == 32 + && dpyinfo->xsync_supported_p) { struct frame *f = x_top_window_to_frame (dpyinfo, @@ -14784,7 +14785,7 @@ x_free_frame_resources (struct frame *f) #endif /* !USE_X_TOOLKIT */ #ifdef HAVE_XSYNC - if (FRAME_X_BASIC_COUNTER (f)) + if (FRAME_X_BASIC_COUNTER (f) != None) XSyncDestroyCounter (FRAME_X_DISPLAY (f), FRAME_X_BASIC_COUNTER (f)); #endif commit 821c240075e3b850a61207d18d520126292421ce (refs/remotes/origin/emacs-28) Author: Bob Rogers Date: Sun Feb 6 01:07:43 2022 +0100 Fix ietf-drums-get-comment doc string * lisp/mail/ietf-drums.el (ietf-drums-get-comment): We really return the last comment (bug#53810). diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 4a07959189..51c3e63e04 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -150,7 +150,7 @@ backslash and doublequote.") (buffer-string)))) (defun ietf-drums-get-comment (string) - "Return the first comment in STRING." + "Return the last comment in STRING." (with-temp-buffer (ietf-drums-init string) (let (result c) commit ab0554a19774de193ff08aee35ea3f6726cf1f76 Author: Lars Ingebrigtsen Date: Sun Feb 6 01:00:04 2022 +0100 Improve the elp-instrument-package doc string * lisp/emacs-lisp/elp.el (elp-instrument-package): Note the effect of loading further files (bug#13252). diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index e5c94c09c2..385ddb3f41 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el @@ -287,7 +287,12 @@ type \"nil\" to use `elp-function-list'." "Instrument for profiling, all functions which start with PREFIX. For example, to instrument all ELP functions, do the following: - \\[elp-instrument-package] RET elp- RET" + \\[elp-instrument-package] RET elp- RET + +Note that only functions that are currently loaded will be +instrumented. If you run this function, and then later load +further functions that start with PREFIX, they will not be +instrumented automatically." (interactive (list (completing-read "Prefix of package to instrument: " obarray 'elp-profilable-p))) commit 6278c6a94eacc23aba2f63c7289ecbcd3db6d19a Author: Mauro Aranda Date: Sun Feb 6 00:38:40 2022 +0100 Fix reverting the default face to standard/themed state in GUIs * lisp/cus-edit.el (custom-face-set, custom-face-mark-to-save) (custom-face-save): Record the default (standard or themed) attributes of the default face in a symbol property. (custom-face-reset-saved, custom-face-mark-to-reset-standard): When reverting the default face to the standard or themed state, use the default attributes we recorded, instead of relying in the defface spec of the default face, since that doesn't give enough information to reset all attributes, like foreground, family, etc (bug#14635). diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 3e350c611a..ff70f6724a 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -3976,6 +3976,18 @@ Optional EVENT is the location for the menu." (setq comment nil) ;; Make the comment invisible by hand if it's empty (custom-comment-hide comment-widget)) + ;; When modifying the default face, we need to save the standard or themed + ;; attrs, in case the user asks to revert to them in the future. + ;; In GUIs, when resetting the attributes of the default face, the frame + ;; parameters associated with this face won't change, unless explicitly + ;; passed a value. Storing this known attrs allows us to tell faces.el to + ;; set those attributes to specified values, making the relevant frame + ;; parameters stay in sync with the default face. + (when (and (eq symbol 'default) + (not (get symbol 'custom-face-default-attrs)) + (memq (custom-face-state symbol) '(standard themed))) + (put symbol 'custom-face-default-attrs + (custom-face-get-current-spec symbol))) (custom-push-theme 'theme-face symbol 'user 'set value) (face-spec-set symbol value 'customized-face) (put symbol 'face-comment comment) @@ -3994,6 +4006,12 @@ Optional EVENT is the location for the menu." (setq comment nil) ;; Make the comment invisible by hand if it's empty (custom-comment-hide comment-widget)) + ;; See the comments in `custom-face-set'. + (when (and (eq symbol 'default) + (not (get symbol 'custom-face-default-attrs)) + (memq (custom-face-state symbol) '(standard themed))) + (put symbol 'custom-face-default-attrs + (custom-face-get-current-spec symbol))) (custom-push-theme 'theme-face symbol 'user 'set value) (face-spec-set symbol value (if standard 'reset 'saved-face)) (put symbol 'face-comment comment) @@ -4007,7 +4025,14 @@ Optional EVENT is the location for the menu." (defun custom-face-save (widget) "Save the face edited by WIDGET." - (let ((form (widget-get widget :custom-form))) + (let ((form (widget-get widget :custom-form)) + (symbol (widget-value widget))) + ;; See the comments in `custom-face-set'. + (when (and (eq symbol 'default) + (not (get symbol 'custom-face-default-attrs)) + (memq (custom-face-state symbol) '(standard themed))) + (put symbol 'custom-face-default-attrs + (custom-face-get-current-spec symbol))) (if (memq form '(all lisp)) (custom-face-mark-to-save widget) ;; The user is working on only a selected terminal type; @@ -4035,10 +4060,20 @@ uncustomized (themed or standard) face." (saved-face (get face 'saved-face)) (comment (get face 'saved-face-comment)) (comment-widget (widget-get widget :comment-widget))) + ;; If resetting the default face and there isn't a saved value, + ;; push a fake user setting, so that reverting to the default + ;; attributes works. (custom-push-theme 'theme-face face 'user - (if saved-face 'set 'reset) - saved-face) + (if (or saved-face (eq face 'default)) 'set 'reset) + (or saved-face + ;; If this is t, then MODE is 'reset, + ;; and `custom-push-theme' ignores this argument. + (not (eq face 'default)) + (get face 'custom-face-default-attrs))) (face-spec-set face saved-face 'saved-face) + (when (and (not saved-face) (eq face 'default)) + ;; Remove the fake user setting. + (custom-push-theme 'theme-face face 'user 'reset)) (put face 'face-comment comment) (put face 'customized-face-comment nil) (widget-value-set child saved-face) @@ -4060,8 +4095,15 @@ redraw the widget immediately." (comment-widget (widget-get widget :comment-widget))) (unless value (user-error "No standard setting for this face")) - (custom-push-theme 'theme-face symbol 'user 'reset) + ;; If erasing customizations for the default face, push a fake user setting, + ;; so that reverting to the default attributes works. + (custom-push-theme 'theme-face symbol 'user + (if (eq symbol 'default) 'set 'reset) + (or (not (eq symbol 'default)) + (get symbol 'custom-face-default-attrs))) (face-spec-set symbol value 'reset) + ;; Remove the fake user setting. + (custom-push-theme 'theme-face symbol 'user 'reset) (put symbol 'face-comment nil) (put symbol 'customized-face-comment nil) (if (and custom-reset-standard-faces-list commit eea93a8aaac30690c6e864f2556010d3b62f4eee Author: Lars Ingebrigtsen Date: Sun Feb 6 00:29:33 2022 +0100 Add new user option 'find-library-include-other-files' * lisp/emacs-lisp/find-func.el (read-library-name--find-files): New function (bug#15735). (read-library-name): Use it. (find-library-include-other-files): New user option. diff --git a/etc/NEWS b/etc/NEWS index e90cf19c16..b432da5d48 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -135,6 +135,11 @@ An autoload definition appears just as a (defun . NAME) and the * Changes in Emacs 29.1 +--- +** 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. + ** New command 'sqlite-mode-open-file' for examining an sqlite3 file. This uses the new 'sqlite-mode' which allows listing the tables in a DB file, and examining and modifying the columns and the contents of diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 6eac25c100..571087c963 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -183,6 +183,16 @@ See the functions `find-function' and `find-variable'." :group 'find-function :version "20.3") +(defcustom find-library-include-other-files t + "If non-nil, `read-library-name' will also include non-library files. +This affects commands like `read-library'. + +If nil, only library files (i.e., \".el\" files) will be offered +for completion." + :type 'boolean + :version "29.1" + :group 'find-function) + ;;; Functions: (defun find-library-suffixes () @@ -302,7 +312,10 @@ TYPE should be nil to find a function, or `defvar' to find a variable." Interactively, prompt for LIBRARY using the one at or near point. This function searches `find-library-source-path' if non-nil, and -`load-path' otherwise." +`load-path' otherwise. + +See the `find-library-include-other-files' user option for +customizing the candidate completions." (interactive (list (read-library-name))) (prog1 (switch-to-buffer (find-file-noselect (find-library-name library))) @@ -317,8 +330,6 @@ in a directory under `load-path' (or `find-library-source-path', if non-nil)." (let* ((dirs (or find-library-source-path load-path)) (suffixes (find-library-suffixes)) - (table (apply-partially 'locate-file-completion-table - dirs suffixes)) (def (if (eq (function-called-at-point) 'require) ;; `function-called-at-point' may return 'require ;; with `point' anywhere on this line. So wrap the @@ -332,10 +343,28 @@ if non-nil)." (thing-at-point 'symbol)) (error nil)) (thing-at-point 'symbol)))) - (when (and def (not (test-completion def table))) - (setq def nil)) - (completing-read (format-prompt "Library name" def) - table nil nil nil nil def))) + (if find-library-include-other-files + (let ((table (apply-partially #'locate-file-completion-table + dirs suffixes))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (completing-read (format-prompt "Library name" def) + table nil nil nil nil def)) + (let ((files (read-library-name--find-files dirs suffixes))) + (when (and def (not (member def files))) + (setq def nil)) + (completing-read (format-prompt "Library name" def) + files nil t nil nil def))))) + +(defun read-library-name--find-files (dirs suffixes) + "Return a list of all files in DIRS that match SUFFIXES." + (let ((files nil) + (regexp (concat (regexp-opt suffixes) "\\'"))) + (dolist (dir dirs) + (dolist (file (ignore-errors (directory-files dir nil regexp t))) + (and (string-match regexp file) + (push (substring file 0 (match-beginning 0)) files)))) + files)) ;;;###autoload (defun find-library-other-window (library) commit 93da7a202d8fc23cd3af064eb94adbb1c9c0944f Author: Lars Ingebrigtsen Date: Sat Feb 5 23:57:38 2022 +0100 Tweak how eshell/cd works when cd-ing to ".." from "/" * lisp/eshell/em-dirs.el (eshell/cd): Make "cd .." from "/" less confusing (bug#16861). diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 893cad7b4f..3998026d7f 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -391,6 +391,10 @@ in the minibuffer: (unless (equal curdir newdir) (eshell-add-to-dir-ring curdir)) (let ((result (cd newdir))) + ;; If we're in "/" and cd to ".." or the like, make things + ;; less confusing by changing "/.." to "/". + (when (equal (file-truename result) "/") + (setq result (cd "/"))) (and eshell-cd-shows-directory (eshell-printn result))) (run-hooks 'eshell-directory-change-hook) commit a4eeea812441c2456ad522659869be089be9d7a9 Author: Lars Ingebrigtsen Date: Sat Feb 5 23:46:02 2022 +0100 Add a :distant-foreground to the lazy-highlight face * lisp/isearch.el (lazy-highlight): Add a :distant-foreground colour so that the text is always legible (bug#16969). diff --git a/lisp/isearch.el b/lisp/isearch.el index 4086a1bf11..8970216398 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -430,13 +430,13 @@ and doesn't remove full-buffer highlighting after a search." (defface lazy-highlight '((((class color) (min-colors 88) (background light)) - (:background "paleturquoise")) + (:background "paleturquoise" :distant-foreground "black")) (((class color) (min-colors 88) (background dark)) - (:background "paleturquoise4")) + (:background "paleturquoise4" :distant-foreground "white")) (((class color) (min-colors 16)) - (:background "turquoise3")) + (:background "turquoise3" :distant-foreground "white")) (((class color) (min-colors 8)) - (:background "turquoise3")) + (:background "turquoise3" :distant-foreground "white")) (t (:underline t))) "Face for lazy highlighting of matches other than the current one." :group 'lazy-highlight commit 86827564208d93e243ee3cba7042f2d0ebd842b9 Author: Lars Ingebrigtsen Date: Sat Feb 5 22:46:08 2022 +0100 Add new function mode-line-window-selected-p * doc/lispref/modes.texi (Mode Line Basics): Mention it (bug#53629). * lisp/bindings.el (mode-line-window-selected-p): New function from martin rudalics . diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index e2b39836e6..2ef7de066f 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1964,8 +1964,26 @@ This function also forces an update of the menu bar and frame title. @end defun The selected window's mode line is usually displayed in a different -color using the face @code{mode-line}. Other windows' mode lines appear -in the face @code{mode-line-inactive} instead. @xref{Faces}. +color using the face @code{mode-line-active}. Other windows' mode +lines appear in the face @code{mode-line-inactive} instead. +@xref{Faces}. + +@defun mode-line-window-selected-p +If you want to have more extensive differences between the mode lines +in selected and non-selected windows, you can use this predicate in an +@code{:eval} construct. For instance, if you want to display the +buffer name in bold in selected windows, but in italics in the other +windows, you can say something like: + +@lisp +(setq-default + mode-line-buffer-identification + '(:eval (propertize "%12b" + 'face (if (mode-line-window-selected-p) + 'bold + 'italic)))) +@end lisp +@end defun @vindex mode-line-compact Some modes put a lot of data in the mode line, pushing elements at diff --git a/etc/NEWS b/etc/NEWS index ff9f22b6b0..e90cf19c16 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1035,6 +1035,12 @@ functions. * Lisp Changes in Emacs 29.1 ++++ +** New utility predicate 'mode-line-window-selected-p'. +This is meant to be used from ':eval' mode line constructs to create +different mode line looks for selected and unselected windows. + ++++ ** New variable 'messages-buffer-name'. This variable (defaulting to "*Messages*") allows packages to override where messages are logged. diff --git a/lisp/bindings.el b/lisp/bindings.el index 86c0ea1a90..26b17035ef 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -654,6 +654,18 @@ By default, this shows the information specified by `global-mode-string'.") (with-selected-window (posn-window (event-start event)) (previous-buffer))) +(defun mode-line-window-selected-p () + "Return non-nil if we're updating the mode line for the selected window. +This function is meant to be called in `:eval' mode line +constructs to allow altering the look of the mode line depending +on whether the mode line belongs to the currently selected window +or not." + (let ((window (selected-window))) + (or (eq window (old-selected-window)) + (and (minibuffer-window-active-p (minibuffer-window)) + (with-selected-window (minibuffer-window) + (eq window (minibuffer-selected-window))))))) + (defmacro bound-and-true-p (var) "Return the value of symbol VAR if it is bound, else nil. Note that if `lexical-binding' is in effect, this function isn't commit 638247baa4a4f983cb3082496657d505fc3d0c09 Author: Daniel Martín Date: Sat Feb 5 21:03:21 2022 +0100 Fix typo in display.texi * doc/lispref/display.texi (Making Buttons): Fix typo. (Bug#53807) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 854aa06dbb..d1b61d3fb5 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -6988,7 +6988,7 @@ current buffer, and returns it. @end defun @defun insert-button label &rest properties -This insert a button with the label @var{label} at point, +This inserts a button with the label @var{label} at point, and returns it. @end defun commit ddc734432bdb97480de0c8c80fb5e294b88e9214 Author: Michael Albinus Date: Sat Feb 5 19:17:47 2022 +0100 Adapt Tramp to changed unload behavior (bug#53632) * test/lisp/net/tramp-tests.el (tramp-test47-unload): Check also for autoloaded macros. Respect `tramp-autoload' function property. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9be1985780..a4f2fe9e0e 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -7205,12 +7205,14 @@ Since it unloads Tramp, it shall be the last test to run." (mapatoms (lambda (x) (and (or (and (boundp x) (null (local-variable-if-set-p x))) - (and (functionp x) (null (autoloadp (symbol-function x))))) + (and (functionp x) (null (autoloadp (symbol-function x)))) + (macrop x)) (string-match-p "^tramp" (symbol-name x)) ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. (not (eq 'tramp-completion-mode x)) (not (string-match-p "^tramp\\(-archive\\)?--?test" (symbol-name x))) (not (string-match-p "unload-hook$" (symbol-name x))) + (not (get x 'tramp-autoload)) (ert-fail (format "`%s' still bound" x))))) ;; The defstruct `tramp-file-name' and all its internal functions ;; shall be purged. commit 9e420cd893f5507b9d7d3888c3a6d709aa45e6ff Author: Po Lu Date: Sat Feb 5 21:43:00 2022 +0800 Add support for basic syncing with the window manager on resize This is handled by GTK 3, so the code is disabled on that specific build. On other builds, this eliminates any unexposed part of a frame from showing up after a resize when `frame-resize-pixelwise' is t. * configure.ac: Check for the X Synchronization Extension if present. * src/Makefile.in (EMACS_CFLAGS): (LIBES): Add XSYNC_LIBS and XSYNC_CFLAGS. * src/xfns.c (append_wm_protocols): Declare `_NET_WM_SYNC_REQUEST' support if appropriate. (x_window): Adjust location of call to `append_wm_protocols' on Xt version to prevent it from being overwritten. (Fx_create_frame): Create basic counter. * src/xterm.c (XTframe_up_to_date): Set counter value to the one asked for by the window manager. (handle_one_xevent): Handle _NET_WM_SYNC_REQUEST. (x_free_frame_resources): Free frame counter if present. (x_term_init): Test for XSync and set fields accordingly. * src/xterm.h (struct x_display_info): New fields for XSync support and new atoms. (struct x_output): New fields for counter status. (FRAME_X_BASIC_COUNTER): New macro. diff --git a/configure.ac b/configure.ac index 2ad5f2312c..6f469cf0f0 100644 --- a/configure.ac +++ b/configure.ac @@ -4490,6 +4490,22 @@ fi AC_SUBST(XINPUT_CFLAGS) AC_SUBST(XINPUT_LIBS) +XSYNC_LIBS= +XSYNC_CFLAGS= +HAVE_XSYNC=no +if test "${HAVE_X11}" = "yes"; then + AC_CHECK_HEADER(X11/extensions/sync.h, + AC_CHECK_LIB(Xext, XSyncQueryExtension, HAVE_XSYNC=yes), + [], [#include ]) + + if test "${HAVE_XSYNC}" = "yes"; then + AC_DEFINE(HAVE_XSYNC, 1, [Define to 1 if the X Synchronization Extension is available.]) + XSYNC_LIBS="-lXext" + fi +fi +AC_SUBST(XSYNC_LIBS) +AC_SUBST(XSYNC_CFLAGS) + ### Use Xdbe (-lXdbe) if available HAVE_XDBE=no if test "${HAVE_X11}" = "yes"; then diff --git a/src/Makefile.in b/src/Makefile.in index 706beb453b..186e06735c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -264,6 +264,9 @@ XFIXES_CFLAGS = @XFIXES_CFLAGS@ XINPUT_LIBS = @XINPUT_LIBS@ XINPUT_CFLAGS = @XINPUT_CFLAGS@ +XSYNC_LIBS = @XSYNC_LIBS@ +XSYNC_CFLAGS = @XSYNC_CFLAGS@ + XDBE_LIBS = @XDBE_LIBS@ XDBE_CFLAGS = @XDBE_CFLAGS@ @@ -396,7 +399,7 @@ EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ $(XINPUT_CFLAGS) $(WEBP_CFLAGS) $(WEBKIT_CFLAGS) $(LCMS2_CFLAGS) \ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ $(HARFBUZZ_CFLAGS) $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ - $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) \ + $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) $(XSYNC_CFLAGS) \ $(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \ $(WERROR_CFLAGS) $(HAIKU_CFLAGS) ALL_CFLAGS = $(EMACS_CFLAGS) $(WARN_CFLAGS) $(CFLAGS) @@ -548,7 +551,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(PGTK_LIBS) $(LIBX_BASE) $(LIBIMAGE $(WEBKIT_LIBS) \ $(LIB_EACCESS) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \ - $(XDBE_LIBS) \ + $(XDBE_LIBS) $(XSYNC_LIBS) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \ $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(HARFBUZZ_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ diff --git a/src/xfns.c b/src/xfns.c index 4719c5dac7..bfb61c1205 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2367,6 +2367,9 @@ append_wm_protocols (struct x_display_info *dpyinfo, Atom protos[10]; int num_protos = 0; bool found_wm_ping = false; +#if !defined HAVE_GTK3 && defined HAVE_XSYNC + bool found_wm_sync_request = false; +#endif unsigned long bytes_after; block_input (); @@ -2385,6 +2388,11 @@ append_wm_protocols (struct x_display_info *dpyinfo, if (existing_protocols[nitems] == dpyinfo->Xatom_net_wm_ping) found_wm_ping = true; +#if !defined HAVE_GTK3 && defined HAVE_XSYNC + else if (existing_protocols[nitems] + == dpyinfo->Xatom_net_wm_sync_request) + found_wm_sync_request = true; +#endif } } @@ -2393,6 +2401,10 @@ append_wm_protocols (struct x_display_info *dpyinfo, if (!found_wm_ping) protos[num_protos++] = dpyinfo->Xatom_net_wm_ping; +#if !defined HAVE_GTK3 && defined HAVE_XSYNC + if (!found_wm_sync_request) + protos[num_protos++] = dpyinfo->Xatom_net_wm_sync_request; +#endif if (num_protos) XChangeProperty (dpyinfo->display, @@ -3842,7 +3854,6 @@ x_window (struct frame *f) FRAME_X_VISUAL (f), attribute_mask, &attributes); initial_set_up_x_back_buffer (f); - append_wm_protocols (FRAME_DISPLAY_INFO (f), f); #ifdef HAVE_X_I18N if (use_xim) @@ -3891,6 +3902,8 @@ x_window (struct frame *f) XSetWMProtocols (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), protocols, 2); } + append_wm_protocols (FRAME_DISPLAY_INFO (f), f); + /* x_set_name normally ignores requests to set the name if the requested name is the same as the current name. This is the one place where that assumption isn't correct; f->name is set, but @@ -4795,6 +4808,24 @@ This function is an internal primitive--use `make-frame' instead. */) (unsigned char *) &dpyinfo->client_leader_window, 1); } +#ifdef HAVE_XSYNC + if (dpyinfo->xsync_supported_p) + { +#ifndef HAVE_GTK3 + XSyncValue initial_value; + + XSyncIntToValue (&initial_value, 0); + FRAME_X_BASIC_COUNTER (f) = XSyncCreateCounter (FRAME_X_DISPLAY (f), + 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); +#endif + } +#endif + unblock_input (); /* Works iff frame has been already mapped. */ diff --git a/src/xterm.c b/src/xterm.c index 34a85aa745..4b4eae53be 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -122,6 +122,10 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef HAVE_XSYNC +#include +#endif + /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ #ifndef makedev @@ -1849,6 +1853,17 @@ XTframe_up_to_date (struct frame *f) FRAME_MOUSE_UPDATE (f); if (!buffer_flipping_blocked_p () && FRAME_X_NEED_BUFFER_FLIP (f)) show_back_buffer (f); + +#ifdef HAVE_XSYNC + if (FRAME_X_OUTPUT (f)->sync_end_pending_p + && FRAME_X_BASIC_COUNTER (f)) + { + 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; + } +#endif unblock_input (); } @@ -9086,6 +9101,26 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto done; } +#if defined HAVE_XSYNC && !defined HAVE_GTK3 + if (event->xclient.data.l[0] == dpyinfo->Xatom_net_wm_sync_request + && event->xclient.format == 32) + { + struct frame *f + = x_top_window_to_frame (dpyinfo, + event->xclient.window); + + 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; + + *finish = X_EVENT_DROP; + goto done; + } + } +#endif + goto done; } @@ -14745,9 +14780,15 @@ x_free_frame_resources (struct frame *f) tear_down_x_back_buffer (f); if (FRAME_X_WINDOW (f)) - XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); + XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); #endif /* !USE_X_TOOLKIT */ +#ifdef HAVE_XSYNC + if (FRAME_X_BASIC_COUNTER (f)) + XSyncDestroyCounter (FRAME_X_DISPLAY (f), + FRAME_X_BASIC_COUNTER (f)); +#endif + unload_color (f, FRAME_FOREGROUND_PIXEL (f)); unload_color (f, FRAME_BACKGROUND_PIXEL (f)); unload_color (f, f->output_data.x->cursor_pixel); @@ -15628,6 +15669,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) } #endif +#ifdef HAVE_XSYNC + int xsync_event_base, xsync_error_base; + dpyinfo->xsync_supported_p + = XSyncQueryExtension (dpyinfo->display, + &xsync_event_base, + &xsync_error_base); + + if (dpyinfo->xsync_supported_p) + dpyinfo->xsync_supported_p = XSyncInitialize (dpyinfo->display, + &dpyinfo->xsync_major, + &dpyinfo->xsync_minor); +#endif + /* See if a private colormap is requested. */ if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) { @@ -15887,6 +15941,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) ATOM_REFS_INIT ("ATOM", Xatom_ATOM) ATOM_REFS_INIT ("ATOM_PAIR", Xatom_ATOM_PAIR) ATOM_REFS_INIT ("CLIPBOARD_MANAGER", Xatom_CLIPBOARD_MANAGER) + ATOM_REFS_INIT ("XATOM_COUNTER", Xatom_XEMBED_INFO) ATOM_REFS_INIT ("_XEMBED_INFO", Xatom_XEMBED_INFO) /* For properties of font. */ ATOM_REFS_INIT ("PIXEL_SIZE", Xatom_PIXEL_SIZE) @@ -15921,6 +15976,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) ATOM_REFS_INIT ("_NET_FRAME_EXTENTS", Xatom_net_frame_extents) ATOM_REFS_INIT ("_NET_CURRENT_DESKTOP", Xatom_net_current_desktop) 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) /* 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 99d339e1f9..25ea257b51 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -99,6 +99,10 @@ typedef GtkWidget *xt_or_gtk_widget; #include #endif +#ifdef HAVE_XSYNC +#include +#endif + #include "dispextern.h" #include "termhooks.h" @@ -366,9 +370,9 @@ struct x_display_info /* More atoms, which are selection types. */ Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE, - Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING, - Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL, - Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER; + Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING, + Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL, + Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER, Xatom_COUNTER; /* More atoms for font properties. The last three are private properties, see the comments in src/fontset.h. */ @@ -498,7 +502,8 @@ struct x_display_info Xatom_net_wm_state_sticky, Xatom_net_wm_state_above, Xatom_net_wm_state_below, 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_opaque_region, Xatom_net_wm_ping, Xatom_net_wm_sync_request, + Xatom_net_wm_sync_request_counter; /* XSettings atoms and windows. */ Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; @@ -565,6 +570,12 @@ struct x_display_info int xfixes_major; int xfixes_minor; #endif + +#ifdef HAVE_XSYNC + bool xsync_supported_p; + int xsync_major; + int xsync_minor; +#endif }; #ifdef HAVE_X_I18N @@ -801,6 +812,13 @@ struct x_output XFontSet xic_xfs; #endif +#ifdef HAVE_XSYNC + XSyncCounter basic_frame_counter; + XSyncValue pending_basic_counter_value; + + bool_bf sync_end_pending_p; +#endif + /* Relief GCs, colors etc. */ struct relief { @@ -963,6 +981,9 @@ extern void x_mark_frame_dirty (struct frame *f); || (FRAME_DISPLAY_INFO (f)->xrender_major > (major)))) #endif +#ifdef HAVE_XSYNC +#define FRAME_X_BASIC_COUNTER(f) FRAME_X_OUTPUT (f)->basic_frame_counter +#endif /* This is the Colormap which frame F uses. */ #define FRAME_X_COLORMAP(f) FRAME_DISPLAY_INFO (f)->cmap commit 63eab2948a23c6302308358472fb7f718759f67a Author: Po Lu Date: Sat Feb 5 19:48:23 2022 +0800 * lisp/pixel-scroll.el: Update commentary. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index e8b637ba1a..54724ca328 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -32,8 +32,10 @@ ;;; Commentary: -;; This package offers a global minor mode which makes mouse-wheel -;; scroll a line smoothly. +;; This file contains two somewhat related features. + +;; The first is a global minor mode which makes Emacs try to scroll +;; each line smoothly. ;; ;; Scrolling a line up by `set-window-vscroll' and that by `scroll-up' ;; give similar display as shown below. @@ -58,6 +60,25 @@ ;; (set-window-vscroll nil vs t) (sit-for 0)) ;; (scroll-up 1) +;; The second is another global minor mode that redefines `wheel-up' +;; and `wheel-down' to a command that tries to scroll the display +;; according to the precise movement of a trackpad or mouse. + +;; But it operates in a much more intelligent manner than simply +;; setting the vscroll. It will set window start to the position +;; closest to the position at the top-left corner of the window if +;; vscroll were set accordingly, in a smart and fast manner, and only +;; set vscroll the rest of the way. There is no visible difference, +;; but it is much faster, and doesn't move the display by a huge +;; portion if vscroll is reset for some reason. + +;; It also tries to move point out of the way, so redisplay will not +;; recenter the display as it scrolls. This works well almost all of +;; the time, but is impossible to get right with images larger than +;; the window they're displayed in. A feature that will allow +;; redisplay to skip recentering is in the works, and will completely +;; resolve this problem. + ;;; Todo: ;; ;; Allowing pixel-level scrolling in Emacs requires a thorough review commit 4243747b1b8c3b7e3463822804b32e83febe2878 Author: Eli Zaretskii Date: Sat Feb 5 13:01:24 2022 +0200 Fix 'current-column' in the presence of display strings * src/indent.c (check_display_width): Support calculation of width of 'display' properties whose values are strings. This fixes the value returned by 'current-column' when display strings are present between BOL and point. (Bug#53795) diff --git a/src/indent.c b/src/indent.c index 5c21cd8f99..efeb9e74f4 100644 --- a/src/indent.c +++ b/src/indent.c @@ -468,31 +468,40 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) { Lisp_Object val, overlay; - if (CONSP (val = get_char_property_and_overlay - (make_fixnum (pos), Qdisplay, Qnil, &overlay)) - && EQ (Qspace, XCAR (val))) - { /* FIXME: Use calc_pixel_width_or_height. */ - Lisp_Object plist = XCDR (val), prop; + if (!NILP (val = get_char_property_and_overlay (make_fixnum (pos), Qdisplay, + Qnil, &overlay))) + { int width = -1; - EMACS_INT align_to_max = - (col < MOST_POSITIVE_FIXNUM - INT_MAX - ? (EMACS_INT) INT_MAX + col - : MOST_POSITIVE_FIXNUM); - - if ((prop = Fplist_get (plist, QCwidth), - RANGED_FIXNUMP (0, prop, INT_MAX)) - || (prop = Fplist_get (plist, QCrelative_width), - RANGED_FIXNUMP (0, prop, INT_MAX))) - width = XFIXNUM (prop); - else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) - && XFLOAT_DATA (prop) <= INT_MAX) - width = (int)(XFLOAT_DATA (prop) + 0.5); - else if ((prop = Fplist_get (plist, QCalign_to), - RANGED_FIXNUMP (col, prop, align_to_max))) - width = XFIXNUM (prop) - col; - else if (FLOATP (prop) && col <= XFLOAT_DATA (prop) - && (XFLOAT_DATA (prop) <= align_to_max)) - width = (int)(XFLOAT_DATA (prop) + 0.5) - col; + Lisp_Object plist = Qnil; + + /* Handle '(space ...)' display specs. */ + if (CONSP (val) && EQ (Qspace, XCAR (val))) + { /* FIXME: Use calc_pixel_width_or_height. */ + Lisp_Object prop; + EMACS_INT align_to_max = + (col < MOST_POSITIVE_FIXNUM - INT_MAX + ? (EMACS_INT) INT_MAX + col + : MOST_POSITIVE_FIXNUM); + + plist = XCDR (val); + if ((prop = Fplist_get (plist, QCwidth), + RANGED_FIXNUMP (0, prop, INT_MAX)) + || (prop = Fplist_get (plist, QCrelative_width), + RANGED_FIXNUMP (0, prop, INT_MAX))) + width = XFIXNUM (prop); + else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) + && XFLOAT_DATA (prop) <= INT_MAX) + width = (int)(XFLOAT_DATA (prop) + 0.5); + else if ((prop = Fplist_get (plist, QCalign_to), + RANGED_FIXNUMP (col, prop, align_to_max))) + width = XFIXNUM (prop) - col; + else if (FLOATP (prop) && col <= XFLOAT_DATA (prop) + && (XFLOAT_DATA (prop) <= align_to_max)) + width = (int)(XFLOAT_DATA (prop) + 0.5) - col; + } + /* Handle 'display' strings. */ + else if (STRINGP (val)) + width = XFIXNUM (Fstring_width (val, Qnil, Qnil)); if (width >= 0) { @@ -504,7 +513,8 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) /* For :relative-width, we need to multiply by the column width of the character at POS, if it is greater than 1. */ - if (!NILP (Fplist_get (plist, QCrelative_width)) + if (!NILP (plist) + && !NILP (Fplist_get (plist, QCrelative_width)) && !NILP (BVAR (current_buffer, enable_multibyte_characters))) { int b, wd; @@ -516,6 +526,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) return width; } } + return -1; } commit 9029212c869aa532e14d5e2048df070902d4ca8f Author: Alan Mackenzie Date: Sat Feb 5 10:43:27 2022 +0000 * lisp/emacs-lisp/debug-early.el: Improve the documentation diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 718000bfa4..e557643e46 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -24,10 +24,12 @@ ;;; Commentary: -;; This file dumps a backtrace on stderr when an error is thrown. -;; It has no dependencies on any Lisp libraries and is thus suitable -;; for generating backtraces in the early parts of bootstrapping. It -;; is also good for generating backtraces in batch mode in general. +;; This file dumps a backtrace on stderr when an error is thrown. It +;; has no dependencies on any Lisp libraries and is thus used for +;; generating backtraces for bugs in the early parts of bootstrapping. +;; It is also always used in batch model. It was introduced in Emacs +;; 29, before which there was no backtrace available during early +;; bootstrap. (defalias 'debug-early-backtrace #'(lambda () @@ -60,14 +62,22 @@ of the build process." (defalias 'debug-early #'(lambda (&rest args) - "Print a trace of Lisp function calls currently active. + "Print an error message with a backtrace of active Lisp function calls. The output stream used is the value of `standard-output'. -There should be two ARGS, the symbol `error' and a cons of -the error symbol and its data. +The Emacs core calls this function after an error has been +signaled, and supplies two ARGS. These are the symbol +`error' (which is ignored) and a cons of the error symbol and the +error data. + +`debug-early' is a simplified version of `debug', and is +available during the early parts of the build process. It is +superseded by `debug' after enough Lisp has been loaded to +support the latter, except in batch mode which always uses +`debug-early'. -This is a simplified version of `debug', intended for use -in debugging the early parts of the build process." +(In versions of Emacs prior to Emacs 29, no backtrace was +available before `debug' was usable.)" (princ "\nError: ") (prin1 (car (car (cdr args)))) ; The error symbol. (princ " ") commit 49192d14189a4abcf8f8e125adb8dab8c5064392 Author: Michael Albinus Date: Sat Feb 5 11:30:20 2022 +0100 Remove superfluous `font-lock-add-keywords' calls in Tramp * lisp/net/tramp.el (with-parsed-tramp-file-name) (with-tramp-progress-reporter, with-tramp-file-property) (with-tramp-connection-property, with-tramp-locked-connection): * lisp/net/tramp-gvfs.el (with-tramp-dbus-call-method) (with-tramp-dbus-get-all-properties): Do not call `font-lock-add-keywords' for macros, it isn't needed anymore. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 763a9e849f..d3af9f4769 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -916,8 +916,6 @@ or `dbus-call-method-asynchronously'." ;; when loading. (dbus-ignore-errors (tramp-dbus-function ,vec func args)))) -(font-lock-add-keywords 'emacs-lisp-mode '("\\")) - (defmacro with-tramp-dbus-get-all-properties (vec bus service path interface) "Return all properties of INTERFACE. @@ -932,8 +930,6 @@ The call will be traced by Tramp with trace level 6." (tramp-dbus-function ,vec #'dbus-get-all-properties (list ,bus ,service ,path ,interface)))) -(font-lock-add-keywords 'emacs-lisp-mode '("\\")) - (defvar tramp-gvfs-dbus-event-vector nil "Current Tramp file name to be used, as vector. It is needed when D-Bus signals or errors arrive, because there diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9caeffc5aa..6d8f267ddf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2302,8 +2302,6 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', (ignore ,@(mapcar #'car bindings)) ,@body))) -(font-lock-add-keywords 'emacs-lisp-mode '("\\")) - (defun tramp-progress-reporter-update (reporter &optional value suffix) "Report progress of an operation for Tramp." (let* ((parameters (cdr reporter)) @@ -2340,9 +2338,6 @@ without a visible progress reporter." (if tm (cancel-timer tm)) (tramp-message ,vec ,level "%s...%s" ,message cookie))))) -(font-lock-add-keywords - 'emacs-lisp-mode '("\\")) - (defmacro with-tramp-file-property (vec file property &rest body) "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache. FILE must be a local file name on a connection identified via VEC." @@ -2359,8 +2354,6 @@ FILE must be a local file name on a connection identified via VEC." value) ,@body)) -(font-lock-add-keywords 'emacs-lisp-mode '("\\")) - (defmacro with-tramp-connection-property (key property &rest body) "Check in Tramp for property PROPERTY, otherwise execute BODY and set." (declare (indent 2) (debug t)) @@ -2374,9 +2367,6 @@ FILE must be a local file name on a connection identified via VEC." (tramp-set-connection-property ,key ,property value)) value)) -(font-lock-add-keywords - 'emacs-lisp-mode '("\\")) - (defun tramp-drop-volume-letter (name) "Cut off unnecessary drive letter from file NAME. The functions `tramp-*-handle-expand-file-name' call `expand-file-name' @@ -5027,10 +5017,6 @@ Mostly useful to protect BODY from being interrupted by timers." ,@body) (tramp-flush-connection-property ,proc "locked")))) -;; FIXME: This call is redundant in current Emacsen. -(font-lock-add-keywords - 'emacs-lisp-mode '("\\")) - (defun tramp-accept-process-output (proc &optional timeout) "Like `accept-process-output' for Tramp processes. This is needed in order to hide `last-coding-system-used', which is set commit 3a8e140ad115633791d057bd10998d80c33e6dc7 Author: Michael Albinus Date: Sat Feb 5 11:12:17 2022 +0100 Adapt Tramp to changed unload behavior (bug#53632) * lisp/net/tramp.el (tramp-autoload-file-name-handler) (tramp-register-autoload-file-name-handlers) (tramp-unload-file-name-handlers, tramp-unload-tramp): * lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-regexp) (tramp-archive-autoload-file-name-handler) (tramp-register-archive-file-name-handler): Add `tramp-autoload' function property. diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index d3f427932f..c6523003b8 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -190,6 +190,8 @@ It must be supported by libarchive(3).") "\\)" ;; \1 "\\(" "/" ".*" "\\)" "\\'"))) ;; \2 +(put #'tramp-archive-autoload-file-name-regexp 'tramp-autoload t) + ;; In older Emacsen (prior 27.1), `tramp-archive-autoload-file-name-regexp' ;; is not autoloaded. So we cannot expect it to be known in ;; tramp-loaddefs.el. But it exists, when tramp-archive.el is loaded. @@ -366,6 +368,8 @@ arguments to pass to the OPERATION." (tramp-archive-autoload t)) (apply #'tramp-autoload-file-name-handler operation args))))) +(put #'tramp-archive-autoload-file-name-handler 'tramp-autoload t) + ;;;###autoload (progn (defun tramp-register-archive-file-name-handler () "Add archive file name handler to `file-name-handler-alist'." @@ -375,6 +379,8 @@ arguments to pass to the OPERATION." #'tramp-archive-autoload-file-name-handler)) (put #'tramp-archive-autoload-file-name-handler 'safe-magic t)))) +(put #'tramp-register-archive-file-name-handler 'tramp-autoload t) + ;;;###autoload (progn (add-hook 'after-init-hook #'tramp-register-archive-file-name-handler) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 126badca3e..9caeffc5aa 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2742,6 +2742,8 @@ Falls back to normal file name handler if no Tramp file name handler exists." (load "tramp" 'noerror 'nomessage))) (apply operation args))) +(put #'tramp-autoload-file-name-handler 'tramp-autoload t) + ;; `tramp-autoload-file-name-handler' must be registered before ;; evaluation of site-start and init files, because there might exist ;; remote files already, f.e. files kept via recentf-mode. @@ -2753,6 +2755,7 @@ Falls back to normal file name handler if no Tramp file name handler exists." #'tramp-autoload-file-name-handler)) (put #'tramp-autoload-file-name-handler 'safe-magic t))) +(put #'tramp-register-autoload-file-name-handlers 'tramp-autoload t) ;;;###autoload (tramp-register-autoload-file-name-handlers) (defun tramp-use-absolute-autoload-file-names () @@ -2866,6 +2869,7 @@ whether HANDLER is to be called. Add operations defined in (string-prefix-p "tramp-" (symbol-name (cdr fnh)))) (setq file-name-handler-alist (delq fnh file-name-handler-alist)))))) +(put #'tramp-unload-file-name-handlers 'tramp-autoload t) (add-hook 'tramp-unload-hook #'tramp-unload-file-name-handlers) ;;; File name handler functions for completion mode: @@ -5966,6 +5970,8 @@ BODY is the backend specific code." ;; Maybe it's not loaded yet. (ignore-errors (unload-feature 'tramp 'force)))) +(put #'tramp-unload-tramp 'tramp-autoload t) + (provide 'tramp) (run-hooks 'tramp--startup-hook)