emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: Aaron Ecay <aaronecay@gmail.com>,
	Andreas Leha <andreas.leha@med.uni-goettingen.de>,
	emacs-orgmode@gnu.org, Ista Zahn <istazahn@gmail.com>,
	mcg <giepen.m@googlemail.com>
Subject: Re: New patches WAS Re: [PATCH] inline src block results can be removed
Date: Mon, 19 Jan 2015 18:53:55 +0100	[thread overview]
Message-ID: <87oapuac7g.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <alpine.OSX.2.00.1501181855470.2446@charles-berrys-macbook.local> (Charles C. Berry's message of "Sun, 18 Jan 2015 19:22:36 -0800")

"Charles C. Berry" <ccberry@ucsd.edu> 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 "{{{<name>(" 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,

  reply	other threads:[~2015-01-19 17:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12  0:49 [PATCH] inline src block results can be removed Charles C. Berry
2014-11-12  1:10 ` Andreas Leha
2014-11-12  6:58   ` Charles C. Berry
2014-11-12 19:34 ` Aaron Ecay
2014-11-12 23:47   ` Charles C. Berry
2014-11-13 17:48     ` Nicolas Goaziou
2014-11-13 19:06       ` Andreas Leha
2014-11-14 17:43       ` Charles C. Berry
2014-11-14 20:39         ` Nicolas Goaziou
2014-11-14 23:04           ` Aaron Ecay
2014-11-16  0:10             ` Nicolas Goaziou
2014-11-15 20:22           ` Charles C. Berry
2014-11-16 23:23             ` Nicolas Goaziou
2014-11-24  9:48               ` Daniele Pizzolli
2014-11-24 10:18                 ` Andreas Leha
2015-01-13  0:48               ` New patches WAS " Charles C. Berry
2015-01-16 22:41                 ` Nicolas Goaziou
2015-01-19  3:22                   ` Charles C. Berry
2015-01-19 17:53                     ` Nicolas Goaziou [this message]
2015-01-19 19:31                       ` Charles C. Berry
2015-01-20 23:30                         ` Nicolas Goaziou
2015-01-22  3:07                           ` Charles C. Berry
2015-01-22 23:08                             ` Nicolas Goaziou
2015-01-24 22:47                               ` Charles C. Berry
2015-01-25  1:14                                 ` Aaron Ecay
2015-01-25  5:01                                   ` Charles C. Berry
2015-01-29 20:31                               ` Charles C. Berry
2015-01-17  3:22                 ` Aaron Ecay
2015-01-17 22:20                   ` Nicolas Goaziou
2015-01-18 19:13                     ` Aaron Ecay
2015-01-18 22:34                       ` Nicolas Goaziou
2015-01-18 22:55                         ` Aaron Ecay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oapuac7g.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=aaronecay@gmail.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=giepen.m@googlemail.com \
    --cc=istazahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).