From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Achim Gratz <Stromeko@nexgo.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: asynchronous exporter and babel confirmation
Date: Wed, 06 Mar 2013 21:25:51 +0100 [thread overview]
Message-ID: <87ehfse0mo.fsf@gmail.com> (raw)
In-Reply-To: <87lia0b9ac.fsf@Rainer.invalid> (Achim Gratz's message of "Wed, 06 Mar 2013 20:47:07 +0100")
Achim Gratz <Stromeko@nexgo.de> writes:
> I'm still waiting for feedback from Karl Voit over in the other thread,
> but here's the amended patch for you to review:
Thanks. I haven't much to say wrt to the internals since the only thing
needed to make use of this patch is to set
`org-babel--suppress-confirm-evaluate-answer-no' to t from
`org-export-async-start'. I would suggest a shorter variable name,
though, as: °org-babel--no-confirm-force-no'. But that doesn't really
matter.
I'll just focus on cosmetics.
> * lisp/ob-core.el (org-babel-confirm-evaluate): Refactor this internal
> function.
You should mention explicitly that you removed this function. This is
not a refactoring.
> -;;; ob-core.el --- working with code blocks in org-mode
> +;; ob-core.el --- working with code blocks in org-mode
You should leave 3 semicolons. This is standard elisp library starter.
> +(defmacro org-babel--check-confirm-evaluate (info &rest body)
> + "Pull some information from code block INFO and evaluate BODY.
> +"
Spurious blank line.
> +(defun org-babel--check-evaluate (info)
> + "Check whether the code block INFO should be evaluated.
> +"
Ditto.
> + (org-babel--check-confirm-evaluate info
> + (if (or (equal eval "never") (equal eval "no")
> + (and (boundp 'org-current-export-file) org-current-export-file
> + (or (equal eval "no-export") (equal eval "never-export"))))
> + (prog1 nil (message (format "Evaluation of this%scode block%sis disabled."
> + code-block block-name)))
> + t)))
I would refactor it like the following:
(org-babel--check-confirm-evaluate info
(or (equal eval "never") (equal eval "no")
(and (org-bound-and-true-p org-current-export-file)
(or (equal eval "no-export") (equal eval "never-export")))
(prog1 nil (message (format "Evaluation of this%scode block%sis disabled."
code-block block-name)))))
> + (org-babel--check-confirm-evaluate info
> + (let* ((query (cond ((equal eval "query") t)
> + ((and (boundp 'org-current-export-file) org-current-export-file
(org-bound-and-true-p org-current-export-file)
> + (if (and query
> + (or (null org-babel--suppress-confirm-evaluate-answer-no)
> + (not (yes-or-no-p
> + (format "Evaluate this%scode block%son your system? "
> + code-block block-name)))))
> + (prog1 nil (message
> + (format "Evaluation of%scode-block%snot confirmed."
> + code-block block-name)))
> + t))))
(and query
(or (not org-babel--suppress-confirm-evaluate-answer-no)
(not (yes-or-no-p (format "Evaluate this%scode block%son your system? "
code-block block-name)))
(prog1 nil (message (format "Evaluation of%scode-block%snot confirmed."
code-block block-name)))))
> + (if (boundp 'org-babel-call-process-region-original)
> + org-babel-call-process-region-original
> + (symbol-function 'call-process-region)))
(or (org-bound-and-true-p org-babel-call-process-region-original)
(symbol-function 'call-process-region))
[...]
> + (org-babel-insert-result
> + result result-params info new-hash indent lang)
> + (run-hooks 'org-babel-after-execute-hook)
> + result
> + )))
Dangling parens.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2013-03-06 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 9:30 asynchronous exporter and babel confirmation Alan Schmitt
2013-03-06 10:10 ` Nicolas Goaziou
2013-03-06 12:34 ` Achim Gratz
2013-03-06 12:52 ` Nicolas Goaziou
2013-03-06 19:47 ` Achim Gratz
2013-03-06 20:25 ` Nicolas Goaziou [this message]
2013-03-06 22:17 ` Achim Gratz
2013-03-06 22:38 ` Nicolas Goaziou
2013-03-06 22:44 ` Achim Gratz
2013-03-09 22:20 ` Achim Gratz
2013-03-09 23:19 ` Nicolas Goaziou
2013-03-10 15:38 ` Alan Schmitt
2013-03-06 13:04 ` Alan Schmitt
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ehfse0mo.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=Stromeko@nexgo.de \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.