From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iOjvMGaX3mJiDQEAbAwnHQ (envelope-from ) for ; Mon, 25 Jul 2022 15:15:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id CKvaMGaX3mIdhAEA9RJhRA (envelope-from ) for ; Mon, 25 Jul 2022 15:15:18 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AC7E51E900 for ; Mon, 25 Jul 2022 15:15:18 +0200 (CEST) Received: from localhost ([::1]:38220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oFxvZ-0002ny-Hf for larch@yhetil.org; Mon, 25 Jul 2022 09:15:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFxuy-0002nZ-Vn for emacs-orgmode@gnu.org; Mon, 25 Jul 2022 09:14:41 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:33737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oFxux-0007uU-AI for emacs-orgmode@gnu.org; Mon, 25 Jul 2022 09:14:40 -0400 Received: by mail-pf1-x42e.google.com with SMTP id 17so10455567pfy.0 for ; Mon, 25 Jul 2022 06:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=a0aO6nQ/44Wd/I7L8XKQjeIcMD0n4TLcwQim8s+1bVA=; b=C/7f5Z3RXz6XNZK3ppro6igTjKYZwWIGCkVOoUq7h2Fm3KXHlZaswpWwppd6KySqLH zekgDNJCcnXw/h/OysTkF872e4VFfEi4Avpq3EW6+pT3XFtlHrX+RcPq57BzJ58Klp73 oOu9iM7KUrrqHQECgITpIC6d5QgCi4tUcQpLdHE8kcKwC3EIWYGZrou4nPoiCqVNrGB/ p+BESujreTxDLTEnywfXcZ+5E1j7eUfmCE3+2fdD6T1I3AXequ2GfORIFeJBZ77Ile8v 6oL3oGhRTZvJx7DUOPAKWkwbAB/q3HbQXzq/leWRIBXxKWrxDeP/wFqTQ3FyNi970ZgF ybOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=a0aO6nQ/44Wd/I7L8XKQjeIcMD0n4TLcwQim8s+1bVA=; b=o6opeP8NSGyrIe0FS/rGiDlrkmTKFHMFfhfe7dceOPRVkiqrxxwIniEGg6vWYScMJy UqhqUeBFsclQzwCwS8Ltz5UAw10uDJlo7T+1vI9vCZ7u0JkF4zqoROLVhXNmnbKiohd7 xDjnRGg0g27d6qe4Rv1XAH3eMIa9Go8+7enVhrXRxZxFGt5pJTNtzB1KxhsEM1VMYsxD Agp218h84EQcWEFhbS3jc+cK8fUj8frlvmaoW6vXwJjdsQfFtw8rQZfw6PRxjV8XT98h +5hUXMfMopwhQYe0t4ZZQiSJPPvWRNgRBQx1Xu8nLw8V7YIGQKV5FlvIn0Qo7pq6rc+U /wKQ== X-Gm-Message-State: AJIora8KcTyapzlGV8uqJ4mKx4yJwRixKf9hfJCbp8lf7xFtsVbcjt+C khTPfOHcYLuRZX2oDjZWwW60kG7zilc= X-Google-Smtp-Source: AGRyM1v0VvuFqGRps0JgWyMUKVbH5MS8UItAS6CKjJ051zKTGzcIjxmJk4kHDUpgydKVNm07YA4Fig== X-Received: by 2002:a05:6a00:2403:b0:52b:cd68:27f0 with SMTP id z3-20020a056a00240300b0052bcd6827f0mr13069188pfh.11.1658754877354; Mon, 25 Jul 2022 06:14:37 -0700 (PDT) Received: from localhost ([2409:8a70:217:4f80:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id z8-20020aa79e48000000b005251b1fde90sm9522083pfq.219.2022.07.25.06.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 06:14:36 -0700 (PDT) From: Ihor Radchenko To: Joseph Turner Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/ob-plantuml.el: Insert results in buffer In-Reply-To: <20220719231520.100206-1-joseph@breatheoutbreathe.in> References: <20220719231520.100206-1-joseph@breatheoutbreathe.in> Date: Mon, 25 Jul 2022 21:15:40 +0800 Message-ID: <87bktduydf.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" Authentication-Results: aspmx1.migadu.com; none X-Migadu-Scanner: scn0.migadu.com X-TUID: LOUSMSfVlJyq Joseph Turner 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