summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-03-29 06:30:09 +0200
committerStefan Kangas <stefankangas@gmail.com>2023-03-29 06:30:09 +0200
commitf24aa0f46af1f808aa051fdbb44876a1141c928c (patch)
tree6373e545cd21ef33584529de9d2c9bd90016bed0
parent2002ac376c97382cace161ef0832a6faf6f376e8 (diff)
parent3965c65d5e28e0efdfa693046f6a2059e74465f9 (diff)
downloademacs-f24aa0f46af1f808aa051fdbb44876a1141c928c.tar.gz
Merge from origin/emacs-29
3965c65d5e2 ; * lisp/subr.el (read-char-choice): Fix last change. c1eac5b6586 Improve documentation of 'read-choice' and related symbols a8c9283e170 Revert "Comp fix calls to redefined primtives with op-byt... 8b66d8abd01 Revert "* lisp/emacs-lisp/comp.el (comp-emit-set-call-sub... 4ec4f614c71 ; Fix incompatibility in 'display-buffer-assq-regexp' ba3ade58f3b Skip ruby-ts-imenu-index test if needed 9133446db87 Fix Eglot Tramp tests on EMBA 5b351bc7fa9 * test/infra/Dockerfile.emba (emacs-gnustep): Instrument ...
-rw-r--r--doc/lispref/commands.texi25
-rw-r--r--lisp/emacs-lisp/comp.el30
-rw-r--r--lisp/subr.el56
-rw-r--r--lisp/window.el16
-rw-r--r--test/infra/Dockerfile.emba2
-rw-r--r--test/lisp/progmodes/eglot-tests.el1
-rw-r--r--test/lisp/progmodes/ruby-ts-mode-tests.el1
-rw-r--r--test/src/comp-tests.el13
8 files changed, 70 insertions, 74 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/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 3c57ca79b12..a5ed5df117d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1774,25 +1774,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 (subr-primitive-p 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/lisp/subr.el b/lisp/subr.el
index 39866dd7acb..123275b5971 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3233,34 +3233,40 @@ 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.
-
-By default, the minibuffer is used to read the key
-non-modally (see `read-char-from-minibuffer'). If
+ "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 by default shows a message to the effect that it is not one of
+the expected characters.
+
+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')."
+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)))
(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'
@@ -3556,15 +3562,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.
-
-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.")
+ "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 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.")
diff --git a/lisp/window.el b/lisp/window.el
index d53136d406b..aa7520f30fa 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7565,19 +7565,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
@@ -7736,6 +7733,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)
@@ -7744,7 +7744,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
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba
index 9377a3b5f87..c7a5b36749c 100644
--- a/test/infra/Dockerfile.emba
+++ b/test/infra/Dockerfile.emba
@@ -93,7 +93,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
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index 71d9d7270dd..b11ce942b7d 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -1284,6 +1284,7 @@ macro will assume it exists."
(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
(or (bound-and-true-p ert-remote-temporary-file-directory)
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
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. ;;