diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-12-25 06:30:21 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-12-25 06:30:21 +0100 |
commit | 48db8b68a8eb5c12d5682f2eb31cadc53186f5d7 (patch) | |
tree | 3798efa0cd02c6ed2c3e6fe1f7cd8f3059fe492e /lisp/emacs-lisp | |
parent | 4dc5bee98d5734b4f7113b961bafead1eb091bd0 (diff) | |
parent | c36fe3df17b37a705299239d6ef0185ad55b1d3a (diff) | |
download | emacs-48db8b68a8eb5c12d5682f2eb31cadc53186f5d7.tar.gz emacs-48db8b68a8eb5c12d5682f2eb31cadc53186f5d7.tar.bz2 emacs-48db8b68a8eb5c12d5682f2eb31cadc53186f5d7.zip |
Merge from origin/emacs-29
c36fe3df17b Fix c-ts-mode imenu defun name (bug#60296)
a24e350170e Fix treesit--children-covering-range-recurse (bug#60301)
fbb4eb919b4 Support treesit-defun-name in tree-sitter major modes
6253184afc2 ; * lisp/treesit.el (treesit-defun-at-point): Guard again...
f8e219ebfaa Add treesit-defun-name and friends
35c2ca2ca64 Make treesit-node-at/on guess language at point
7f7def2ae62 ; Add treesit-no-parser error
b6a2e1ddf66 * nt/INSTALL.W64: update instructions for setting up W64 ...
265b91d891a Revert "; Bump minimum supported Windows version for MinG...
75155e45860 ; Bump minimum supported Windows version for MinGW64 to W...
677f6c79eb9 ; Update minimum requirements of MinGW-w64
7723af5e4aa ; * lisp/progmodes/c-ts-mode.el: quote literal string in ...
38866510c7c ; * src/xdisp.c (redisplay_internal): Reinstate the FRAME...
a825aa0b135 Fix definition of CNS 11643-15 charset
a42b20dd95e ; * lisp/progmodes/c-ts-mode.el: Add outline section head...
e4e36345399 Improve c-ts-mode block comment indent (bug#60270)
e30621caa2c ; Add treesit_recursion_limit
6a43af58802 Fix block comment indent and filling for c-ts-mode (bug#5...
e492c21e810 Fix treesit_cursor_helper (bug#60267)
4437dbedf7b Fix restart-emacs alarms (Bug#60220)
121a9ff9f6f Fix alternate stack test in configure
84888080eea Add more functions to "string" shortdoc
c90f97d4e5d Make the Contour terminal an alias of xterm-256color
c3fac9465fa ; Fix punctuation in last change.
756bb422a49 Correct wrong info in (info)Go to node
a8c3424d28b Fix typo in TUTORIAL.fr (bug#60261)
24cd2f0daf1 Add some diff-fixup-modifs tests
d32091199ae Fix quoted argument in emacsclient-mail.desktop Exec key
286c48137f6 ert-x: Move window selection logic to its own macro
823c49cea85 ; ert-x: Simplify `ert-with-test-buffer-selected'
38c6abe4d0b ; ert-x: Add test for buffer read-only state
0e39ad6fa56 Fix crash after X error
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/ert-x.el | 53 | ||||
-rw-r--r-- | lisp/emacs-lisp/shortdoc.el | 9 |
2 files changed, 32 insertions, 30 deletions
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 49f2a1d6965..0614313809c 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -102,42 +102,35 @@ the name of the test and the result of NAME-FORM." (indent 1)) `(ert--call-with-test-buffer ,name-form (lambda () ,@body))) -(cl-defmacro ert-with-test-buffer-selected ((&key name) - &body body) - "Create a test buffer, switch to it, and run BODY. +(cl-defmacro ert-with-buffer-selected (buffer-or-name &body body) + "Display a buffer in a temporary selected window and run BODY. + +If BUFFER-OR-NAME is nil, the current buffer is used. -This extends `ert-with-test-buffer' by displaying the test -buffer (whose name is derived from NAME) in a temporary window. -The temporary window becomes the `selected-window' before BODY is -evaluated. The modification hooks `before-change-functions' and +The buffer is made the current buffer, and the temporary window +becomes the `selected-window', before BODY is evaluated. The +modification hooks `before-change-functions' and `after-change-functions' are not inhibited during the evaluation of BODY, which makes it easier to use `execute-kbd-macro' to simulate user interaction. The window configuration is restored before returning, even if BODY exits nonlocally. The return value is the last form in BODY." - (declare (debug ((":name" form) def-body)) - (indent 1)) - (let ((ret (make-symbol "ert--with-test-buffer-selected-ret"))) - `(save-window-excursion - (let (,ret) - (ert-with-test-buffer (:name ,name) - (with-current-buffer-window (current-buffer) - `(display-buffer-below-selected - (body-function - . ,(lambda (window) - (select-window window t) - ;; body-function is intended to initialize the - ;; contents of a temporary read-only buffer, so - ;; it is executed with some convenience - ;; changes. Undo those changes so that the - ;; test buffer behaves more like an ordinary - ;; buffer while the body executes. - (let ((inhibit-modification-hooks nil) - (inhibit-read-only nil) - (buffer-read-only nil)) - (setq ,ret (progn ,@body)))))) - nil)) - ,ret)))) + (declare (debug (form body)) (indent 1)) + `(save-window-excursion + (with-current-buffer (or ,buffer-or-name (current-buffer)) + (with-selected-window (display-buffer (current-buffer)) + ,@body)))) + +(cl-defmacro ert-with-test-buffer-selected ((&key name) &body body) + "Create a test buffer, switch to it, and run BODY. + +This combines `ert-with-test-buffer' and +`ert-with-buffer-selected'. The return value is the last form in +BODY." + (declare (debug ((":name" form) body)) (indent 1)) + `(ert-with-test-buffer (:name ,name) + (ert-with-buffer-selected (current-buffer) + ,@body))) ;;;###autoload (defun ert-kill-all-test-buffers () diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 6704db3cc57..90f81d740f2 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -263,6 +263,12 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), :eval (stringp "a") :eval (stringp 'a) :eval "(stringp ?a)") + (string-or-null-p + :eval (string-or-null-p "a") + :eval (string-or-null-p nil)) + (char-or-string-p + :eval "(char-or-string-p ?a)" + :eval (char-or-string-p "a")) (string-empty-p :no-manual t :eval (string-empty-p "")) @@ -300,6 +306,9 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), :eval (string-to-number "2.5e+03")) (number-to-string :eval (number-to-string 42)) + (char-uppercase-p + :eval "(char-uppercase-p ?A)" + :eval "(char-uppercase-p ?a)") "Data About Strings" (length :eval (length "foo") |