From 5aadb87d6f6e3d9d755d4b6f6d124040c1bcfeee Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 23 May 2023 17:44:23 +0300 Subject: [PATCH 01/20] Fix 'use-dialog-box-p' and friends * lisp/subr.el (use-dialog-box-p): Use dialog boxes also when invoked from some window-system gesture. (Bug#63655) (y-or-n-p): Fix the description in the doc string of conditions under which a dialog box will be used. * src/fns.c (Fyes_or_no_p): Use the same condition for dialog boxes as in 'use-dialog-box-p'. Fix the description in the doc string of conditions under which a dialog box will be used. * doc/lispref/minibuf.texi (Multiple Queries, Yes-or-No Queries): Fix the description of conditions under which a dialog box will be used. --- doc/lispref/minibuf.texi | 30 ++++++++++++++++-------------- lisp/subr.el | 7 +++++-- src/fns.c | 16 +++++++++++----- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index a4916ecda30..9a386ff310d 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2174,13 +2174,14 @@ will not have serious consequences. @code{yes-or-no-p} is suitable for more momentous questions, since it requires three or four characters to answer. - If either of these functions is called in a command that was invoked -using the mouse---more precisely, if @code{last-nonmenu-event} -(@pxref{Command Loop Info}) is either @code{nil} or a list---then it -uses a dialog box or pop-up menu to ask the question. Otherwise, it -uses keyboard input. You can force use either of the mouse or of keyboard -input by binding @code{last-nonmenu-event} to a suitable value around -the call. + If either of these functions is called in a command that was +invoked using the mouse or some other window-system gesture, or in a +command invoked via a menu, then they use a dialog box or pop-up menu +to ask the question if dialog boxes are supported. Otherwise, they +use keyboard input. You can force use either of the mouse or of +keyboard input by binding @code{last-nonmenu-event} to a suitable +value around the call---bind it to @code{t} to force keyboard +interaction, and to a list to force dialog boxes. Both @code{yes-or-no-p} and @code{y-or-n-p} use the minibuffer. @@ -2378,13 +2379,14 @@ Normally, @code{map-y-or-n-p} binds @code{cursor-in-echo-area} while prompting. But if @var{no-cursor-in-echo-area} is non-@code{nil}, it does not do that. -If @code{map-y-or-n-p} is called in a command that was invoked using the -mouse---more precisely, if @code{last-nonmenu-event} (@pxref{Command -Loop Info}) is either @code{nil} or a list---then it uses a dialog box -or pop-up menu to ask the question. In this case, it does not use -keyboard input or the echo area. You can force use either of the mouse or -of keyboard input by binding @code{last-nonmenu-event} to a suitable -value around the call. +If @code{map-y-or-n-p} is called in a command that was invoked using +the mouse or some other window-system gesture, or a command invoked +via a menu, then it uses a dialog box or pop-up menu to ask the +question if dialog boxes are supported. In this case, it does not use +keyboard input or the echo area. You can force use either of the +mouse or of keyboard input by binding @code{last-nonmenu-event} to a +suitable value around the call---bind it to @code{t} to force keyboard +interaction, and to a list to force dialog boxes. The return value of @code{map-y-or-n-p} is the number of objects acted on. @end defun diff --git a/lisp/subr.el b/lisp/subr.el index 52227b5261c..950902039b1 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3544,6 +3544,8 @@ confusing to some users.") "Return non-nil if the current command should prompt the user via a dialog box." (and last-input-event ; not during startup (or (consp last-nonmenu-event) ; invoked by a mouse event + (and (null last-nonmenu-event) + (consp last-input-event)) from--tty-menu-p) ; invoked via TTY menu use-dialog-box)) @@ -3574,8 +3576,9 @@ If the user enters `recenter', `scroll-up', or `scroll-down' responses, perform the requested window recentering or scrolling and ask again. -Under a windowing system a dialog box will be used if `last-nonmenu-event' -is nil and `use-dialog-box' is non-nil. +If dialog boxes are supported, this function will use a dialog box +if `use-dialog-box' is non-nil and the last input event was produced +by a mouse, or by some window-system gesture, or via a menu. By default, this function uses the minibuffer to read the key. If `y-or-n-p-use-read-key' is non-nil, `read-key' is used diff --git a/src/fns.c b/src/fns.c index e8cd6211d6d..2ed62d6e8c6 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3185,16 +3185,21 @@ has been confirmed. If the `use-short-answers' variable is non-nil, instead of asking for \"yes\" or \"no\", this function will ask for \"y\" or \"n\". -If dialog boxes are supported, a dialog box will be used -if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) +If dialog boxes are supported, this function will use a dialog box +if `use-dialog-box' is non-nil and the last input event was produced +by a mouse, or by some window-system gesture, or via a menu. */) (Lisp_Object prompt) { - Lisp_Object ans; + Lisp_Object ans, val; CHECK_STRING (prompt); - if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) - && use_dialog_box && ! NILP (last_input_event)) + if (!NILP (last_input_event) + && (CONSP (last_nonmenu_event) + || (NILP (last_nonmenu_event) && CONSP (last_input_event)) + || (val = find_symbol_value (Qfrom__tty_menu_p), + (!NILP (val) && !EQ (val, Qunbound)))) + && use_dialog_box) { Lisp_Object pane, menu, obj; redisplay_preserve_echo_area (4); @@ -6358,4 +6363,5 @@ The same variable also affects the function `read-answer'. */); defsubr (&Sbuffer_line_statistics); DEFSYM (Qreal_this_command, "real-this-command"); + DEFSYM (Qfrom__tty_menu_p, "from--tty-menu-p"); } From 765edc204d45c0eb6d31e92c661355c1bd7315a9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 23 May 2023 17:53:07 +0300 Subject: [PATCH 02/20] ; Support SQLite3 extensions on macOS * src/sqlite.c (Fsqlite_load_extension): Support *.dylib extensions. (Bug#63653) --- src/sqlite.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sqlite.c b/src/sqlite.c index 852e3746ef4..fd528f2b0d5 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -730,10 +730,12 @@ Only modules on Emacs' list of allowed modules can be loaded. */) bool do_allow = false; for (const char **allow = allowlist; *allow; allow++) { - if (strlen (*allow) < strlen (name) - && !strncmp (*allow, name, strlen (*allow)) - && (!strcmp (name + strlen (*allow), ".so") - || !strcasecmp (name + strlen (*allow), ".dll"))) + ptrdiff_t allow_len = strlen (*allow); + if (allow_len < strlen (name) + && !strncmp (*allow, name, allow_len) + && (!strcmp (name + allow_len, ".so") + ||!strcmp (name + allow_len, ".dylib") + || !strcasecmp (name + allow_len, ".dll"))) { do_allow = true; break; From 1b9812af80b6ceec8418636dbf84c0fbcd3ab694 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 23 May 2023 18:04:24 +0300 Subject: [PATCH 03/20] ; * etc/PROBLEMS: Document problem with GnuPG 2.4.1. (Bug#63256) --- etc/PROBLEMS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index c0cb5b0d8bb..82ab48fa514 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -516,6 +516,13 @@ directory copy is ineffective. This is due to an arbitrary limit in certain versions of awk. The solution is to use gawk (GNU awk). +*** Saving, via EasyPG, a file encrypted with GnuPG hangs + +This is known to happen with GnuPG v2.4.1. The only known workaround +is to downgrade to a version of GnuPG older than 2.4.1 (or, in the +future, upgrade to a newer version which solves the problem, when such +a fixed version becomes available) + ** Problems with hostname resolution *** Emacs does not know your host's fully-qualified domain name. From 212884f2bfed7f00e58aad183edd20ecc2a23e71 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 23 May 2023 18:05:07 +0300 Subject: [PATCH 04/20] ; Fix last change. --- etc/PROBLEMS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 82ab48fa514..5b9b5ee4ead 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -521,7 +521,7 @@ The solution is to use gawk (GNU awk). This is known to happen with GnuPG v2.4.1. The only known workaround is to downgrade to a version of GnuPG older than 2.4.1 (or, in the future, upgrade to a newer version which solves the problem, when such -a fixed version becomes available) +a fixed version becomes available). ** Problems with hostname resolution From 5c6517a115d5523ddde43725b415da52ba6ee64c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 May 2023 08:57:28 +0300 Subject: [PATCH 05/20] ; * lisp/menu-bar.el (popup-menu): Doc fix. --- lisp/menu-bar.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d020cf6e90a..88873ce5e24 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1,4 +1,4 @@ -;;; menu-bar.el --- define a default menu bar -*- lexical-binding: t; -*- +2070;;; menu-bar.el --- define a default menu bar -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 2000-2023 Free Software Foundation, Inc. @@ -2567,10 +2567,11 @@ See `menu-bar-mode' for more information." binding))) (defun popup-menu (menu &optional position prefix from-menu-bar) - "Popup the given menu and call the selected option. + "Popup MENU and call the selected option. MENU can be a keymap, an easymenu-style menu or a list of keymaps as for `x-popup-menu'. -The menu is shown at the place where POSITION specifies. +The menu is shown at the location specified by POSITION, which +defaults to the place of the mouse click that popped the menu. For the form of POSITION, see `popup-menu-normalize-position'. PREFIX is the prefix argument (if any) to pass to the command. FROM-MENU-BAR, if non-nil, means we are dropping one of menu-bar's menus." From a72a1f24fcb56d1a4e622f189d5a56e84f346097 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 May 2023 08:58:42 +0300 Subject: [PATCH 06/20] ; Fix last change. --- lisp/menu-bar.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 88873ce5e24..f6b87d1078d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1,4 +1,4 @@ -2070;;; menu-bar.el --- define a default menu bar -*- lexical-binding: t; -*- +;;; menu-bar.el --- define a default menu bar -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 2000-2023 Free Software Foundation, Inc. From 709d9020021eaaf1e1475f61b72b2405f4fd0bb3 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 25 May 2023 15:40:45 +0200 Subject: [PATCH 07/20] Make last Tramp change less invasive * lisp/net/tramp.el (tramp-dissect-file-name): Revert last change. (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory): Let-bind `tramp-default-proxies-alist'. --- lisp/net/tramp.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index dac2bc8c43c..9f868ccdaa0 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1681,9 +1681,8 @@ The structure consists of method, user, domain, host, port, localname (file name on remote host), and hop. Unless NODEFAULT is non-nil, method, user and host are expanded -to their default values. Hop is set to nil if NODEFAULT is non-nil. - -For the other file name parts, no default values are used." +to their default values. For the other file name parts, no +default values are used." (save-match-data (unless (tramp-tramp-file-p name) (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) @@ -1709,8 +1708,7 @@ For the other file name parts, no default values are used." (when (string-match tramp-postfix-ipv6-regexp host) (setq host (replace-match "" nil t host)))) - (if nodefault - (setq hop nil) + (unless nodefault (when hop (setq v (tramp-dissect-hop-name hop) hop (and hop (tramp-make-tramp-hop-name v)))) @@ -3894,8 +3892,10 @@ Let-bind it when necessary.") (defun tramp-handle-file-name-as-directory (file) "Like `file-name-as-directory' for Tramp files." ;; `file-name-as-directory' would be sufficient except localname is - ;; the empty string. - (let ((v (tramp-dissect-file-name file t))) + ;; the empty string. Suppress adding a hop to + ;; `tramp-default-proxies-alist' due to non-expanded default values. + (let ((v (tramp-dissect-file-name file t)) + tramp-default-proxies-alist) ;; Run the command on the localname portion only unless we are in ;; completion mode. (tramp-make-tramp-file-name @@ -3985,8 +3985,10 @@ Let-bind it when necessary.") "Like `file-name-directory' for Tramp files." ;; Everything except the last filename thing is the directory. We ;; cannot apply `with-parsed-tramp-file-name', because this expands - ;; the remote file name parts. - (let ((v (tramp-dissect-file-name file t))) + ;; the remote file name parts. Suppress adding a hop to + ;; `tramp-default-proxies-alist' due to non-expanded default values. + (let ((v (tramp-dissect-file-name file t)) + tramp-default-proxies-alist) ;; Run the command on the localname portion only. If this returns ;; nil, mark also the localname part of `v' as nil. (tramp-make-tramp-file-name From d292d282292b8ce1f4e1ba97d0110178153f73c5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 May 2023 20:50:46 +0300 Subject: [PATCH 08/20] Fix rare crashes in 'try_window_reusing_current_matrix' * src/xdisp.c (try_window_reusing_current_matrix): Make sure we never use a mode-line glyph row to start displaying scrolled-in rows. (Bug#63711) --- src/xdisp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index aeba47e4c16..2ddfdf0d51b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21081,8 +21081,10 @@ try_window_reusing_current_matrix (struct window *w) pt_row = first_row_to_display; } + if (first_row_to_display->y >= yb) + return false; + /* Start displaying at the start of first_row_to_display. */ - eassert (first_row_to_display->y < yb); init_to_row_start (&it, w, first_row_to_display); nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) From b62a2b08b80ecf855096daf1e9e84b3f7bc7622a Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 25 May 2023 21:24:23 +0300 Subject: [PATCH 09/20] Add vc-create/switch/print-branch to menu and update documentation (bug#63690) * doc/emacs/maintaining.texi (VC Change Log): Add 'C-x v b l' (vc-print-branch-log). (Creating Branches): Add @kindex and @findex for vc-create-branch. (Switching Branches): Add @kindex and @findex for vc-switch-branch. * lisp/vc/vc-hooks.el (vc-menu-map): Add menu items for new commands vc-create-branch and vc-switch-branch, and also vc-print-branch-log. * lisp/vc/vc.el (vc-print-branch-log): Improve docstring. --- doc/emacs/maintaining.texi | 18 +++++++++++++++++- lisp/vc/vc-hooks.el | 9 +++++++++ lisp/vc/vc.el | 3 ++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 7d49e28d11f..06f44a88aab 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -999,6 +999,10 @@ Display the change history for the current fileset Display the change history for the current repository (@code{vc-print-root-log}). +@item C-x v b l +Display the change history for another branch +(@code{vc-print-branch-log}). + @item C-x v I Display the changes that a ``pull'' operation will retrieve (@code{vc-log-incoming}). @@ -1063,6 +1067,13 @@ showing only the first line of each log entry. However, you can type @file{*vc-change-log*} buffer to reveal the entire log entry for the revision at point. A second @key{RET} hides it again. +@kindex C-x v b l +@findex vc-print-branch-log + @kbd{C-x v b l @var{branch-name} @key{RET}} (@code{vc-print-branch-log}) +displays a @file{*vc-change-log*} buffer showing the history of the +version-controlled directory tree like @code{vc-print-root-log} does, +but in another branch provided as an argument. + @kindex C-x v I @kindex C-x v O @findex vc-log-incoming @@ -1523,6 +1534,8 @@ switch to another branch using the @kbd{svn switch} command. With Mercurial, command @kbd{hg update} is used to switch to another branch. +@kindex C-x v b s +@findex vc-switch-branch The VC command to switch to another branch in the current directory is @kbd{C-x v b s @var{branch-name} @key{RET}} (@code{vc-switch-branch}). @@ -1673,9 +1686,12 @@ branch ID for a branch starting at the current revision. For example, if the current revision is 2.5, the branch ID should be 2.5.1, 2.5.2, and so on, depending on the number of existing branches at that point. +@kindex C-x v b c +@findex vc-create-branch This procedure will not work for distributed version control systems like git or Mercurial. For those systems you should use the command -@code{vc-create-branch} (@kbd{C-x v b c}) instead. +@code{vc-create-branch} (@kbd{C-x v b c @var{branch-name} @key{RET}}) +instead. To create a new branch at an older revision (one that is no longer the head of a branch), first select that revision (@pxref{Switching diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index e242d1e48e2..b559a776c09 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -897,6 +897,15 @@ In the latter case, VC mode is deactivated for this buffer." (bindings--define-key map [vc-create-tag] '(menu-item "Create Tag" vc-create-tag :help "Create version tag")) + (bindings--define-key map [vc-print-branch-log] + '(menu-item "Show Branch History..." vc-print-branch-log + :help "List the change log for a branch")) + (bindings--define-key map [vc-switch-branch] + '(menu-item "Switch Branch..." vc-switch-branch + :help "Switch to another branch")) + (bindings--define-key map [vc-create-branch] + '(menu-item "Create Branch..." vc-create-branch + :help "Make a new branch")) (bindings--define-key map [separator1] menu-bar-separator) (bindings--define-key map [vc-annotate] '(menu-item "Annotate" vc-annotate diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c64da1233d1..ba981545085 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2851,7 +2851,8 @@ with its diffs (if the underlying VCS backend supports that)." ;;;###autoload (defun vc-print-branch-log (branch) - "Show the change log for BRANCH root in a window." + "Show the change log for BRANCH in a window. +The command prompts for the branch to log." (interactive (let* ((backend (vc-responsible-backend default-directory)) (rootdir (vc-call-backend backend 'root default-directory))) From 3afe4a42e90f4eb937b81879548ffbfa7e1f6599 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 25 May 2023 21:33:11 +0300 Subject: [PATCH 10/20] * lisp/vc/vc-annotate.el (vc-annotate-mode-menu): Quote vc-annotate-backend. When unquoted it might get the nil value when vc-annotate.el is loaded in non-vc-controlled buffer (bug#63689). --- lisp/vc/vc-annotate.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 70057a6aac7..d83660f9d79 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -330,7 +330,7 @@ cover the range from the oldest annotation to the newest." ["Show changeset diff of revision at line" vc-annotate-show-changeset-diff-revision-at-line :enable - (eq 'repository (vc-call-backend ,vc-annotate-backend 'revision-granularity)) + (eq 'repository (vc-call-backend vc-annotate-backend 'revision-granularity)) :help "Visit the diff of the revision at line from its previous revision"] ["Visit revision at line" vc-annotate-find-revision-at-line :help "Visit the revision identified in the current line"])) From e5f42706ce2fd00d1ac9249a8760a88781f09a2f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 25 May 2023 21:40:38 +0300 Subject: [PATCH 11/20] * lisp/progmodes/project.el: Move :safe from defcustom to autoload (bug#63469) (project-vc-ignores, project-vc-merge-submodules) (project-vc-include-untracked, project-vc-name) (project-vc-extra-root-markers, project-kill-buffers-display-buffer-list): Autoload the line that puts 'safe-local-variable' property on defcustom symbol instead of using the :safe keyword. --- lisp/progmodes/project.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 35b57ee4819..e2112276379 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -401,8 +401,8 @@ the buffer's value of `default-directory'." (defcustom project-vc-ignores nil "List of patterns to add to `project-ignores'." - :type '(repeat string) - :safe #'listp) + :type '(repeat string)) +;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'listp) (defcustom project-vc-merge-submodules t "Non-nil to consider submodules part of the parent project. @@ -411,14 +411,14 @@ After changing this variable (using Customize or .dir-locals.el) you might have to restart Emacs to see the effect." :type 'boolean :version "28.1" - :package-version '(project . "0.2.0") - :safe #'booleanp) + :package-version '(project . "0.2.0")) +;;;###autoload(put 'project-vc-merge-submodules 'safe-local-variable #'booleanp) (defcustom project-vc-include-untracked t "When non-nil, the VC-aware project backend includes untracked files." :type 'boolean - :version "29.1" - :safe #'booleanp) + :version "29.1") +;;;###autoload(put 'project-vc-include-untracked 'safe-local-variable #'booleanp) (defcustom project-vc-name nil "When non-nil, the name of the current VC-aware project. @@ -428,8 +428,8 @@ its name, is by setting this in .dir-locals.el." :type '(choice (const :tag "Default to the base name" nil) (string :tag "Custom name")) :version "29.1" - :package-version '(project . "0.9.0") - :safe #'stringp) + :package-version '(project . "0.9.0")) +;;;###autoload(put 'project-vc-name 'safe-local-variable #'stringp) ;; Not using regexps because these wouldn't work in Git pathspecs, in ;; case we decide we need to be able to list nested projects. @@ -456,8 +456,8 @@ In either case, their behavior will still obey the relevant variables, such as `project-vc-ignores' or `project-vc-name'." :type '(repeat string) :version "29.1" - :package-version '(project . "0.9.0") - :safe (lambda (val) (and (listp val) (cl-every #'stringp val)))) + :package-version '(project . "0.9.0")) +;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (cl-every #'stringp val)))) ;; FIXME: Using the current approach, major modes are supposed to set ;; this variable to a buffer-local value. So we don't have access to @@ -1453,8 +1453,8 @@ Used by `project-kill-buffers'." :type 'boolean :version "29.1" :group 'project - :package-version '(project . "0.8.2") - :safe #'booleanp) + :package-version '(project . "0.8.2")) +;;;###autoload(put 'project-kill-buffers-display-buffer-list 'safe-local-variable #'booleanp) (defun project--buffer-check (buf conditions) "Check if buffer BUF matches any element of the list CONDITIONS. From 9f5249d5c8d193fc59d09b9003d26d1ed0884f2c Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 26 May 2023 08:41:31 +0800 Subject: [PATCH 12/20] Disable cairo-xcb support by default * INSTALL (--with-cairo-xcb): Document new option. * configure.ac (USE_CAIRO_XCB): Implement new option. --- INSTALL | 6 ++++++ configure.ac | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/INSTALL b/INSTALL index 344ae39f464..2bb8df52dc9 100644 --- a/INSTALL +++ b/INSTALL @@ -394,6 +394,12 @@ typical 32-bit host, Emacs integers have 62 bits instead of 30. Use --with-cairo to compile Emacs with Cairo drawing. +Use --with-cairo-xcb to also utilize the Cairo XCB backend on systems +where it is available. While such a configuration is moderately +faster when running over X connections with high latency, it is likely +to crash when a new frame is created on a display connection opened +after a display connection is closed. + Use --with-modules to build Emacs with support for dynamic modules. This needs a C compiler that supports '__attribute__ ((cleanup (...)))', as in GCC 3.4 and later. diff --git a/configure.ac b/configure.ac index 2c80d4cc9aa..7ded5289d31 100644 --- a/configure.ac +++ b/configure.ac @@ -459,6 +459,7 @@ OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support]) OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support]) OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support]) OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing]) +OPTION_DEFAULT_OFF([cairo-xcb], [use XCB surfaces for Cairo support]) OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support]) OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support]) OPTION_DEFAULT_ON([native-image-api], [don't use native image APIs (GDI+ on Windows)]) @@ -3607,14 +3608,14 @@ if test "${HAVE_X11}" = "yes"; then CAIRO_MODULE="cairo >= $CAIRO_REQUIRED" EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE]) if test $HAVE_CAIRO = yes; then - CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED" - EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE]) - if test $HAVE_CAIRO_XCB = yes; then - CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS" - CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS" - AC_DEFINE([USE_CAIRO_XCB], [1], - [Define to 1 if cairo XCB surfaces are available.]) - fi + AS_IF([test "x$with_cairo_xcb" = "xyes"], [ + CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED" + EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE]) + AS_IF([test "x$HAVE_CAIRO_XCB" = "xyes"], [ + CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS" + CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS" + AC_DEFINE([USE_CAIRO_XCB], [1], + [Define to 1 if cairo XCB surfaces are available.])])]) AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.]) CFLAGS="$CFLAGS $CAIRO_CFLAGS" LIBS="$LIBS $CAIRO_LIBS" From 42052686752e399e778d33401dd621afbac0071d Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 26 May 2023 08:43:18 +0800 Subject: [PATCH 13/20] Don't mark selection request events * src/pgtkterm.c (mark_pgtkterm): Prevent crash by not marking selection request events, which don't have Lisp_Object members. --- src/pgtkterm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pgtkterm.c b/src/pgtkterm.c index c00e13550bd..f4b05ef9903 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -376,6 +376,13 @@ mark_pgtkterm (void) for (i = 0; i < n; i++) { union buffered_input_event *ev = &evq->q[i]; + + /* Selection requests don't have Lisp object members. */ + + if (ev->ie.kind == SELECTION_REQUEST_EVENT + || ev->ie.kind == SELECTION_CLEAR_EVENT) + continue; + mark_object (ev->ie.x); mark_object (ev->ie.y); mark_object (ev->ie.frame_or_window); From c0d7447e9dc14cca9a71c8cd4a84573c22108662 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 May 2023 10:07:34 +0300 Subject: [PATCH 14/20] ; * etc/NEWS: Describe the Cairo XCB option. (Bug#63589) --- etc/NEWS | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a29e0a08cfc..a3457d70340 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -91,24 +91,6 @@ available, and includes support for animated WebP images. To disable WebP support, use the '--without-webp' configure flag. Image specifiers can now use ':type webp'. -+++ -** Emacs has been ported to the Haiku operating system. -The configuration process should automatically detect and build for -Haiku. There is also an optional window-system port to Haiku, which -can be enabled by configuring Emacs with the option '--with-be-app', -which will require the Haiku Application Kit development headers and a -C++ compiler to be present on your system. If Emacs is not built with -the option '--with-be-app', the resulting Emacs will only run in -text-mode terminals. - -To enable Cairo support, ensure that the Cairo and FreeType -development files are present on your system, and configure Emacs with -'--with-be-cairo'. - -Unlike X, there is no compile-time option to enable or disable -double-buffering; it is always enabled. To disable it, change the -frame parameter 'inhibit-double-buffering' instead. - --- ** Emacs now installs the ".pdmp" file using a unique fingerprint in the name. The file is typically installed using a file name akin to @@ -126,6 +108,16 @@ option '--without-xinput2' to disable this support. '(featurep 'xinput2)' can be used to test for the presence of XInput 2 support from Lisp programs. +--- +** Emacs can now be optionally built with the Cairo XCB backend. +Configure Emacs with the '--with-cairo-xcb' option to use the Cairo +XCB backend; the default is not to use it. This backend makes Emacs +moderately faster when running over X connections with high latency, +but is currently known to crash when Emacs repeatedly closes and opens +a display connection to the same terminal; this could happen, for +example, if you repeatedly visit files via emacsclient in a single +client frame, each time deleting the frame with 'C-x C-c'. + +++ ** Emacs now supports being built with pure GTK. To use this option, make sure the GTK 3 (version 3.22.23 or later) and @@ -144,6 +136,24 @@ automatically switch to text-mode interface (thus emulating '-nw') if it cannot determine the default display; it will instead complain and ask you to invoke it with the explicit '-nw' option. ++++ +** Emacs has been ported to the Haiku operating system. +The configuration process should automatically detect and build for +Haiku. There is also an optional window-system port to Haiku, which +can be enabled by configuring Emacs with the option '--with-be-app', +which will require the Haiku Application Kit development headers and a +C++ compiler to be present on your system. If Emacs is not built with +the option '--with-be-app', the resulting Emacs will only run in +text-mode terminals. + +To enable Cairo support, ensure that the Cairo and FreeType +development files are present on your system, and configure Emacs with +'--with-be-cairo'. + +Unlike X, there is no compile-time option to enable or disable +double-buffering; it is always enabled. To disable it, change the +frame parameter 'inhibit-double-buffering' instead. + --- ** Emacs no longer reduces the size of the Japanese dictionary. Building Emacs includes generation of a Japanese dictionary, which is From 40a758f5ceb3d46fa3669e2471db1a45a08f3a23 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 May 2023 11:09:14 +0300 Subject: [PATCH 15/20] ; Minor fixes in documentation of recently-changed VC commands * lisp/vc/vc.el (vc-print-branch-log, vc-create-branch) (vc-create-tag, vc-retrieve-tag, vc-switch-branch): Doc fixes. * lisp/vc/vc-hooks.el (vc-menu-map): Minor wording change in :help text. * doc/emacs/maintaining.texi (VC Change Log, Creating Branches): Minor wording and markup changes. --- doc/emacs/maintaining.texi | 7 +++--- lisp/vc/vc-hooks.el | 2 +- lisp/vc/vc.el | 49 ++++++++++++++++++++++++++++---------- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 06f44a88aab..246e335cfe7 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1071,8 +1071,9 @@ revision at point. A second @key{RET} hides it again. @findex vc-print-branch-log @kbd{C-x v b l @var{branch-name} @key{RET}} (@code{vc-print-branch-log}) displays a @file{*vc-change-log*} buffer showing the history of the -version-controlled directory tree like @code{vc-print-root-log} does, -but in another branch provided as an argument. +version-controlled directory tree, like @code{vc-print-root-log} does, +but it shows the history of a branch other than the current one; it +prompts for the branch whose history to display. @kindex C-x v I @kindex C-x v O @@ -1690,7 +1691,7 @@ and so on, depending on the number of existing branches at that point. @findex vc-create-branch This procedure will not work for distributed version control systems like git or Mercurial. For those systems you should use the command -@code{vc-create-branch} (@kbd{C-x v b c @var{branch-name} @key{RET}}) +@code{vc-create-branch} (@w{@kbd{C-x v b c @var{branch-name} @key{RET}}}) instead. To create a new branch at an older revision (one that is no longer diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index b559a776c09..00a7659209e 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -899,7 +899,7 @@ In the latter case, VC mode is deactivated for this buffer." :help "Create version tag")) (bindings--define-key map [vc-print-branch-log] '(menu-item "Show Branch History..." vc-print-branch-log - :help "List the change log for a branch")) + :help "List the change log for another branch")) (bindings--define-key map [vc-switch-branch] '(menu-item "Switch Branch..." vc-switch-branch :help "Switch to another branch")) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index ba981545085..1144a23f317 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2504,9 +2504,13 @@ Otherwise, return nil." (defun vc-create-tag (dir name branchp) "Descending recursively from DIR, make a tag called NAME. For each registered file, the working revision becomes part of -the named configuration. If the prefix argument BRANCHP is -given, the tag is made as a new branch and the files are -checked out in that new branch." +the configuration identified by the tag. +If BRANCHP is non-nil (interactively, the prefix argument), the +tag NAME is a new branch, and the files are checked out and +updated to reflect their revisions on that branch. +In interactive use, DIR is `default-directory' for repository-granular +VCSes (all the modern decentralized VCSes belong to this group), +otherwise the command will prompt for DIR." (interactive (let ((granularity (vc-call-backend (vc-responsible-backend default-directory) @@ -2529,9 +2533,23 @@ checked out in that new branch." ;;;###autoload (defun vc-create-branch (dir name) - "Descending recursively from DIR, make a branch called NAME. -After a new branch is made, the files are checked out in that new branch. -Uses `vc-create-tag' with the non-nil arg `branchp'." + "Make a branch called NAME in directory DIR. +After making the new branch, check out the branch, i.e. update the +files in the tree to their revisions on the branch. + +Interactively, prompt for the NAME of the branch. + +With VCSes that maintain version information per file, this command also +prompts for the directory DIR whose files, recursively, will be tagged +with the NAME of new branch. For VCSes that maintain version +information for the entire repository (all the modern decentralized +VCSes belong to this group), DIR is always the `default-directory'. + +Finally, this command might prompt for the branch or tag from which to +start (\"fork\") the new branch, with completion candidates including +all the known branches and tags in the repository. + +This command invokes `vc-create-tag' with the non-nil BRANCHP argument." (interactive (let ((granularity (vc-call-backend (vc-responsible-backend default-directory) @@ -2545,17 +2563,17 @@ Uses `vc-create-tag' with the non-nil arg `branchp'." ;;;###autoload (defun vc-retrieve-tag (dir name &optional branchp) - "For each file in or below DIR, retrieve their tagged version NAME. + "For each file in or below DIR, retrieve their version identified by tag NAME. NAME can name a branch, in which case this command will switch to the named branch in the directory DIR. Interactively, prompt for DIR only for VCS that works at file level; -otherwise use the repository root of the current buffer. +otherwise use the root directory of the current buffer's VC tree. If NAME is empty, it refers to the latest revisions of the current branch. If locking is used for the files in DIR, then there must not be any locked files at or below DIR (but if NAME is empty, locked files are allowed and simply skipped). -If the prefix argument BRANCHP is given, switch the branch -and check out the files in that branch. +If BRANCHP is non-nil (interactively, the prefix argument), switch to the +branch and check out and update the files to their version on that branch. This function runs the hook `vc-retrieve-tag-hook' when finished." (interactive (let* ((granularity @@ -2596,7 +2614,12 @@ This function runs the hook `vc-retrieve-tag-hook' when finished." ;;;###autoload (defun vc-switch-branch (dir name) "Switch to the branch NAME in the directory DIR. -If NAME is empty, it refers to the latest revisions of the current branch. +If NAME is empty, it refers to the latest revision of the current branch. +Interactively, prompt for DIR only for VCS that works at file level; +otherwise use the root directory of the current buffer's VC tree. +Interactively, prompt for the NAME of the branch. +After switching to the branch, check out and update the files to their +version on that branch. Uses `vc-retrieve-tag' with the non-nil arg `branchp'." (interactive (let* ((granularity @@ -2851,8 +2874,8 @@ with its diffs (if the underlying VCS backend supports that)." ;;;###autoload (defun vc-print-branch-log (branch) - "Show the change log for BRANCH in a window. -The command prompts for the branch to log." + "Show the change log for BRANCH in another window. +The command prompts for the branch whose change log to show." (interactive (let* ((backend (vc-responsible-backend default-directory)) (rootdir (vc-call-backend backend 'root default-directory))) From f535c0e49d5e629e60eabe9097b9c674783f9674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 25 May 2023 22:28:25 +0200 Subject: [PATCH 16/20] Handle #@00 in new reader in a compatible way (bug#63722) This was a regression from Emacs 28. * src/lread.c (skip_lazy_string, read0): Make #@00 read as nil, which is a quirk from the old reader that we preserve for compatibility. * test/src/lread-tests.el (lread-skip-to-eof): Verify it. Reported by Richard Newton. --- src/lread.c | 17 +++++++++++------ test/src/lread-tests.el | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/lread.c b/src/lread.c index 342d367d985..29321263af3 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3400,8 +3400,9 @@ read_bool_vector (Lisp_Object readcharfun) } /* Skip (and optionally remember) a lazily-loaded string - preceded by "#@". */ -static void + preceded by "#@". Return true if this was a normal skip, + false if we read #@00 (which skips to EOF). */ +static bool skip_lazy_string (Lisp_Object readcharfun) { ptrdiff_t nskip = 0; @@ -3427,9 +3428,9 @@ skip_lazy_string (Lisp_Object readcharfun) digits++; if (digits == 2 && nskip == 0) { - /* #@00 means "skip to end" */ + /* #@00 means "read nil and skip to end" */ skip_dyn_eof (readcharfun); - return; + return false; } } @@ -3476,6 +3477,8 @@ skip_lazy_string (Lisp_Object readcharfun) else /* Skip that many bytes. */ skip_dyn_bytes (readcharfun, nskip); + + return true; } /* Given a lazy-loaded string designator VAL, return the actual string. @@ -3933,8 +3936,10 @@ read0 (Lisp_Object readcharfun, bool locate_syms) /* #@NUMBER is used to skip NUMBER following bytes. That's used in .elc files to skip over doc strings and function definitions that can be loaded lazily. */ - skip_lazy_string (readcharfun); - goto read_obj; + if (skip_lazy_string (readcharfun)) + goto read_obj; + obj = Qnil; /* #@00 skips to EOF and yields nil. */ + break; case '$': /* #$ -- reference to lazy-loaded string */ diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 459a06a39b6..7d885abf364 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -339,4 +339,20 @@ literals (Bug#20852)." (should (byte-code-function-p f)) (should (equal (aref f 4) "My little\ndoc string\nhere")))))) +(ert-deftest lread-skip-to-eof () + ;; Check the special #@00 syntax that, for compatibility, reads as + ;; nil while absorbing the remainder of the input. + (with-temp-buffer + (insert "#@00 and the rest\n" + "should be ignored) entirely\n") + (goto-char (point-min)) + (should (equal (read (current-buffer)) nil)) + (should (eobp)) + ;; Add an unbalanced bracket to the beginning and try again; + ;; we should get an error. + (goto-char (point-min)) + (insert "( ") + (goto-char (point-min)) + (should-error (read (current-buffer)) :type 'end-of-file))) + ;;; lread-tests.el ends here From b6b384023a97185486ed4d69fb18bcd2d3cf8049 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 May 2023 12:23:19 +0300 Subject: [PATCH 17/20] Fix cancellation of Wdired * lisp/wdired.el (wdired-abort-changes): Call 'dired-revert'. Patch by Stephen Berman . (Bug#63676) --- lisp/wdired.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/wdired.el b/lisp/wdired.el index 5572dcb32f3..9952da71078 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -470,6 +470,9 @@ non-nil means return old filename." (insert wdired--old-content) (goto-char wdired--old-point)) (wdired-change-to-dired-mode) + ;; Make sure the display is in synch, and all the variables are set + ;; correctly. + (dired-revert) (set-buffer-modified-p nil) (setq buffer-undo-list nil) (message "Changes aborted")) From f42de74ebea14de1d8a69d2b79489814ab711883 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 May 2023 12:30:40 +0300 Subject: [PATCH 18/20] ; * src/lread.c (read0, skip_lazy_string): Fix commentary wording. --- src/lread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lread.c b/src/lread.c index 29321263af3..f8ee4e63e23 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3401,7 +3401,7 @@ read_bool_vector (Lisp_Object readcharfun) /* Skip (and optionally remember) a lazily-loaded string preceded by "#@". Return true if this was a normal skip, - false if we read #@00 (which skips to EOF). */ + false if we read #@00 (which skips to EOB). */ static bool skip_lazy_string (Lisp_Object readcharfun) { @@ -3938,7 +3938,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms) and function definitions that can be loaded lazily. */ if (skip_lazy_string (readcharfun)) goto read_obj; - obj = Qnil; /* #@00 skips to EOF and yields nil. */ + obj = Qnil; /* #@00 skips to EOB and yields nil. */ break; case '$': From b7b82ecb2b4c2ce33c11e5388b692cd403ab55e6 Mon Sep 17 00:00:00 2001 From: kobarity Date: Wed, 24 May 2023 22:01:12 +0900 Subject: [PATCH 19/20] Fix python-info-docstring-p * lisp/progmodes/python.el (python-info-docstring-p): Stop using python-rx string-delimiter. * test/lisp/progmodes/python-tests.el (python-font-lock-escape-sequence-bytes-newline) (python-font-lock-escape-sequence-hex-octal) (python-font-lock-escape-sequence-unicode) (python-font-lock-raw-escape-sequence): Mark as expected failures until another bug in 'python-info-docstring-p' is corrected. (python-info-docstring-p-7): New test. (Bug#63622) --- lisp/progmodes/python.el | 7 ++----- test/lisp/progmodes/python-tests.el | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 6fc05b246a6..032a17c52ff 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6018,8 +6018,7 @@ point's current `syntax-ppss'." (let ((counter 1) (indentation (current-indentation)) (backward-sexp-point) - (re (concat "[uU]?[rR]?" - (python-rx string-delimiter)))) + (re "[uU]?[rR]?[\"']")) (when (and (not (python-info-assignment-statement-p)) (looking-at-p re) @@ -6040,9 +6039,7 @@ point's current `syntax-ppss'." backward-sexp-point)) (setq last-backward-sexp-point backward-sexp-point)) - (looking-at-p - (concat "[uU]?[rR]?" - (python-rx string-delimiter)))))) + (looking-at-p re)))) ;; Previous sexp was a string, restore point. (goto-char backward-sexp-point) (cl-incf counter)) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 50153e66da5..cbaf5b698bd 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -729,6 +729,7 @@ u\"\\n\"" (845 . font-lock-string-face) (886)))) (ert-deftest python-font-lock-escape-sequence-bytes-newline () + :expected-result :failed (python-tests-assert-faces "b'\\n' b\"\\n\"" @@ -741,6 +742,7 @@ b\"\\n\"" (11 . font-lock-doc-face)))) (ert-deftest python-font-lock-escape-sequence-hex-octal () + :expected-result :failed (python-tests-assert-faces "b'\\x12 \\777 \\1\\23' '\\x12 \\777 \\1\\23'" @@ -761,6 +763,7 @@ b\"\\n\"" (36 . font-lock-doc-face)))) (ert-deftest python-font-lock-escape-sequence-unicode () + :expected-result :failed (python-tests-assert-faces "b'\\u1234 \\U00010348 \\N{Plus-Minus Sign}' '\\u1234 \\U00010348 \\N{Plus-Minus Sign}'" @@ -775,6 +778,7 @@ b\"\\n\"" (80 . font-lock-doc-face)))) (ert-deftest python-font-lock-raw-escape-sequence () + :expected-result :failed (python-tests-assert-faces "rb'\\x12 \123 \\n' r'\\x12 \123 \\n \\u1234 \\U00010348 \\N{Plus-Minus Sign}'" @@ -6598,6 +6602,18 @@ class Class: (python-tests-look-at "'''Not a method docstring.'''") (should (not (python-info-docstring-p))))) +(ert-deftest python-info-docstring-p-7 () + "Test string in a dictionary." + (python-tests-with-temp-buffer + " +{'Not a docstring': 1} +'Also not a docstring' +" + (python-tests-look-at "Not a docstring") + (should-not (python-info-docstring-p)) + (python-tests-look-at "Also not a docstring") + (should-not (python-info-docstring-p)))) + (ert-deftest python-info-triple-quoted-string-p-1 () "Test triple quoted string." (python-tests-with-temp-buffer From aa5158630e7113a67ae804d4253911028cb8f984 Mon Sep 17 00:00:00 2001 From: kobarity Date: Wed, 24 May 2023 22:06:51 +0900 Subject: [PATCH 20/20] Use 'font-lock-extend-region-functions' in python-mode * lisp/progmodes/python.el (python-font-lock-extend-region): Change arguments and return value for 'font-lock-extend-region-functions'. (python-mode): Change from 'font-lock-extend-after-change-region-function' to 'font-lock-extend-region-functions'. (Bug#63622) --- lisp/progmodes/python.el | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 032a17c52ff..adaeacc2ec1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -869,18 +869,22 @@ decorators, exceptions, and assignments.") Which one will be chosen depends on the value of `font-lock-maximum-decoration'.") -(defun python-font-lock-extend-region (beg end _old-len) - "Extend font-lock region given by BEG and END to statement boundaries." - (save-excursion - (save-match-data - (goto-char beg) - (python-nav-beginning-of-statement) - (setq beg (point)) - (goto-char end) - (python-nav-end-of-statement) - (setq end (point)) - (cons beg end)))) - +(defvar font-lock-beg) +(defvar font-lock-end) +(defun python-font-lock-extend-region () + "Extend font-lock region to statement boundaries." + (let ((beg font-lock-beg) + (end font-lock-end)) + (goto-char beg) + (python-nav-beginning-of-statement) + (beginning-of-line) + (when (< (point) beg) + (setq font-lock-beg (point))) + (goto-char end) + (python-nav-end-of-statement) + (when (< end (point)) + (setq font-lock-end (point))) + (or (/= beg font-lock-beg) (/= end font-lock-end)))) (defconst python-syntax-propertize-function (syntax-propertize-rules @@ -6704,9 +6708,9 @@ implementations: `python-mode' and `python-ts-mode'." `(,python-font-lock-keywords nil nil nil nil (font-lock-syntactic-face-function - . python-font-lock-syntactic-face-function) - (font-lock-extend-after-change-region-function - . python-font-lock-extend-region))) + . python-font-lock-syntactic-face-function))) + (add-hook 'font-lock-extend-region-functions + #'python-font-lock-extend-region nil t) (setq-local syntax-propertize-function python-syntax-propertize-function) (setq-local imenu-create-index-function