]> git.eshelyaron.com Git - emacs.git/commit
cl-print: Put buttons on ellipses
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 13 Jul 2023 23:00:51 +0000 (19:00 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 13 Jul 2023 23:00:51 +0000 (19:00 -0400)
commit3ffb99f28f29cd98094f359ea316468572535aa0
tree52c98ac7315345ab2a811107d82a90c8711e8195
parentee4cc106b88879c86d08c6fcda06657fb15df0f1
cl-print: Put buttons on ellipses

Currently, in *Backtrace* we have a nice behavior for cl-printed objects
where they're truncated by default to a manageable size but we can click
on the "..." to expand them when needed.

The patch below moves that functionality to `cl-print.el` such
that it can be enjoyed "everywhere" (bug#64536).  It also has the
benefit of simplifying the code since `backtrace.el` had to look for
ellipses in order to add buttons to them, whereas now we can put
the ellipses right when we write them.

* lisp/emacs-lisp/cl-print.el (cl-print-object-contents): Improve docstring.
(cl-print-expand-ellipsis-function): New var.
(cl-print--default-expand-ellipsis): New function.
(cl-print-expand-ellipsis): New command.
(cl-print-insert-ellipsis): Allow nil instead of 0 to mean "this elides
the whole object".
(cl-print-ellipsis): Move button type from `backtrace.el`.
(cl-print-propertize-ellipsis): Put a button.
(cl-print--expand-ellipsis): Rename from `cl-print-expand-ellipsis`.
(cl-print-to-string-with-limit): Allow new value t for `limit`.

* lisp/emacs-lisp/backtrace.el (backtrace--font-lock-keywords): Simplify.
(backtrace--match-ellipsis-in-string): Delete function.
(backtrace--change-button-skip): Adjust to new button type name.
(backtrace--expand-ellipsis): New function, extracted from
`backtrace-expand-ellipsis`.
(backtrace-expand-ellipsis): Delete function.
(backtrace-ellipsis): Move button type to `cl-print.el`.
(backtrace--print-to-string): Don't look for cl-print ellipses any more.
(backtrace-mode): Use `backtrace--expand-ellipsis`.

* lisp/ielm.el (ielm--expand-ellipsis): New function.
(inferior-emacs-lisp-mode): Use it to fill the data when expanded.

* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-check-ellipsis-expansion)
(cl-print-tests-check-ellipsis-expansion-rx): Adjust to new internal
function name.
etc/NEWS
etc/NEWS.26
lisp/button.el
lisp/emacs-lisp/backtrace.el
lisp/emacs-lisp/cl-print.el
lisp/ielm.el
test/lisp/emacs-lisp/cl-print-tests.el