Is there a way to get a pretty-printed backtrace buffer?
There is, but you'll have to wait for Emacs 27 to be released or get a build of it in the meantime. Quoth its etc/NEWS file:
* Changes in Specialized Modes and Packages in Emacs 27.1
*** The Lisp Debugger is now based on 'backtrace-mode'.
Backtrace mode adds fontification and commands ...
Try the command sgml-pretty-print from sgml-mode. This operates on the region, so you could mark the buffer first:
Or maybe define a command :
(defun my-xml-pretty-print ()
(unless (featurep 'sgml-mode) (require 'sgml-mode))
(sgml-pretty-print (point-min) (point-max)))
I am not sure what kind of answer you expect, but of course it is possible to get the output as a string. It looks like you already know some elisp (assuming that you posted a self defined function), so I guess you are mainly interested in how to print bullet points. You can just insert a bullet into a string using M-x insert-char, for example
The following lisp code modifies org-babel-variable-assignments:plantuml.
If you prefix a variable of a plantuml source block with json: newlines escaped with the character ?\\ are not stripped from the value of that variable. Instead the substring "\\\"" is reduced to "\"".
If you want to use the Elisp snippet put it into your init file and restart Emacs.
With help from @wvxvw, the problem wasn't yaml-mode, but my before-save-hooks. That listed prelude-cleanup-maybe as the only entry. Disabling prelude-clean-whitespace-on-save fixed the problem. With help from this question, the code below makes that change every time I open a yaml file:
;; whitespace cleanup can conflict with other people's IDEs, so don't ...
The question is really more about printing Lisp sexps (including results of evaluation) than it is about macro expansion, per se. It's just that macro expansion typically results in a large Lisp sexp that can be difficult to work with or read, especially if parts of it are elided (...).
I use pp-eval-last-sexp, which I bind to C-x C-e. (With C-u it inserts ...
All that pp does is call pp-to-string on the object and then it calls princ to print the string. So you can use pp-to-string in your own function and then manipulate the resulting string any way you want, before printing it out.
The s string library might be useful for such manipulation. See https://github.com/magnars/s.el