From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: New patches WAS Re: [PATCH] inline src block results can be removed Date: Mon, 19 Jan 2015 18:53:55 +0100 Message-ID: <87oapuac7g.fsf@nicolasgoaziou.fr> References: <87egt81acy.fsf@gmail.com> <8761ejq9ek.fsf@nicolasgoaziou.fr> <87sihltt3v.fsf@selenimh.mobile.lan> <87zjbqrapy.fsf@nicolasgoaziou.fr> <87lhl2s5zc.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDGVV-0000U5-6W for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 12:52:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDGVR-00057L-VW for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 12:52:57 -0500 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]:48968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDGVR-00057E-MO for emacs-orgmode@gnu.org; Mon, 19 Jan 2015 12:52:53 -0500 In-Reply-To: (Charles C. Berry's message of "Sun, 18 Jan 2015 19:22:36 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Charles C. Berry" Cc: Aaron Ecay , Andreas Leha , emacs-orgmode@gnu.org, Ista Zahn , mcg "Charles C. Berry" writes: Thanks for the patches. Here's another round of comments. > OK. Now those cases (and some others) insert `*Inline error:' and a > comment as to what the error is and ignore the actual value. > > Based on my own experience, I thought it best to allow Babel to run > without stopping when there are problems with inline src blocks rather > than stop with an error. We already stop with an error for missing footnotes definitions or missing macro templates. I'm not totally against your suggestion, but I think it would be better to follow this. > I hope the approach I took modifies `org-macro-expand'. > > The "as-is" template returns the macro element :value stripped of the > leading "{{{(" and the trailing "[\n]?)}}}". The template > allows macros that mark text - possibly including commas - but do not > modify it. Actually I preferred the previous implementation because this one adds another level of indirection, the (undocumented) "as-is" template. "results" -> "$1" was more elegant. We just need an `org-macro-protect-argument' function. I can do the refactoring if you want. > I am not sure why you mentioned org-element.el. The snippet you were using comes from `org-element-macro-parser', in "org-element.el". If two locations use the same snippet, it is better to refactor it. > (defun org-babel-insert-result > (result &optional result-params info hash indent lang) > "Insert RESULT into the current buffer. > -By default RESULT is inserted after the end of the > -current source block. With optional argument RESULT-PARAMS > -controls insertion of results in the org-mode file. > +By default RESULT is inserted after the end of the current source > +block. The RESULT of an inline source block usually will be > +wrapped inside a `results' macro and placed on the same line as > +the inline source block. The macro is stripped upon > +export. Multiline and non-scalar RESULTS from inline source > +blocks are fragile and should be avoided. With optional argument ^^^ Two spaces needed. > +RESULT-PARAMS controls insertion of results in the Org mode file. > RESULT-PARAMS can take the following values: "It can take"? Or, "The following values are allowed"... > + (bad-inline-p > + (when inlinep > + (or > + (and (member "table" result-params) "`:results table'") > + (and (listp result) "list result") > + (and (string-match-p "\n.+" result) "multiline result") > + (and (member "list" result-params) "`:results list'") > + ))) No parenthesis on their own line. > +(defun org-babel-remove-inline-result () > + "Remove the result of the current inline-src-block. > +The result must be wrapped in a `results' macro to be > + removed. Extraneous leading whitespace is trimmed." > + (let* ((el (org-element-context)) > + (post-blank (org-element-property :post-blank el))) > + (when (member (org-element-type el) '(inline-src-block inline-babel-call)) `member' -> `memq' Regards,