commit 246557f33e13a437d3582445f914a7170ee11027 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat Jan 22 09:06:21 2022 +0200 Change visibility of "Undelete Frame" * lisp/menu-bar.el (menu-bar-file-menu): Make "Undelete Frame" always visible. Suggested by Gregory Heytings . diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d1ca16dbf6..817c2d485e 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -115,7 +115,7 @@ (bindings--define-key menu [undelete-last-deleted-frame] '(menu-item "Undelete Frame" undelete-frame - :visible (and undelete-frame-mode + :enable (and undelete-frame-mode (car undelete-frame--deleted-frames)) :help "Undelete the most recently deleted frame")) commit a51a2a13ede7d7054ba3654624354e7d1243b1cb Merge: b44505d6ec b63baeafd2 Author: Eli Zaretskii Date: Sat Jan 22 09:03:11 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit b63baeafd24c506863da280e03efdcf0d1d8d0eb Author: Po Lu Date: Sat Jan 22 15:01:28 2022 +0800 Get rid of some unnecessary code in handle_one_xevent * src/xterm.c (handle_one_xevent): Stop mutating event->xkey. diff --git a/src/xterm.c b/src/xterm.c index 81baeddbca..36e0045d2e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9276,7 +9276,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, int modifiers; Lisp_Object coding_system = Qlatin_1; Lisp_Object c; - /* Event will be modified. */ + /* `xkey' will be modified, but it's not important to modify + `event' itself. */ XKeyEvent xkey = event->xkey; #ifdef USE_GTK @@ -9538,8 +9539,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (keysym == NoSymbol) break; } - /* FIXME: check side effects and remove this. */ - ((XEvent *) event)->xkey = xkey; } done_keysym: #ifdef HAVE_X_I18N commit b44505d6eca8b0029fff166090abf0d7f7e3ce27 Merge: 87107b05a1 643985e8b6 Author: Eli Zaretskii Date: Sat Jan 22 08:26:54 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 643985e8b6d5277a83b4d8657bbdb8452591ce83 Merge: d878c4537d fbc9b121e0 Author: Stefan Kangas Date: Sat Jan 22 06:30:25 2022 +0100 ; Merge from origin/emacs-28 The following commits were skipped: fbc9b121e0 Fix memory-report-object-size to initialize memory-report-... f08dfa9b53 Fix menu-bar mouse clicks in "C-h c" and "C-h k" (bug#53322) commit d878c4537ddee150a5a369dc90c5823add006cca Author: Po Lu Date: Sat Jan 22 10:25:06 2022 +0800 Fix recent changes to visible bell code * src/gtkutil.c (xg_create_scroll_bar): (xg_create_horizontal_scroll_bar): Stop ensuring an X window before the widget is realized. (xg_update_scrollbar_pos): (xg_update_horizontal_scrollbar_pos): Ensure such a window here instead. diff --git a/src/gtkutil.c b/src/gtkutil.c index 0ac71af808..eb14856062 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4431,10 +4431,6 @@ xg_create_scroll_bar (struct frame *f, wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj)); -#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) - eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll))); -#endif - xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback, end_callback, scroll_bar_name); bar->horizontal = 0; @@ -4467,10 +4463,6 @@ xg_create_horizontal_scroll_bar (struct frame *f, wscroll = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (hadj)); -#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) - eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll))); -#endif - xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback, end_callback, scroll_bar_name); bar->horizontal = 1; @@ -4542,6 +4534,12 @@ xg_update_scrollbar_pos (struct frame *f, gtk_widget_show_all (wparent); gtk_widget_set_size_request (wscroll, width, height); } + +#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) + if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll))) + emacs_abort (); +#endif + if (oldx != -1 && oldw > 0 && oldh > 0) { /* Clear under old scroll bar position. */ @@ -4595,7 +4593,6 @@ xg_update_horizontal_scrollbar_pos (struct frame *f, int width, int height) { - GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); if (wscroll) @@ -4642,6 +4639,11 @@ xg_update_horizontal_scrollbar_pos (struct frame *f, pgtk_clear_area (f, oldx, oldy, oldw, oldh); #endif +#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) + if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll))) + emacs_abort (); +#endif + /* GTK does not redraw until the main loop is entered again, but if there are no X events pending we will not enter it. So we sync here to get some events. */ commit 882997e830d5a761e1cf86a2064df6d0958a5b51 Author: Po Lu Date: Sat Jan 22 10:12:18 2022 +0800 Clean up visible bell code on X * src/gtkutil.c (xg_create_scroll_bar): (xg_create_horizontal_scroll_bar): Ensure that the scroll bars have their own X windows. * src/xterm.c (XTflash): Remove use of GDK functions for drawing. diff --git a/src/gtkutil.c b/src/gtkutil.c index 3cb8cd1533..0ac71af808 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -4431,6 +4431,10 @@ xg_create_scroll_bar (struct frame *f, wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj)); +#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) + eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll))); +#endif + xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback, end_callback, scroll_bar_name); bar->horizontal = 0; @@ -4463,6 +4467,10 @@ xg_create_horizontal_scroll_bar (struct frame *f, wscroll = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (hadj)); +#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0) + eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll))); +#endif + xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback, end_callback, scroll_bar_name); bar->horizontal = 1; diff --git a/src/xterm.c b/src/xterm.c index 0f98cc7bec..81baeddbca 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4650,38 +4650,6 @@ XTflash (struct frame *f) block_input (); { -#ifdef USE_GTK - /* Use Gdk routines to draw. This way, we won't draw over scroll bars - when the scroll bars and the edit widget share the same X window. */ - GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); -#ifdef HAVE_GTK3 -#if GTK_CHECK_VERSION (3, 22, 0) - cairo_region_t *region = gdk_window_get_visible_region (window); - GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region); - cairo_t *cr = gdk_drawing_context_get_cairo_context (context); -#else - cairo_t *cr = gdk_cairo_create (window); -#endif - cairo_set_source_rgb (cr, 1, 1, 1); - cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE); -#define XFillRectangle(d, win, gc, x, y, w, h) \ - do { \ - cairo_rectangle (cr, x, y, w, h); \ - cairo_fill (cr); \ - } \ - while (false) -#else /* ! HAVE_GTK3 */ - GdkGCValues vals; - GdkGC *gc; - vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) - ^ FRAME_BACKGROUND_PIXEL (f)); - vals.function = GDK_XOR; - gc = gdk_gc_new_with_values (window, - &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); -#define XFillRectangle(d, win, gc, x, y, w, h) \ - gdk_draw_rectangle (window, gc, true, x, y, w, h) -#endif /* ! HAVE_GTK3 */ -#else /* ! USE_GTK */ GC gc; /* Create a GC that will use the GXxor function to flip foreground @@ -4696,7 +4664,6 @@ XTflash (struct frame *f) gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), GCFunction | GCForeground, &values); } -#endif { /* Get the height not including a menu bar widget. */ int height = FRAME_PIXEL_HEIGHT (f); @@ -4772,22 +4739,7 @@ XTflash (struct frame *f) XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); - -#ifdef USE_GTK -#ifdef HAVE_GTK3 -#if GTK_CHECK_VERSION (3, 22, 0) - gdk_window_end_draw_frame (window, context); - cairo_region_destroy (region); -#else - cairo_destroy (cr); -#endif -#else - g_object_unref (G_OBJECT (gc)); -#endif -#undef XFillRectangle -#else XFreeGC (FRAME_X_DISPLAY (f), gc); -#endif x_flush (f); } } commit 5672ee5663c6891c5a858e4b2f50246b6898eb1b Author: Po Lu Date: Sat Jan 22 09:11:33 2022 +0800 Fix crash when the visible bell is rung but there is no cairo surface * src/pgtkterm.c (pgtk_flash): Return if the cairo surface is not present. (bug#53420) (pgtk_cr_update_surface_desired_size): Reformat comment. diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 4c38ff5a59..8073f51c61 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -3734,6 +3734,9 @@ pgtk_flash (struct frame *f) block_input (); { + if (!FRAME_CR_CONTEXT (f)) + return; + cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f); int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f); @@ -7041,13 +7044,12 @@ If set to a non-float value, there will be no wait at all. */); } /* Cairo does not allow resizing a surface/context after it is - * created, so we need to trash the old context, create a new context - * on the next cr_clip_begin with the new dimensions and request a - * re-draw. - * - * This Will leave the active context available to present on screen - * until a redrawn frame is completed. - */ + created, so we need to trash the old context, create a new context + on the next cr_clip_begin with the new dimensions and request a + re-draw. + + This will leave the active context available to present on screen + until a redrawn frame is completed. */ void pgtk_cr_update_surface_desired_size (struct frame *f, int width, int height, bool force) { commit fac8d0ac2f4cbdbd5828a57ddc90adf6601d956b Author: Paul Eggert Date: Fri Jan 21 14:45:57 2022 -0800 Avoid glitches in ELC lines in build output * src/verbose.mk.in (have_working_info): New macro. (AM_V_ELC, AM_V_ELN): Use 'echo' rather than $(info ...) on buggy versions of GNU Make. diff --git a/src/verbose.mk.in b/src/verbose.mk.in index c0bf67abd4..eb99e42695 100644 --- a/src/verbose.mk.in +++ b/src/verbose.mk.in @@ -33,19 +33,45 @@ AM_V_GLOBALS = AM_V_NO_PD = AM_V_RC = else + +# Whether $(info ...) works. This is to work around a bug in GNU Make +# 4.3 and earlier, which implements $(info MSG) via two system calls +# { write (..., "MSG", 3); write (..., "\n", 1); } +# which looks bad when make -j interleaves two of these at about the same time. +# +# Later versions of GNU Make have the 'notintermediate' feature, +# so assume that $(info ...) works if this feature is present. +# +have_working_info = $(filter notintermediate,$(value .FEATURES)) +# +# The workaround is to use the shell and 'echo' rather than $(info ...). +# The workaround is done only for AM_V_ELC and AM_V_ELN, +# since the bug is not annoying elsewhere. + AM_V_AR = @$(info $ AR $@) AM_V_at = @ AM_V_CC = @$(info $ CC $@) AM_V_CXX = @$(info $ CXX $@) AM_V_CCLD = @$(info $ CCLD $@) AM_V_CXXLD = @$(info $ CXXLD $@) + ifeq ($(HAVE_NATIVE_COMP)-$(NATIVE_DISABLED)-$(ANCIENT),yes--) +ifdef have_working_info AM_V_ELC = @$(info $ ELC+ELN $@) AM_V_ELN = @$(info $ ELN $@) else +AM_V_ELC = @echo " ELC+ELN " $@; +AM_V_ELN = @echo " ELN " $@; +endif +else +ifdef have_working_info AM_V_ELC = @$(info $ ELC $@) +else +AM_V_ELC = @echo " ELC " $@; +endif AM_V_ELN = endif + AM_V_GEN = @$(info $ GEN $@) AM_V_GLOBALS = @$(info $ GEN globals.h) AM_V_NO_PD = --no-print-directory commit 882bbeb1f9f40ccf9f1e3f3423fd7cb12a4859ab Author: Paul Eggert Date: Fri Jan 21 13:33:55 2022 -0800 Simplify AM_V_ELC setup * src/verbose.mk.in (AM_V_ELC, AM_V_ELN): Use simpler Make ‘if’s. diff --git a/src/verbose.mk.in b/src/verbose.mk.in index 01076df946..c0bf67abd4 100644 --- a/src/verbose.mk.in +++ b/src/verbose.mk.in @@ -39,23 +39,13 @@ AM_V_CC = @$(info $ CC $@) AM_V_CXX = @$(info $ CXX $@) AM_V_CCLD = @$(info $ CCLD $@) AM_V_CXXLD = @$(info $ CXXLD $@) -ifeq ($(HAVE_NATIVE_COMP),yes) -ifneq ($(NATIVE_DISABLED),1) -ifneq ($(ANCIENT),yes) +ifeq ($(HAVE_NATIVE_COMP)-$(NATIVE_DISABLED)-$(ANCIENT),yes--) AM_V_ELC = @$(info $ ELC+ELN $@) AM_V_ELN = @$(info $ ELN $@) else AM_V_ELC = @$(info $ ELC $@) AM_V_ELN = endif -else -AM_V_ELC = @$(info $ ELC $@) -AM_V_ELN = -endif -else -AM_V_ELC = @$(info $ ELC $@) -AM_V_ELN = -endif AM_V_GEN = @$(info $ GEN $@) AM_V_GLOBALS = @$(info $ GEN globals.h) AM_V_NO_PD = --no-print-directory commit 2519c5773c053068622a5e0d2ca191f61a418f1c Author: Glenn Morris Date: Fri Jan 21 13:44:56 2022 -0800 * lisp/cus-start.el (polling-period): Update type. Flagged by test-custom-opts. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 7f639240f5..afdbd82457 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -370,7 +370,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of (auto-save-timeout auto-save (choice (const :tag "off" nil) (integer :format "%v"))) (echo-keystrokes minibuffer number) - (polling-period keyboard integer) + (polling-period keyboard float) (double-click-time mouse (restricted-sexp :match-alternatives (integerp 'nil 't))) (double-click-fuzz mouse integer "22.1") commit 98355833ba0d7dc20742122334be1bfaefac7873 Author: Glenn Morris Date: Fri Jan 21 12:12:43 2022 -0800 * src/keyboard.c (start_polling): Fix type mixup. Flagged by --enable-check-lisp-object-type. diff --git a/src/keyboard.c b/src/keyboard.c index d2919ed9f6..70e055a9df 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1941,7 +1941,7 @@ start_polling (void) a different interval, start a new one. */ if (NUMBERP (Vpolling_period) && (poll_timer == NULL - || !Fequal (Vpolling_period, poll_timer_time))) + || NILP (Fequal (Vpolling_period, poll_timer_time)))) { struct timespec interval = dtotimespec (XFLOATINT (Vpolling_period)); commit adf00298b60e87f76c64b1ba68c0424df55982e1 Author: Lars Ingebrigtsen Date: Fri Jan 21 15:22:24 2022 +0100 Disable background image fetching from asking for passwords * lisp/url/url-queue.el (url-queue-start-retrieve): Inhibit prompting for passwords from these background requests. diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index 8741bca942..d353f0c011 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el @@ -155,14 +155,19 @@ The variable `url-queue-timeout' sets a timeout." (defun url-queue-start-retrieve (job) (setf (url-queue-buffer job) (ignore-errors - (with-current-buffer (if (buffer-live-p (url-queue-context-buffer job)) + (with-current-buffer (if (buffer-live-p + (url-queue-context-buffer job)) (url-queue-context-buffer job) (current-buffer)) - (let ((url-request-noninteractive t)) - (url-retrieve (url-queue-url job) - #'url-queue-callback-function (list job) - (url-queue-silentp job) - (url-queue-inhibit-cookiesp job))))))) + (let ((url-request-noninteractive t) + ;; This will disable querying the user for + ;; credentials if one of the things we're fetching + ;; in the background return a header requesting it. + (url-request-extra-headers '(("Authorization" . "")))) + (url-retrieve (url-queue-url job) + #'url-queue-callback-function (list job) + (url-queue-silentp job) + (url-queue-inhibit-cookiesp job))))))) (defun url-queue-prune-old-entries () (let (dead-jobs) commit 087d031ec691f8bdf38358fe993806d346bc6f25 Author: Lars Ingebrigtsen Date: Fri Jan 21 15:03:32 2022 +0100 Further emake tweaks diff --git a/admin/emake b/admin/emake index 914e452d41..6c778c85d4 100755 --- a/admin/emake +++ b/admin/emake @@ -80,6 +80,7 @@ The GNU allocators don't work|\ ^'\.git/|\ ^\^\(\(|\ ^ANCIENT=yes make|\ +^touch -t|\ ^'build-aux/git-hooks\ " | \ while read commit b8ffdc0694777b6872a5c66dd9802e83799ae661 Author: Lars Ingebrigtsen Date: Fri Jan 21 15:00:14 2022 +0100 Fix previous emake change * admin/emake (cores): Fix typo in previous change. diff --git a/admin/emake b/admin/emake index bfada1eb3e..914e452d41 100755 --- a/admin/emake +++ b/admin/emake @@ -79,8 +79,8 @@ The GNU allocators don't work|\ ^git config |\ ^'\.git/|\ ^\^\(\(|\ +^ANCIENT=yes make|\ ^'build-aux/git-hooks\ -^ANCIENT=yes make\ " | \ while read do commit 88e47934d9ab75f46dc02bfb784bb213f45f6336 Author: Po Lu Date: Fri Jan 21 21:48:57 2022 +0800 * src/keyboard.c (syms_of_keyboard): Fix build without input polling. diff --git a/src/keyboard.c b/src/keyboard.c index 6f1614a7df..d2919ed9f6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12082,8 +12082,10 @@ syms_of_keyboard (void) help_form_saved_window_configs = Qnil; staticpro (&help_form_saved_window_configs); +#ifdef POLL_FOR_INPUT poll_timer_time = Qnil; staticpro (&poll_timer_time); +#endif defsubr (&Scurrent_idle_time); defsubr (&Sevent_symbol_parse_modifiers); commit 62a84eea34c33bd1d4b13b2c84cea7a6b082278c Author: Lars Ingebrigtsen Date: Fri Jan 21 14:45:23 2022 +0100 Improve the completion-category-overrides doc string * lisp/minibuffer.el (completion-category-overrides): Clarify what this variable does (bug#22324). (completion-category-defaults): Mention the overrides variable. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ab760a42d1..d58c23af8f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1004,7 +1004,9 @@ an association list that can specify properties such as: - `styles': the list of `completion-styles' to use for that category. - `cycle': the `completion-cycle-threshold' to use for that category. Categories are symbols such as `buffer' and `file', used when -completing buffer and file names, respectively.") +completing buffer and file names, respectively. + +Also see `completion-category-overrides'.") (defcustom completion-category-overrides nil "List of category-specific user overrides for completion styles. @@ -1014,7 +1016,9 @@ an association list that can specify properties such as: - `cycle': the `completion-cycle-threshold' to use for that category. Categories are symbols such as `buffer' and `file', used when completing buffer and file names, respectively. -This overrides the defaults specified in `completion-category-defaults'." + +If a property in a category is specified by this variable, it +overrides the default specified in `completion-category-defaults'." :version "25.1" :type `(alist :key-type (choice :tag "Category" (const buffer) commit 8d4fffb6437bd86300c924034c8f787a62064dd1 Author: Lars Ingebrigtsen Date: Fri Jan 21 14:31:11 2022 +0100 Remove text mistakenly added to the diff--iterate-hunks doc string * lisp/vc/diff-mode.el (diff--iterate-hunks): Remove text added by mistake to the doc string. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index ae2f545966..731d1e8256 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2270,8 +2270,7 @@ Return new point, if it was moved." (defun diff--iterate-hunks (max fun) "Iterate over all hunks between point and MAX. -Call FUN with two args (BEG and END) for each hunk. -If INHIBIT-ERROR, ignore malformed hunks." +Call FUN with two args (BEG and END) for each hunk." (save-excursion (catch 'malformed (let* ((beg (or (ignore-errors (diff-beginning-of-hunk)) commit d7f0a0538d954f8e99dd55a2881b905ee053797e Author: Lars Ingebrigtsen Date: Fri Jan 21 14:20:31 2022 +0100 Followup fix to previous message-update-smtp-method-header change * lisp/gnus/message.el (message-update-smtp-method-header): Narrow to the headers first. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 2735c043b3..a6c6a16653 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4360,6 +4360,7 @@ it is left unchanged." (let ((from (cadr (mail-extract-address-components (save-restriction (widen) + (message-narrow-to-headers-or-head) (message-fetch-field "From"))))) method) (catch 'exit commit 1fefb15aa8ef1de3e78e55af0395bc543bb8018f Author: Lars Ingebrigtsen Date: Fri Jan 21 14:18:19 2022 +0100 Allow From to be part of message-hidden-headers * lisp/gnus/message.el (message-update-smtp-method-header): Don't bug out if the From header is part of `message-hidden-headers' (bug#52871). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 3cd1b7eefe..2735c043b3 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4357,7 +4357,10 @@ it is left unchanged." (defun message-update-smtp-method-header () "Insert an X-Message-SMTP-Method header according to `message-server-alist'." (unless (message-fetch-field "X-Message-SMTP-Method") - (let ((from (cadr (mail-extract-address-components (message-fetch-field "From")))) + (let ((from (cadr (mail-extract-address-components + (save-restriction + (widen) + (message-fetch-field "From"))))) method) (catch 'exit (dolist (server message-server-alist) commit 87107b05a17af95e190982a7f62671563405c829 Merge: c2e28aabcc 1228ec3e1d Author: Eli Zaretskii Date: Fri Jan 21 14:11:22 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 1228ec3e1d7657c9eb50184719410f37ed0eb750 Author: Jim Porter Date: Thu Jan 20 19:51:39 2022 -0800 Don't use 'eshell-eval-using-options' for 'eshell/source' or 'eshell/.' This makes 'source' and '.' in Eshell more compatible with regular shells, which just treat the first argument as the file to source and all subsequent arguments as arguments to that file. * lisp/eshell/em-script.el (eshell/source, eshell/.): Don't use 'eshell-eval-using-options'. * etc/NEWS: Announce the change (bug#53293) diff --git a/etc/NEWS b/etc/NEWS index 4cf99490ce..a4908017a2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -104,6 +104,11 @@ files that were compiled with an old EIEIO (Emacs<25). ** 'C-x 8 .' has been moved to 'C-x 8 . .'. This is to open up the 'C-x 8 .' map to bind further characters there. +--- +** 'source' and '.' in Eshell no longer accept the '--help' option. +This is for compatibility with the shell versions of these commands, +which don't handle options like '--help' in any special way. + * Changes in Emacs 29.1 diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index e8459513f3..e0bcd8b099 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el @@ -113,27 +113,13 @@ Comments begin with `#'." (defun eshell/source (&rest args) "Source a file in a subshell environment." - (eshell-eval-using-options - "source" args - '((?h "help" nil nil "show this usage screen") - :show-usage - :usage "FILE [ARGS] -Invoke the Eshell commands in FILE in a subshell, binding ARGS to $1, -$2, etc.") - (eshell-source-file (car args) (cdr args) t))) + (eshell-source-file (car args) (cdr args) t)) (put 'eshell/source 'eshell-no-numeric-conversions t) (defun eshell/. (&rest args) "Source a file in the current environment." - (eshell-eval-using-options - "." args - '((?h "help" nil nil "show this usage screen") - :show-usage - :usage "FILE [ARGS] -Invoke the Eshell commands in FILE within the current shell -environment, binding ARGS to $1, $2, etc.") - (eshell-source-file (car args) (cdr args)))) + (eshell-source-file (car args) (cdr args))) (put 'eshell/. 'eshell-no-numeric-conversions t) commit 90de226e218883f2a62ce3e1ba9a79ef8e1be70c Author: Jim Porter Date: Wed Jan 19 18:59:23 2022 -0800 Raise an error from 'eval-eval-using-options' for unknown options * lisp/eshell/em-basic.el (eshell/echo): Add -E option. * lisp/eshell/esh-opt.el (eshell--process-option): Raise an error if an unknown option is encountered, even when :external is nil. * test/lisp/eshell/esh-opt-tests.el (esh-opt-process-args-test) (test-eshell-eval-using-options): Add test cases for this. diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index d3b15c900b..ba868cee59 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el @@ -113,11 +113,16 @@ or `eshell-printn' for display." "Implementation of `echo'. See `eshell-plain-echo-behavior'." (eshell-eval-using-options "echo" args - '((?n nil (nil) output-newline "do not output the trailing newline") - (?N nil (t) output-newline "terminate with a newline") - (?h "help" nil nil "output this help screen") + '((?n nil (nil) output-newline + "do not output the trailing newline") + (?N nil (t) output-newline + "terminate with a newline") + (?E nil nil _disable-escapes + "don't interpret backslash escapes (default)") + (?h "help" nil nil + "output this help screen") :preserve-args - :usage "[-n | -N] [object]") + :usage "[OPTION]... [OBJECT]...") (if eshell-plain-echo-behavior (eshell-echo args (if output-newline (car output-newline) t)) ;; In Emacs 28.1 and earlier, "-n" was used to add a newline to diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index bba1c4ad25..c802bee3af 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -257,12 +257,12 @@ triggered to say that the switch is unrecognized." remaining (let ((extcmd (memq ':external options))) (when extcmd - (setq extcmd (eshell-search-path (cadr extcmd))) - (if extcmd - (throw 'eshell-ext-command extcmd) - (error (if (characterp (car switch)) "%s: unrecognized option -%c" - "%s: unrecognized option --%s") - name (car switch)))))))) + (setq extcmd (eshell-search-path (cadr extcmd)))) + (if extcmd + (throw 'eshell-ext-command extcmd) + (error (if (characterp (car switch)) "%s: unrecognized option -%c" + "%s: unrecognized option --%s") + name (car switch))))))) (defun eshell--process-args (name args options) "Process the given ARGS using OPTIONS." diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el index 255768635b..b76ed8866d 100644 --- a/test/lisp/eshell/esh-opt-tests.el +++ b/test/lisp/eshell/esh-opt-tests.el @@ -27,41 +27,63 @@ (should (equal '(t) (eshell--process-args - "sudo" - '("-a") - '((?a "all" nil show-all ""))))) - (should - (equal '(nil) - (eshell--process-args - "sudo" - '("-g") - '((?a "all" nil show-all ""))))) + "sudo" '("-a") + '((?a "all" nil show-all + "do not ignore entries starting with ."))))) (should (equal '("root" "world") (eshell--process-args - "sudo" - '("-u" "root" "world") - '((?u "user" t user "execute a command as another USER"))))) + "sudo" '("-u" "root" "world") + '((?u "user" t user + "execute a command as another USER"))))) (should (equal '(nil "emerge" "-uDN" "world") (eshell--process-args - "sudo" - '("emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER") + "sudo" '("emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER") :parse-leading-options-only)))) (should (equal '("root" "emerge" "-uDN" "world") (eshell--process-args - "sudo" - '("-u" "root" "emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER") + "sudo" '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER") :parse-leading-options-only)))) (should (equal '("DN" "emerge" "world") (eshell--process-args - "sudo" - '("-u" "root" "emerge" "-uDN" "world") - '((?u "user" t user "execute a command as another USER")))))) + "sudo" '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user + "execute a command as another USER"))))) + + ;; Test :external. + (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) + (should + (equal '(nil "/some/path") + (eshell--process-args + "ls" '("/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls"))))) + (cl-letf (((symbol-function 'eshell-search-path) #'identity)) + (should + (equal '(no-catch eshell-ext-command "ls") + (should-error + (eshell--process-args + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls")) + :type 'no-catch)))) + (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) + (should-error + (eshell--process-args + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .") + :external "ls")) + :type 'error))) (ert-deftest test-eshell-eval-using-options () "Tests for `eshell-eval-using-options'." @@ -190,7 +212,27 @@ '((?u "user" t user "execute a command as another USER") :parse-leading-options-only) (should (eq user nil)) - (should (equal args '("emerge" "-uDN" "world"))))) + (should (equal args '("emerge" "-uDN" "world")))) + + ;; Test unrecognized options. + (should-error + (eshell-eval-using-options + "ls" '("-u" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all))) + (should-error + (eshell-eval-using-options + "ls" '("-au" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all))) + (should-error + (eshell-eval-using-options + "ls" '("--unrecognized" "/some/path") + '((?a "all" nil show-all + "do not ignore entries starting with .")) + (ignore show-all)))) (provide 'esh-opt-tests) commit a133af7c7f3aa2fd7fb4fea9c54cd082ed1481f3 Author: Theodor Thornhill Date: Fri Jan 21 13:04:29 2022 +0100 Fix indentation in NEWS of cl-flet item * etc/NEWS: Correct description of indentation of 'cl-flet' and 'cl-labels (bug#53410). diff --git a/etc/NEWS b/etc/NEWS index f8c563d10f..4cf99490ce 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -345,7 +345,7 @@ are met. The conditions are given by the argument, which can be These forms now indent like this: (cl-flet ((bla (x) - (* x x))) + (* x x))) (bla 42)) This change also affects 'cl-macrolet', 'cl-flet*' and commit 606dfb60e38bc3237afaa63cd92ef6b738fd54a1 Author: Lars Ingebrigtsen Date: Fri Jan 21 12:48:03 2022 +0100 Clarify Splitting Mail in the Gnus manual * doc/misc/gnus.texi (Splitting Mail): Clarify what happens when crossposting or not (bug#53307). diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index b3efdfbacb..306d66de64 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14838,12 +14838,17 @@ mail belongs in that group. The last of these groups should always be a general one, and the regular expression should @emph{always} be @samp{""} so that it matches any mails that haven't been matched by any of the other regexps. (These rules are -processed from the beginning of the alist toward the end. The first rule -to make a match will ``win'', unless you have crossposting enabled. In -that case, all matching rules will ``win''.) If no rule matched, the mail -will end up in the @samp{bogus} group. When new groups are created by -splitting mail, you may want to run @code{gnus-group-find-new-groups} to -see the new groups. This also applies to the @samp{bogus} group. +processed from the beginning of the alist toward the end. + +If multiple rules match (excluding the general @samp{""} group), mail +is crossposted to all these groups. However, if +@code{nnmail-crosspost} is set to @code{nil}, the first rule to make a +match will ``win''. + +If no rule matched, the mail will end up in the @samp{bogus} group. +When new groups are created by splitting mail, you may want to run +@code{gnus-group-find-new-groups} to see the new groups. This also +applies to the @samp{bogus} group. If you like to tinker with this yourself, you can set this variable to a function of your choice. This function will be called without any commit fbc9b121e0624bd20c2aaddeeb2cd6be14294465 (refs/remotes/origin/emacs-28) Author: Sergey Vinokurov Date: Fri Jan 21 12:42:22 2022 +0100 Fix memory-report-object-size to initialize memory-report--type-size * lisp/emacs-lisp/memory-report.el (memory-report-object-size): Allow using function directly (bug#53310). Do not merge to master. diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index eae0e36234..d9c0f02820 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el @@ -75,7 +75,7 @@ by counted more than once." (defun memory-report-object-size (object) "Return the size of OBJECT in bytes." - (unless memory-report--type-size + (when (zerop (hash-table-count memory-report--type-size)) (memory-report--garbage-collect)) (memory-report--object-size (make-hash-table :test #'eq) object)) commit 4d866fc0f561b023cbc15ee52891cddfa1a354ef Author: Lars Ingebrigtsen Date: Fri Jan 21 12:32:10 2022 +0100 Interpret a "" value of EMACS_TEST_VERBOSE as "off" * doc/misc/ert.texi (Running Tests in Batch Mode): Adjust doc. * lisp/emacs-lisp/ert.el (ert-run-tests-batch): Allow overriding the EMACS_TEST_VERBOSE variable by setting it to "" (bug#53313). diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 0d01efb035..91288db45a 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -444,8 +444,9 @@ emacs -batch -l ert -l my-tests.el \ @vindex EMACS_TEST_VERBOSE@r{, environment variable} By default, ERT test failure summaries are quite brief in batch mode---only the names of the failed tests are listed. If the -@env{EMACS_TEST_VERBOSE} environment variable is set, the failure -summaries will also include the data from the failing test. +@env{EMACS_TEST_VERBOSE} environment variable is set and is non-empty, +the failure summaries will also include the data from the failing +test. @vindex EMACS_TEST_JUNIT_REPORT@r{, environment variable} ERT can produce JUnit test reports in batch mode. If the environment diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 9c6b0e15bb..b6c5b7d6b9 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1423,7 +1423,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) @@ -1435,7 +1436,8 @@ Returns the stats object." (message "%9s %S%s" (ert-string-for-test-result result nil) (ert-test-name test) - (if (getenv "EMACS_TEST_VERBOSE") + (if (cl-plusp + (length (getenv "EMACS_TEST_VERBOSE"))) (ert-reason-for-test-result result) "")))) (message "%s" "")) diff --git a/test/README b/test/README index e44c4a43ee..2ab34ba20e 100644 --- a/test/README +++ b/test/README @@ -111,8 +111,8 @@ debugging. To do that, use By default, ERT test failure summaries are quite brief in batch mode--only the names of the failed tests are listed. If the -$EMACS_TEST_VERBOSE environment variable is set, the failure summaries -will also include the data from the failing test. +$EMACS_TEST_VERBOSE environment variable is set and non-empty, the +failure summaries will also include the data from the failing test. If the $EMACS_TEST_JUNIT_REPORT environment variable is set to a file name, a JUnit test report is generated under this name. commit 5561d5de56db90b6d9ca637f2beb2f837f224009 Author: Lars Ingebrigtsen Date: Fri Jan 21 12:26:30 2022 +0100 Make the edebug-all-defs user option work more reliably * lisp/emacs-lisp/edebug.el (edebug-all-defs): This user option has no effect unless edebug is loaded (because that loads the advice needed for the commands in question) (bug#53331). diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index fe97804ec4..1720393b3e 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -98,7 +98,11 @@ This applies to `eval-defun', `eval-region', `eval-buffer', and You can use the command `edebug-all-defs' to toggle the value of this variable. You may wish to make it local to each buffer with \(make-local-variable \\='edebug-all-defs) in your -`emacs-lisp-mode-hook'." +`emacs-lisp-mode-hook'. + +Note that this user option has no effect unless the edebug +package has been loaded." + :require 'edebug :type 'boolean) ;;;###autoload commit 16c785b6212d78c0a79421e249e8036842e39382 Author: Po Lu Date: Fri Jan 21 19:08:41 2022 +0800 Make xwidgets work on builds that don't use Cairo drawing * configure.ac: Check for the parts of Cairo that are needed for xwidgets when they are enabled without cairo drawing. * src/xterm.c: * src/xwidget.c: Always include cairo-xlib headers when xwidgets are enabled. diff --git a/configure.ac b/configure.ac index 6e15c1727a..515ae82536 100644 --- a/configure.ac +++ b/configure.ac @@ -2913,40 +2913,6 @@ if test "${HAVE_GTK}" = "yes"; then fi fi - -dnl Enable xwidgets if GTK3 and WebKitGTK+ are available. -dnl Enable xwidgets if macOS Cocoa and WebKit framework are available. -HAVE_XWIDGETS=no -XWIDGETS_OBJ= -if test "$with_xwidgets" != "no"; then - if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then - WEBKIT_REQUIRED=2.12 - WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED" - EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES]) - HAVE_XWIDGETS=$HAVE_WEBKIT - XWIDGETS_OBJ="xwidget.o" - elif test "${NS_IMPL_COCOA}" = "yes"; then - dnl FIXME: Check framework WebKit2 - dnl WEBKIT_REQUIRED=M.m.p - WEBKIT_LIBS="-Wl,-framework -Wl,WebKit" - WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers" - HAVE_WEBKIT="yes" - HAVE_XWIDGETS=$HAVE_WEBKIT - XWIDGETS_OBJ="xwidget.o" - NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o" - dnl Update NS_OBJC_OBJ with added nsxwidget.o - AC_SUBST(NS_OBJC_OBJ) - else - AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.]) - fi - - test $HAVE_XWIDGETS = yes || - AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.]) - - AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.]) -fi -AC_SUBST(XWIDGETS_OBJ) - CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS @@ -3451,6 +3417,51 @@ if test "${HAVE_X11}" = "yes"; then fi fi +dnl Enable xwidgets if GTK3 and WebKitGTK+ are available. +dnl Enable xwidgets if macOS Cocoa and WebKit framework are available. +HAVE_XWIDGETS=no +XWIDGETS_OBJ= +if test "$with_xwidgets" != "no"; then + if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then + WEBKIT_REQUIRED=2.12 + WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED" + EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES]) + HAVE_XWIDGETS=$HAVE_WEBKIT + XWIDGETS_OBJ="xwidget.o" + if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then + CAIRO_XLIB_MODULES="cairo >= 1.8.0 cairo-xlib >= 1.8.0" + EMACS_CHECK_MODULES(CAIRO_XLIB, $CAIRO_XLIB_MODULES) + if test $HAVE_CAIRO_XLIB = "yes"; then + CAIRO_CFLAGS="$CAIRO_XLIB_CFLAGS" + CAIRO_LIBS="$CAIRO_XLIB_LIBS" + AC_SUBST(CAIRO_CFLAGS) + AC_SUBST(CAIRO_LIBS) + else + AC_MSG_ERROR([xwidgets requested, but a suitable cairo installation wasn't found]) + fi + fi + elif test "${NS_IMPL_COCOA}" = "yes"; then + dnl FIXME: Check framework WebKit2 + dnl WEBKIT_REQUIRED=M.m.p + WEBKIT_LIBS="-Wl,-framework -Wl,WebKit" + WEBKIT_CFLAGS="-I/System/Library/Frameworks/WebKit.framework/Headers" + HAVE_WEBKIT="yes" + HAVE_XWIDGETS=$HAVE_WEBKIT + XWIDGETS_OBJ="xwidget.o" + NS_OBJC_OBJ="$NS_OBJC_OBJ nsxwidget.o" + dnl Update NS_OBJC_OBJ with added nsxwidget.o + AC_SUBST(NS_OBJC_OBJ) + else + AC_MSG_ERROR([xwidgets requested, it requires GTK3 as X window toolkit or macOS Cocoa as window system.]) + fi + + test $HAVE_XWIDGETS = yes || + AC_MSG_ERROR([xwidgets requested but WebKitGTK+ or WebKit framework not found.]) + + AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.]) +fi +AC_SUBST(XWIDGETS_OBJ) + if test "$window_system" = "pgtk"; then CAIRO_REQUIRED=1.12.0 CAIRO_MODULE="cairo >= $CAIRO_REQUIRED" diff --git a/src/xterm.c b/src/xterm.c index c7d2dadff1..0f98cc7bec 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -173,6 +173,10 @@ along with GNU Emacs. If not, see . */ #include "../lwlib/xlwmenu.h" #endif +#ifdef HAVE_XWIDGETS +#include +#endif + #ifdef USE_X_TOOLKIT /* Include toolkit specific headers for the scroll bar widget. */ diff --git a/src/xwidget.c b/src/xwidget.c index 69e9d5b64b..fb66a17acd 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -39,6 +39,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #ifndef HAVE_PGTK #include #else commit 7eb53e8a72b0a7ac2ed3ac51902ee410bd7fceb5 Author: Lars Ingebrigtsen Date: Fri Jan 21 12:07:31 2022 +0100 Clean up mm-display-inline-fontify slightly * lisp/gnus/mm-view.el (mm-display-inline-fontify): Remove some left-over compat code. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index b110750c09..c40c38a95f 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -504,8 +504,6 @@ If MODE is not set, try to find mode automatically." (setq coding-system (mm-find-buffer-file-coding-system))) (setq text (buffer-string)))) (with-temp-buffer - (buffer-disable-undo) - (mm-enable-multibyte) (insert (cond ((eq charset 'gnus-decoded) (with-current-buffer (mm-handle-buffer handle) (buffer-string))) commit 502dbd1f7c0295c1f01643778d2a6aea17a9808c Author: Lars Ingebrigtsen Date: Fri Jan 21 12:07:04 2022 +0100 Make diff--iterate-hunks more resilient * lisp/vc/diff-mode.el (diff--iterate-hunks): Ignore malformed hunks instead of signalling errors (bug#53343). diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 37eaf254fd..ae2f545966 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2270,23 +2270,27 @@ Return new point, if it was moved." (defun diff--iterate-hunks (max fun) "Iterate over all hunks between point and MAX. -Call FUN with two args (BEG and END) for each hunk." +Call FUN with two args (BEG and END) for each hunk. +If INHIBIT-ERROR, ignore malformed hunks." (save-excursion - (let* ((beg (or (ignore-errors (diff-beginning-of-hunk)) - (ignore-errors (diff-hunk-next) (point)) - max))) - (while (< beg max) - (goto-char beg) - (cl-assert (looking-at diff-hunk-header-re)) - (let ((end - (save-excursion (diff-end-of-hunk) (point)))) - (cl-assert (< beg end)) - (funcall fun beg end) - (goto-char end) - (setq beg (if (looking-at diff-hunk-header-re) - end - (or (ignore-errors (diff-hunk-next) (point)) - max)))))))) + (catch 'malformed + (let* ((beg (or (ignore-errors (diff-beginning-of-hunk)) + (ignore-errors (diff-hunk-next) (point)) + max))) + (while (< beg max) + (goto-char beg) + (unless (looking-at diff-hunk-header-re) + (throw 'malformed nil)) + (let ((end + (save-excursion (diff-end-of-hunk) (point)))) + (unless (< beg end) + (throw 'malformed nil)) + (funcall fun beg end) + (goto-char end) + (setq beg (if (looking-at diff-hunk-header-re) + end + (or (ignore-errors (diff-hunk-next) (point)) + max))))))))) (defun diff--font-lock-refined (max) "Apply hunk refinement from font-lock." commit 3ffa13d0aa00f463e134c568c2d52fb03637a108 Author: Shuguang Sun Date: Fri Jan 21 11:25:27 2022 +0100 Use the correct converter for odf files in doc-view * lisp/doc-view.el (doc-view-pdf/ps->png): Use the correct converter for odf files (bug#53354). diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 5b462b24f5..5e160f5dff 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1189,7 +1189,7 @@ is named like ODF with the extension turned to pdf." "Convert PDF-PS to PNG asynchronously." (funcall (pcase doc-view-doc-type - ('pdf doc-view-pdf->png-converter-function) + ((or 'pdf 'odf) doc-view-pdf->png-converter-function) ('djvu #'doc-view-djvu->tiff-converter-ddjvu) (_ #'doc-view-ps->png-converter-ghostscript)) pdf-ps png nil commit 1e54833e8a4c3d17690a3ca40cd1fab8be674aa5 Author: Lars Ingebrigtsen Date: Fri Jan 21 11:20:56 2022 +0100 Update multisession variables when editing the values * lisp/emacs-lisp/multisession.el (multisession-edit-value): Update multisession variables when editing the values (bug#53361). diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el index e6a2424c51..4a293796a8 100644 --- a/lisp/emacs-lisp/multisession.el +++ b/lisp/emacs-lisp/multisession.el @@ -434,10 +434,16 @@ storage method to list." multisession-edit-mode) (unless id (error "No value on the current line")) - (let* ((object (make-multisession - :package (car id) - :key (cdr id) - :storage multisession-storage)) + (let* ((object (or + ;; If the multisession variable already exists, use + ;; it (so that we update it). + (and (boundp (intern-soft (cdr id))) + (symbol-value (intern (cdr id)))) + ;; Create a new object. + (make-multisession + :package (car id) + :key (cdr id) + :storage multisession-storage))) (value (multisession-value object))) (setf (multisession-value object) (car (read-from-string commit 587edc46dfc0aa035c49a5c97ff36472e2c4dbfd Author: Jim Porter Date: Fri Jan 21 10:32:00 2022 +0100 Further improve determination of when commands can be invoked directly This covers the case when a subcommand is to be invoked in more places than before, for example when a subcommand is concatenated in an argument. * lisp/eshell/esh-cmd.el (eshell--find-subcommands): New fuction. (eshell--invoke-command-directly): Use 'eshell-find-subcommands'. * test/lisp/eshell/eshell-tests.el (eshell-test/interp-cmd-external-concat): New test (bug#30725). diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 25e3a5a205..04d65df4f3 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -107,6 +107,7 @@ (require 'esh-module) (require 'esh-io) (require 'esh-ext) +(require 'generator) (eval-when-compile (require 'cl-lib) @@ -903,6 +904,17 @@ at the moment are: "Completion for the `debug' command." (while (pcomplete-here '("errors" "commands")))) +(iter-defun eshell--find-subcommands (haystack) + "Recursively search for subcommand forms in HAYSTACK. +This yields the SUBCOMMANDs when found in forms like +\"(eshell-as-subcommand SUBCOMMAND)\"." + (dolist (elem haystack) + (cond + ((eq (car-safe elem) 'eshell-as-subcommand) + (iter-yield (cdr elem))) + ((listp elem) + (iter-yield-from (eshell--find-subcommands elem)))))) + (defun eshell--invoke-command-directly (command) "Determine whether the given COMMAND can be invoked directly. COMMAND should be a non-top-level Eshell command in parsed form. @@ -916,8 +928,7 @@ A command can be invoked directly if all of the following are true: * NAME is a string referring to an alias function and isn't a complex command (see `eshell-complex-commands'). -* Any argument in ARGS that calls a subcommand can also be - invoked directly." +* Any subcommands in ARGS can also be invoked directly." (when (and (eq (car command) 'eshell-trap-errors) (eq (car (cadr command)) 'eshell-named-command)) (let ((name (cadr (cadr command))) @@ -931,15 +942,10 @@ A command can be invoked directly if all of the following are true: (throw 'simple nil)))) (eshell-find-alias-function name) (catch 'indirect-subcommand - (dolist (arg args t) - (pcase arg - (`(eshell-escape-arg - (let ,_ - (eshell-convert - (eshell-command-to-value - (eshell-as-subcommand ,subcommand))))) - (unless (eshell--invoke-command-directly subcommand) - (throw 'indirect-subcommand nil)))))))))) + (iter-do (subcommand (eshell--find-subcommands args)) + (unless (eshell--invoke-command-directly subcommand) + (throw 'indirect-subcommand nil))) + t))))) (defun eshell-invoke-directly (command) "Determine whether the given COMMAND can be invoked directly. diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index c4cb9bf485..1a7ab0ab06 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -167,6 +167,13 @@ e.g. \"{(+ 1 2)} 3\" => 3" (eshell-command-result-p "echo ${*echo hi}" "hi\n"))) +(ert-deftest eshell-test/interp-cmd-external-concat () + "Interpolate command result from external command with concatenation" + (skip-unless (executable-find "echo")) + (with-temp-eshell + (eshell-command-result-p "echo ${echo hi}-${*echo there}" + "hi-there\n"))) + (ert-deftest eshell-test/window-height () "$LINES should equal (window-height)" (should (eshell-test-command-result "= $LINES (window-height)"))) commit c2e28aabcc370ac32c37c3f31acb1930e0d7cab8 Author: Eli Zaretskii Date: Fri Jan 21 10:17:06 2022 +0200 ; * etc/NEWS: Fix description of 'polling-period' change. diff --git a/etc/NEWS b/etc/NEWS index f8c563d10f..53f04e23ef 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -973,8 +973,8 @@ functions. -- ** The variable 'polling-period' now accepts floating point values. -Setting it to a floating-point value means that Emacs will poll for -input every so many fractions of a second. +This means Emacs can now poll for input during Lisp execution more +frequently than once in a second. -- ** New function 'bidi-string-strip-control-characters'. commit a6ad584ac27dcc6bbe2476face53a3165f99366d Author: Lars Ingebrigtsen Date: Fri Jan 21 08:55:43 2022 +0100 Adjust emake after recent changes diff --git a/admin/emake b/admin/emake index 2ff553289d..bfada1eb3e 100755 --- a/admin/emake +++ b/admin/emake @@ -80,6 +80,7 @@ The GNU allocators don't work|\ ^'\.git/|\ ^\^\(\(|\ ^'build-aux/git-hooks\ +^ANCIENT=yes make\ " | \ while read do commit f08dfa9b532648457590262c1afa9729e87c6bb1 Author: Stefan Monnier Date: Mon Nov 22 14:23:26 2021 -0500 Fix menu-bar mouse clicks in "C-h c" and "C-h k" (bug#53322) * lisp/subr.el (event-start, event-end): Handle '(menu-bar)' events. * lisp/net/browse-url.el (browse-url-interactive-arg): Simplify accordingly. (cherry picked from commit 9ceb3070e34ad8a54184fd0deda477bf5ff77000) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 5f7140fac4..3aafbea7c3 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -730,8 +730,7 @@ position clicked before acting. This function returns a list (URL NEW-WINDOW-FLAG) for use in `interactive'." (let ((event (elt (this-command-keys) 0))) - (when (mouse-event-p event) - (mouse-set-point event))) + (mouse-set-point event)) (list (read-string prompt (or (and transient-mark-mode mark-active ;; rfc2396 Appendix E. (replace-regexp-in-string diff --git a/lisp/subr.el b/lisp/subr.el index 62839c9b25..8e5a65efcd 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1511,22 +1511,22 @@ nil or (STRING . POSITION)'. `posn-timestamp': The time the event occurred, in milliseconds. For more information, see Info node `(elisp)Click Events'." - (if (consp event) (nth 1 event) - ;; Use `window-point' for the case when the current buffer - ;; is temporarily switched to some other buffer (bug#50256) - (or (posn-at-point (window-point)) - (list (selected-window) (window-point) '(0 . 0) 0)))) + (or (and (consp event) (nth 1 event)) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0))) (defun event-end (event) "Return the ending position of EVENT. EVENT should be a click, drag, or key press event. See `event-start' for a description of the value returned." - (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) - ;; Use `window-point' for the case when the current buffer - ;; is temporarily switched to some other buffer (bug#50256) - (or (posn-at-point (window-point)) - (list (selected-window) (window-point) '(0 . 0) 0)))) + (or (and (consp event) (nth (if (consp (nth 2 event)) 2 1) event)) + ;; Use `window-point' for the case when the current buffer + ;; is temporarily switched to some other buffer (bug#50256) + (posn-at-point (window-point)) + (list (selected-window) (window-point) '(0 . 0) 0))) (defsubst event-click-count (event) "Return the multi-click count of EVENT, a click or drag event.