[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lisp/ob-plantuml.el: Insert results in buffer
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] lisp/ob-plantuml.el: Insert results in buffer |
Date: |
Mon, 25 Jul 2022 21:15:40 +0800 |
Joseph Turner <joseph@breatheoutbreathe.in> writes:
> Allow src block execution without ":file" header arg. When ":file" is
> omitted, insert txt output in buffer below src block.
>
> TINYCHANGE
Thanks for your contribution!
This addition makes a lot of sense.
Some comments:
Most importantly, the patch does not change the default value of
org-babel-default-header-args:plantuml. :results header arg is set to
"file" by default. This yields something like the following:
#+begin_src plantuml
Bob->Alice : Hello1!
#+end_src
#+RESULTS:
[[file: ,---. ,-----.
|Bob| |Alice|
`-+-' `--+--'
| Hello1! |
|-------------->|
,-+-. ,--+--.
|Bob| |Alice|
`---' `-----'
]]
Note that the output is treated as a path to file:
[[file: ... output string ...]]
which is indeed wrong.
The solution will be simply removing the default :results setting.
Other comments are for code and documentation style.
> Allow src block execution without ":file" header arg. When ":file" is
> omitted, insert txt output in buffer below src block.
Please use double space between sentences. See
https://orgmode.org/worg/org-contribute.html
> +
> +*** =org-babel-execute:plantuml= can output ASCII graphs in the buffer
> +
> +Previously, executing PlantUML src blocks required a ":file" header
> argument. Now, if that header argument is omitted, an ASCII graph will be
> inserted below the src block.
> +
Likewise. Also, please fill the paragraph making sure that each line
spans less than 80 columns. Same for the code and comments inside the
code.
> - nil)) ;; signal that output has already been written to file
> + (unless do-export (with-temp-buffer
> + (insert-file-contents out-file)
> + (buffer-substring-no-properties (point-min)
> (point-max))
> + ))))
We follow Elisp conventions regarding indentation and parenthesis
placement as in D.1 Emacs Lisp Coding Conventions - do not leave
parenthesis on the line of their own.
Also, the way you typed unless leads to excessive indentation. You could
instead do
(unless do-export
(with-temp-buffer
...))
Best,
Ihor