From 5b351bc7fa94d26ba439461920d2b67595f351d4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 28 Mar 2023 09:38:07 +0200 Subject: [PATCH 1/8] * test/infra/Dockerfile.emba (emacs-gnustep): Instrument "make V=1 ...". --- test/infra/Dockerfile.emba | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 593756aba3b..946aa9235fb 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -71,7 +71,7 @@ COPY . /checkout WORKDIR /checkout RUN ./autogen.sh autoconf RUN ./configure --with-ns -RUN make bootstrap +RUN make V=1 bootstrap FROM emacs-base as emacs-native-comp From 9133446db873415e05f331d9bd55cdfe960a0c55 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 28 Mar 2023 12:43:01 +0200 Subject: [PATCH 2/8] Fix Eglot Tramp tests on EMBA * test/lisp/progmodes/eglot-tests.el (eglot--call-with-tramp-test): Bind `tramp-allow-unsafe-temporary-files' with t. (Bug#62289) --- test/lisp/progmodes/eglot-tests.el | 1 + 1 file changed, 1 insertion(+) diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 7a90d68d213..2388cf9ef51 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -1261,6 +1261,7 @@ macro will assume it exists." ;; really just the local host. (let* ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path)) (tramp-histfile-override t) + (tramp-allow-unsafe-temporary-files t) (tramp-verbose 1) (temporary-file-directory ert-remote-temporary-file-directory) (default-directory temporary-file-directory)) From ba3ade58f3b7083b40e4f995388d6246cc81ba82 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 28 Mar 2023 13:04:09 +0200 Subject: [PATCH 3/8] Skip ruby-ts-imenu-index test if needed * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-imenu-index): Add check for treesitter. --- test/lisp/progmodes/ruby-ts-mode-tests.el | 1 + 1 file changed, 1 insertion(+) diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index 11125dc5cd3..55782f886f6 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el @@ -282,6 +282,7 @@ The whitespace before and including \"|\" on each line is removed." (expand-file-name (format "ruby-mode-resources/%s" ,file)))))) (ert-deftest ruby-ts-imenu-index () + (skip-unless (treesit-ready-p 'ruby t)) (ruby-ts-with-temp-buffer (ruby-ts-test-string "module Foo From 4ec4f614c712b8283b669feb7a6f87a700cdf2e6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 28 Mar 2023 14:08:29 +0300 Subject: [PATCH 4/8] ; Fix incompatibility in 'display-buffer-assq-regexp' * lisp/window.el (display-buffer-assq-regexp): Make it accept a buffer's name again, as it did in Emacs 28. This makes computing the buffer's name inside the function unnecessary. (display-buffer): Always pass the buffer's name to 'display-buffer-assq-regexp'. (Bug#62417) --- lisp/window.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 4bdc26571f5..016d53ffbdd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7556,19 +7556,16 @@ all fail. It should never be set by programs or users. See `display-buffer'.") (put 'display-buffer-fallback-action 'risky-local-variable t) -(defun display-buffer-assq-regexp (buffer-or-name alist action) - "Retrieve ALIST entry corresponding to buffer specified by BUFFER-OR-NAME. +(defun display-buffer-assq-regexp (buffer-name alist action) + "Retrieve ALIST entry corresponding to buffer whose name is BUFFER-NAME. This returns the cdr of the alist entry ALIST if the entry's key (its car) and the name of the buffer designated by -BUFFER-OR-NAME satisfy `buffer-match-p', using the key as +BUFFER-NAME satisfy `buffer-match-p', using the key as CONDITION argument of `buffer-match-p'. ACTION should have the form of the action argument passed to `display-buffer'." (catch 'match (dolist (entry alist) - (when (buffer-match-p (car entry) (if (stringp buffer-or-name) - buffer-or-name - (buffer-name buffer-or-name)) - action) + (when (buffer-match-p (car entry) buffer-name action) (throw 'match (cdr entry)))))) (defvar display-buffer--same-window-action @@ -7727,6 +7724,9 @@ specified by the ACTION argument." (let ((buffer (if (bufferp buffer-or-name) buffer-or-name (get-buffer buffer-or-name))) + (buf-name (if (bufferp buffer-or-name) + (buffer-name buffer-or-name) + buffer-or-name)) ;; Make sure that when we split windows the old window keeps ;; point, bug#14829. (split-window-keep-point t) @@ -7735,7 +7735,7 @@ specified by the ACTION argument." (unless (listp action) (setq action nil)) (let* ((user-action (display-buffer-assq-regexp - buffer display-buffer-alist action)) + buf-name display-buffer-alist action)) (special-action (display-buffer--special-action buffer)) ;; Extra actions from the arguments to this function: (extra-action From 8b66d8abd0119a250bc81ca7625a0c8de3e40555 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 28 Mar 2023 14:56:37 +0200 Subject: [PATCH 5/8] Revert "* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Improve..." This reverts commit 4a7a0c9a9f521b04b23580901e9c0a662b504e32. These patch series caused a number of regression and more analysis is required. --- lisp/emacs-lisp/comp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 3dcbc2cca4d..febca8df19c 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1773,7 +1773,7 @@ SP-DELTA is the stack adjustment." (maxarg (cdr arity))) (when (eq maxarg 'unevalled) (signal 'native-ice (list "subr contains unevalled args" subr-name))) - (if (not (subr-primitive-p subr-name)) + (if (not (subrp subr-name)) ;; The primitive got redefined before the compiler is ;; invoked! (bug#61917) (comp-emit-set-call `(callref funcall From a8c9283e1702af06fb6ad598ae32a2c124860af1 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 28 Mar 2023 14:56:47 +0200 Subject: [PATCH 6/8] Revert "Comp fix calls to redefined primtives with op-bytecode (bug#61917)" This reverts commit 263d6c38539691c954f4c3057cbe8d5468499b91. These patch series caused a number of regression and more analysis is required. --- lisp/emacs-lisp/comp.el | 30 +++++++++++------------------- test/src/comp-tests.el | 13 ------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index febca8df19c..283c00103b5 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1773,25 +1773,17 @@ SP-DELTA is the stack adjustment." (maxarg (cdr arity))) (when (eq maxarg 'unevalled) (signal 'native-ice (list "subr contains unevalled args" subr-name))) - (if (not (subrp subr-name)) - ;; The primitive got redefined before the compiler is - ;; invoked! (bug#61917) - (comp-emit-set-call `(callref funcall - ,(make-comp-mvar :constant subr-name) - ,@(cl-loop repeat nargs - for sp from (comp-sp) - collect (comp-slot-n sp)))) - (if (eq maxarg 'many) - ;; callref case. - (comp-emit-set-call (comp-callref subr-name nargs (comp-sp))) - ;; Normal call. - (unless (and (>= maxarg nargs) (<= minarg nargs)) - (signal 'native-ice - (list "incoherent stack adjustment" nargs maxarg minarg))) - (let* ((subr-name subr-name) - (slots (cl-loop for i from 0 below maxarg - collect (comp-slot-n (+ i (comp-sp)))))) - (comp-emit-set-call (apply #'comp-call (cons subr-name slots))))))))) + (if (eq maxarg 'many) + ;; callref case. + (comp-emit-set-call (comp-callref subr-name nargs (comp-sp))) + ;; Normal call. + (unless (and (>= maxarg nargs) (<= minarg nargs)) + (signal 'native-ice + (list "incoherent stack adjustment" nargs maxarg minarg))) + (let* ((subr-name subr-name) + (slots (cl-loop for i from 0 below maxarg + collect (comp-slot-n (+ i (comp-sp)))))) + (comp-emit-set-call (apply #'comp-call (cons subr-name slots)))))))) (eval-when-compile (defun comp-op-to-fun (x) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 1615b2838fc..926ba27e563 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -532,19 +532,6 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." (should (subr-native-elisp-p (symbol-function 'comp-test-48029-nonascii-žžž-f)))) -(comp-deftest 61917-1 () - "Verify we can compile calls to redefined primitives with -dedicated byte-op code." - (let ((f (lambda (fn &rest args) - (apply fn args)))) - (advice-add #'delete-region :around f) - (unwind-protect - (should (subr-native-elisp-p - (native-compile - '(lambda () - (delete-region (point-min) (point-max)))))) - (advice-remove #'delete-region f)))) - ;;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests. ;; From c1eac5b6586a79e0d84cbdb2ea310b7acee66414 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 28 Mar 2023 21:08:12 +0300 Subject: [PATCH 7/8] Improve documentation of 'read-choice' and related symbols * doc/lispref/commands.texi (Reading One Event): * lisp/subr.el (read-char-choice-use-read-key, read-char-choice) (read-char-choice-with-read-key, y-or-n-p-use-read-key): Improve documentation of these functions and variables. --- doc/lispref/commands.texi | 25 +++++++++++++------ lisp/subr.el | 52 +++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 20be706bebd..62a0939a47e 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3215,15 +3215,24 @@ unspecified, the only fallback disabled is downcasing of the last event. @end defun +@vindex read-char-choice-use-read-key @defun read-char-choice prompt chars &optional inhibit-quit -This function uses @code{read-key} to read and return a single -character. It ignores any input that is not a member of @var{chars}, -a list of accepted characters. Optionally, it will also ignore -keyboard-quit events while it is waiting for valid input. If you bind -@code{help-form} (@pxref{Help Functions}) to a non-@code{nil} value -while calling @code{read-char-choice}, then pressing @code{help-char} -causes it to evaluate @code{help-form} and display the result. It -then continues to wait for a valid input character, or keyboard-quit. +This function uses @code{read-from-minibuffer} to read and return a +single character that is a member of @var{chars}, which should be a +list of single characters. It discards any input characters that are +not members of @var{chars}, and shows a message to that effect. + +The optional argument @var{inhibit-quit} is by default ignored, but if +the variable @code{read-char-choice-use-read-key} is non-@code{nil}, +this function uses @code{read-key} instead of +@code{read-from-minibuffer}, and in that case @var{inhibit-quit} +non-@code{nil} means ignore keyboard-quit events while waiting for +valid input. In addition, if @code{read-char-choice-use-read-key} is +non-@code{nil}, binding @code{help-form} (@pxref{Help Functions}) to a +non-@code{nil} value while calling this function causes it to evaluate +@code{help-form} and display the result when the user presses +@code{help-char}; it then continues to wait for a valid input +character, or for keyboard-quit. @end defun @defun read-multiple-choice prompt choices &optional help-string show-help long-form diff --git a/lisp/subr.el b/lisp/subr.el index 8d27c831c96..a9d93e5fe5e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3196,34 +3196,38 @@ This function is used by the `interactive' code letter \"n\"." n)) (defvar read-char-choice-use-read-key nil - "Prefer `read-key' when reading a character by `read-char-choice'. -Otherwise, use the minibuffer. + "If non-nil, use `read-key' when reading a character by `read-char-choice'. +Otherwise, use the minibuffer (this is the default). -When using the minibuffer, the user is less constrained, and can -use the normal commands available in the minibuffer, and can, for -instance, switch to another buffer, do things there, and then -switch back again to the minibuffer before entering the -character. This is not possible when using `read-key', but using -`read-key' may be less confusing to some users.") +When reading via the minibuffer, you can use the normal commands +available in the minibuffer, and can, for instance, temporarily +switch to another buffer, do things there, and then switch back +to the minibuffer before entering the character. This is not +possible when using `read-key', but using `read-key' may be less +confusing to some users.") (defun read-char-choice (prompt chars &optional inhibit-keyboard-quit) - "Read and return one of CHARS, prompting for PROMPT. -Any input that is not one of CHARS is ignored. + "Read and return one of the characters in CHARS, prompting with PROMPT. +CHARS should be a list of single characters. +The function discards any input character that is not one of CHARS, +and shows a message to the effect that it is not one of the expected +charcaters. -By default, the minibuffer is used to read the key -non-modally (see `read-char-from-minibuffer'). If -`read-char-choice-use-read-key' is non-nil, the modal `read-key' -function is used instead (see `read-char-choice-with-read-key')." +By default, use the minibuffer to read the key non-modally (see +`read-char-from-minibuffer'). But if `read-char-choice-use-read-key' +is non-nil, the modal `read-key' function is used instead (see +`read-char-choice-with-read-key')." (if (not read-char-choice-use-read-key) (read-char-from-minibuffer prompt chars) (read-char-choice-with-read-key prompt chars inhibit-keyboard-quit))) (defun read-char-choice-with-read-key (prompt chars &optional inhibit-keyboard-quit) - "Read and return one of CHARS, prompting for PROMPT. + "Read and return one of the characters in CHARS, prompting with PROMPT. +CHARS should be a list of single characters. Any input that is not one of CHARS is ignored. If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore -`keyboard-quit' events while waiting for a valid input. +`keyboard-quit' events while waiting for valid input. If you bind the variable `help-form' to a non-nil value while calling this function, then pressing `help-char' @@ -3519,15 +3523,15 @@ Also discard all previous input in the minibuffer." (sit-for 2))) (defvar y-or-n-p-use-read-key nil - "Prefer `read-key' when answering a \"y or n\" question by `y-or-n-p'. -Otherwise, use the minibuffer. + "Use `read-key' when reading answers to \"y or n\" questions by `y-or-n-p'. +Otherwise, use the `read-from-minibuffer' to read the answers. -When using the minibuffer, the user is less constrained, and can -use the normal commands available in the minibuffer, and can, for -instance, switch to another buffer, do things there, and then -switch back again to the minibuffer before entering the -character. This is not possible when using `read-key', but using -`read-key' may be less confusing to some users.") +When reading via the minibuffer, you can use the normal commands +available in the minibuffer, and can, for instance, temporarily +switch to another buffer, do things there, and then switch back +to the minibuffer before entering the character. This is not +possible when using `read-key', but using `read-key' may be less +confusing to some users.") (defvar from--tty-menu-p nil "Non-nil means the current command was invoked from a TTY menu.") From 3965c65d5e28e0efdfa693046f6a2059e74465f9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 28 Mar 2023 21:31:51 +0300 Subject: [PATCH 8/8] ; * lisp/subr.el (read-char-choice): Fix last change. --- lisp/subr.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index a9d93e5fe5e..f82826e819c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3210,13 +3210,15 @@ confusing to some users.") "Read and return one of the characters in CHARS, prompting with PROMPT. CHARS should be a list of single characters. The function discards any input character that is not one of CHARS, -and shows a message to the effect that it is not one of the expected -charcaters. +and by default shows a message to the effect that it is not one of +the expected characters. -By default, use the minibuffer to read the key non-modally (see -`read-char-from-minibuffer'). But if `read-char-choice-use-read-key' -is non-nil, the modal `read-key' function is used instead (see -`read-char-choice-with-read-key')." +By default, this function uses the minibuffer to read the key +non-modally (see `read-char-from-minibuffer'), and the optional +argument INHIBIT-KEYBOARD-QUIT is ignored. However, if +`read-char-choice-use-read-key' is non-nil, the modal `read-key' +function is used instead (see `read-char-choice-with-read-key'), +and INHIBIT-KEYBOARD-QUIT is passed to it." (if (not read-char-choice-use-read-key) (read-char-from-minibuffer prompt chars) (read-char-choice-with-read-key prompt chars inhibit-keyboard-quit)))