diff options
author | Gemini Lasswell <gazally@runbox.com> | 2019-07-30 10:00:27 -0700 |
---|---|---|
committer | Gemini Lasswell <gazally@runbox.com> | 2019-09-13 13:43:07 -0700 |
commit | 2093395dbf8563af38f206950d95f0bc20183b9c (patch) | |
tree | 0e4c7788113b296bf768c125925e3061546e898a /test/lisp/emacs-lisp/backtrace-tests.el | |
parent | 224534ab8d3f60fea28b271859f8eaf373f95089 (diff) | |
download | emacs-2093395dbf8563af38f206950d95f0bc20183b9c.tar.gz emacs-2093395dbf8563af38f206950d95f0bc20183b9c.tar.bz2 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/lisp/emacs-lisp/backtrace-tests.el')
-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\"." (should (string-match-p results (backtrace-tests--get-substring (point-min) (point-max))))))) +(ert-deftest backtrace-tests--print-gensym () + "Backtrace buffers can toggle `print-gensym' syntax." + (ert-with-test-buffer (:name "print-gensym") + (let* ((print-gensym nil) + (arg (list (gensym "first") (gensym) (gensym "last"))) + (results (backtrace-tests--make-regexp + (backtrace-tests--result arg))) + (results-gensym (regexp-quote (let ((print-gensym t)) + (backtrace-tests--result arg)))) + (last-frame (backtrace-tests--make-regexp + (format (nth (1- backtrace-tests--line-count) + (backtrace-tests--backtrace-lines)) + arg))) + (last-frame-gensym (regexp-quote + (let ((print-gensym t)) + (format (nth (1- backtrace-tests--line-count) + (backtrace-tests--backtrace-lines)) + arg))))) + (backtrace-tests--make-backtrace arg) + (backtrace-print) + (should (string-match-p results + (backtrace-tests--get-substring (point-min) (point-max)))) + ;; Go to the last frame. + (goto-char (point-max)) + (forward-line -1) + ;; Turn on print-gensym for that frame. + (backtrace-toggle-print-gensym) + (should (string-match-p last-frame-gensym + (backtrace-tests--get-substring (point) (point-max)))) + ;; Turn off print-gensym for the frame. + (backtrace-toggle-print-gensym) + (should (string-match-p last-frame + (backtrace-tests--get-substring (point) (point-max)))) + (should (string-match-p results + (backtrace-tests--get-substring (point-min) (point-max)))) + ;; Turn print-gensym on for the buffer. + (backtrace-toggle-print-gensym '(4)) + (should (string-match-p last-frame-gensym + (backtrace-tests--get-substring (point) (point-max)))) + (should (string-match-p results-gensym + (backtrace-tests--get-substring (point-min) (point-max)))) + ;; Turn print-gensym off. + (backtrace-toggle-print-gensym '(4)) + (should (string-match-p last-frame + (backtrace-tests--get-substring + (point) (+ (point) (length last-frame))))) + (should (string-match-p results + (backtrace-tests--get-substring (point-min) (point-max))))))) + (defun backtrace-tests--make-regexp (str) "Make regexp from STR for `backtrace-tests--print-circle'. Used for results of printing circular objects without |