diff options
| author | Gemini Lasswell | 2019-07-30 10:00:27 -0700 |
|---|---|---|
| committer | Gemini Lasswell | 2019-09-13 13:43:07 -0700 |
| commit | 2093395dbf8563af38f206950d95f0bc20183b9c (patch) | |
| tree | 0e4c7788113b296bf768c125925e3061546e898a /test | |
| parent | 224534ab8d3f60fea28b271859f8eaf373f95089 (diff) | |
| download | emacs-2093395dbf8563af38f206950d95f0bc20183b9c.tar.gz emacs-2093395dbf8563af38f206950d95f0bc20183b9c.zip | |
Improve print output options commands in backtrace-mode (bug#36566)
* lisp/emacs-lisp/backtrace.el (backtrace-view): Mention
:print-gensym in docstring.
(backtrace-mode-map): Add keyboard binding for
backtrace-toggle-print-gensym. Add menu entries for
backtrace-toggle-print-circle and backtrace-toggle-print-gensym.
(backtrace--with-output-variables): Bind print-gensym with value
of :print-gensym found in view plist.
(backtrace-toggle-print-circle): Remove description of
implementation details from docstring.
(backtrace-toggle-print-gensym): New command.
(backtrace--toggle-feature): Add echo area message describing result
of command.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--print-circle): New test.
* doc/lispref/debugging.texi (Backtraces): Document keyboard
binding for backtrace-toggle-print-gensym.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/backtrace-tests.el | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el b/test/lisp/emacs-lisp/backtrace-tests.el index ce827e0166f..be154953423 100644 --- a/test/lisp/emacs-lisp/backtrace-tests.el +++ b/test/lisp/emacs-lisp/backtrace-tests.el | |||
| @@ -335,6 +335,55 @@ line contains the strings \"lambda\" and \"number\"." | |||
| 335 | (should (string-match-p results | 335 | (should (string-match-p results |
| 336 | (backtrace-tests--get-substring (point-min) (point-max))))))) | 336 | (backtrace-tests--get-substring (point-min) (point-max))))))) |
| 337 | 337 | ||
| 338 | (ert-deftest backtrace-tests--print-gensym () | ||
| 339 | "Backtrace buffers can toggle `print-gensym' syntax." | ||
| 340 | (ert-with-test-buffer (:name "print-gensym") | ||
| 341 | (let* ((print-gensym nil) | ||
| 342 | (arg (list (gensym "first") (gensym) (gensym "last"))) | ||
| 343 | (results (backtrace-tests--make-regexp | ||
| 344 | (backtrace-tests--result arg))) | ||
| 345 | (results-gensym (regexp-quote (let ((print-gensym t)) | ||
| 346 | (backtrace-tests--result arg)))) | ||
| 347 | (last-frame (backtrace-tests--make-regexp | ||
| 348 | (format (nth (1- backtrace-tests--line-count) | ||
| 349 | (backtrace-tests--backtrace-lines)) | ||
| 350 | arg))) | ||
| 351 | (last-frame-gensym (regexp-quote | ||
| 352 | (let ((print-gensym t)) | ||
| 353 | (format (nth (1- backtrace-tests--line-count) | ||
| 354 | (backtrace-tests--backtrace-lines)) | ||
| 355 | arg))))) | ||
| 356 | (backtrace-tests--make-backtrace arg) | ||
| 357 | (backtrace-print) | ||
| 358 | (should (string-match-p results | ||
| 359 | (backtrace-tests--get-substring (point-min) (point-max)))) | ||
| 360 | ;; Go to the last frame. | ||
| 361 | (goto-char (point-max)) | ||
| 362 | (forward-line -1) | ||
| 363 | ;; Turn on print-gensym for that frame. | ||
| 364 | (backtrace-toggle-print-gensym) | ||
| 365 | (should (string-match-p last-frame-gensym | ||
| 366 | (backtrace-tests--get-substring (point) (point-max)))) | ||
| 367 | ;; Turn off print-gensym for the frame. | ||
| 368 | (backtrace-toggle-print-gensym) | ||
| 369 | (should (string-match-p last-frame | ||
| 370 | (backtrace-tests--get-substring (point) (point-max)))) | ||
| 371 | (should (string-match-p results | ||
| 372 | (backtrace-tests--get-substring (point-min) (point-max)))) | ||
| 373 | ;; Turn print-gensym on for the buffer. | ||
| 374 | (backtrace-toggle-print-gensym '(4)) | ||
| 375 | (should (string-match-p last-frame-gensym | ||
| 376 | (backtrace-tests--get-substring (point) (point-max)))) | ||
| 377 | (should (string-match-p results-gensym | ||
| 378 | (backtrace-tests--get-substring (point-min) (point-max)))) | ||
| 379 | ;; Turn print-gensym off. | ||
| 380 | (backtrace-toggle-print-gensym '(4)) | ||
| 381 | (should (string-match-p last-frame | ||
| 382 | (backtrace-tests--get-substring | ||
| 383 | (point) (+ (point) (length last-frame))))) | ||
| 384 | (should (string-match-p results | ||
| 385 | (backtrace-tests--get-substring (point-min) (point-max))))))) | ||
| 386 | |||
| 338 | (defun backtrace-tests--make-regexp (str) | 387 | (defun backtrace-tests--make-regexp (str) |
| 339 | "Make regexp from STR for `backtrace-tests--print-circle'. | 388 | "Make regexp from STR for `backtrace-tests--print-circle'. |
| 340 | Used for results of printing circular objects without | 389 | Used for results of printing circular objects without |