Merge remote-tracking branch 'origin/master' into feature/byte-switch
This commit is contained in:
commit
ad70ca1dad
82 changed files with 3711 additions and 1427 deletions
|
@ -112,6 +112,18 @@ and some not, use `def-edebug-spec' to specify an `edebug-form-spec'."
|
|||
:type 'boolean
|
||||
:group 'edebug)
|
||||
|
||||
(defcustom edebug-max-depth 150
|
||||
"Maximum recursion depth when instrumenting code.
|
||||
This limit is intended to stop recursion if an Edebug specification
|
||||
contains an infinite loop. When Edebug is instrumenting code
|
||||
containing very large quoted lists, it may reach this limit and give
|
||||
the error message \"Too deep - perhaps infinite loop in spec?\".
|
||||
Make this limit larger to countermand that, but you may also need to
|
||||
increase `max-lisp-eval-depth' and `max-specpdl-size'."
|
||||
:type 'integer
|
||||
:group 'edebug
|
||||
:version "26.1")
|
||||
|
||||
(defcustom edebug-save-windows t
|
||||
"If non-nil, Edebug saves and restores the window configuration.
|
||||
That takes some time, so if your program does not care what happens to
|
||||
|
@ -1452,7 +1464,6 @@ expressions; a `progn' form will be returned enclosing these forms."
|
|||
(defvar edebug-after-dotted-spec nil)
|
||||
|
||||
(defvar edebug-matching-depth 0) ;; initial value
|
||||
(defconst edebug-max-depth 150) ;; maximum number of matching recursions.
|
||||
|
||||
|
||||
;;; Failure to match
|
||||
|
|
|
@ -97,7 +97,7 @@ To be used in ERT tests. If BODY finishes successfully, the test
|
|||
buffer is killed; if there is an error, the test buffer is kept
|
||||
around on error for further inspection. Its name is derived from
|
||||
the name of the test and the result of NAME-FORM."
|
||||
(declare (debug ((form) body))
|
||||
(declare (debug ((":name" form) body))
|
||||
(indent 1))
|
||||
`(ert--call-with-test-buffer ,name-form (lambda () ,@body)))
|
||||
|
||||
|
@ -285,6 +285,30 @@ BUFFER defaults to current buffer. Does not modify BUFFER."
|
|||
(kill-buffer clone)))))))
|
||||
|
||||
|
||||
(defmacro ert-with-message-capture (var &rest body)
|
||||
"Execute BODY while collecting anything written with `message' in VAR.
|
||||
|
||||
Capture all messages produced by `message' when it is called from
|
||||
Lisp, and concatenate them separated by newlines into one string.
|
||||
|
||||
This is useful for separating the issuance of messages by the
|
||||
code under test from the behavior of the *Messages* buffer."
|
||||
(declare (debug (symbolp body))
|
||||
(indent 1))
|
||||
(let ((g-advice (cl-gensym)))
|
||||
`(let* ((,var "")
|
||||
(,g-advice (lambda (func &rest args)
|
||||
(if (or (null args) (equal (car args) ""))
|
||||
(apply func args)
|
||||
(let ((msg (apply #'format-message args)))
|
||||
(setq ,var (concat ,var msg "\n"))
|
||||
(funcall func "%s" msg))))))
|
||||
(advice-add 'message :around ,g-advice)
|
||||
(unwind-protect
|
||||
(progn ,@body)
|
||||
(advice-remove 'message ,g-advice)))))
|
||||
|
||||
|
||||
(provide 'ert-x)
|
||||
|
||||
;;; ert-x.el ends here
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
|
||||
;; Package-Requires: ((emacs "24.1"))
|
||||
;; Version: 1.0.4
|
||||
;; Version: 1.0.5
|
||||
;; Keywords: extensions lisp
|
||||
;; Prefix: let-alist
|
||||
;; Separator: -
|
||||
|
|
|
@ -89,7 +89,8 @@
|
|||
(functionp &rest form)
|
||||
sexp))
|
||||
|
||||
(def-edebug-spec pcase-MACRO pcase--edebug-match-macro)
|
||||
;; See bug#24717
|
||||
(put 'pcase-MACRO 'edebug-form-spec 'pcase--edebug-match-macro)
|
||||
|
||||
;; Only called from edebug.
|
||||
(declare-function get-edebug-spec "edebug" (symbol))
|
||||
|
|
|
@ -115,12 +115,16 @@ threading."
|
|||
binding))
|
||||
bindings)))
|
||||
|
||||
(defmacro if-let (bindings then &rest else)
|
||||
"Process BINDINGS and if all values are non-nil eval THEN, else ELSE.
|
||||
Argument BINDINGS is a list of tuples whose car is a symbol to be
|
||||
bound and (optionally) used in THEN, and its cadr is a sexp to be
|
||||
evalled to set symbol's value. In the special case you only want
|
||||
to bind a single value, BINDINGS can just be a plain tuple."
|
||||
(defmacro if-let* (bindings then &rest else)
|
||||
"Bind variables according to VARLIST and eval THEN or ELSE.
|
||||
Each binding is evaluated in turn with `let*', and evaluation
|
||||
stops if a binding value is nil. If all are non-nil, the value
|
||||
of THEN is returned, or the last form in ELSE is returned.
|
||||
Each element of VARLIST is a symbol (which is bound to nil)
|
||||
or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
|
||||
In the special case you only want to bind a single value,
|
||||
VARLIST can just be a plain tuple.
|
||||
\n(fn VARLIST THEN ELSE...)"
|
||||
(declare (indent 2)
|
||||
(debug ([&or (&rest (symbolp form)) (symbolp form)] form body)))
|
||||
(when (and (<= (length bindings) 2)
|
||||
|
@ -132,15 +136,23 @@ to bind a single value, BINDINGS can just be a plain tuple."
|
|||
,then
|
||||
,@else)))
|
||||
|
||||
(defmacro when-let (bindings &rest body)
|
||||
"Process BINDINGS and if all values are non-nil eval BODY.
|
||||
Argument BINDINGS is a list of tuples whose car is a symbol to be
|
||||
bound and (optionally) used in BODY, and its cadr is a sexp to be
|
||||
evalled to set symbol's value. In the special case you only want
|
||||
to bind a single value, BINDINGS can just be a plain tuple."
|
||||
(defmacro when-let* (bindings &rest body)
|
||||
"Bind variables according to VARLIST and conditionally eval BODY.
|
||||
Each binding is evaluated in turn with `let*', and evaluation
|
||||
stops if a binding value is nil. If all are non-nil, the value
|
||||
of the last form in BODY is returned.
|
||||
Each element of VARLIST is a symbol (which is bound to nil)
|
||||
or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
|
||||
In the special case you only want to bind a single value,
|
||||
VARLIST can just be a plain tuple.
|
||||
\n(fn VARLIST BODY...)"
|
||||
(declare (indent 1) (debug if-let))
|
||||
(list 'if-let bindings (macroexp-progn body)))
|
||||
|
||||
(defalias 'if-let 'if-let*)
|
||||
(defalias 'when-let 'when-let*)
|
||||
(defalias 'and-let* 'when-let*)
|
||||
|
||||
(defsubst hash-table-empty-p (hash-table)
|
||||
"Check whether HASH-TABLE is empty (has 0 elements)."
|
||||
(zerop (hash-table-count hash-table)))
|
||||
|
@ -214,6 +226,11 @@ user enters `recenter', `scroll-up', or `scroll-down' responses,
|
|||
perform the requested window recentering or scrolling and ask
|
||||
again.
|
||||
|
||||
When `use-dialog-box' is t (the default), this function can pop
|
||||
up a dialog window to collect the user input. That functionality
|
||||
requires `display-popup-menus-p' to return t. Otherwise, a text
|
||||
dialog will be used.
|
||||
|
||||
The return value is the matching entry from the CHOICES list.
|
||||
|
||||
Usage example:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue