From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: asynchronous exporter and babel confirmation Date: Wed, 06 Mar 2013 21:25:51 +0100 Message-ID: <87ehfse0mo.fsf@gmail.com> References: <87fw082603.fsf@gmail.com> <87r4jszo5e.fsf@gmail.com> <87lia0b9ac.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDKud-0003zf-Q8 for emacs-orgmode@gnu.org; Wed, 06 Mar 2013 15:26:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDKuZ-00041q-Pn for emacs-orgmode@gnu.org; Wed, 06 Mar 2013 15:26:07 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:37236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDKuZ-00041m-Iv for emacs-orgmode@gnu.org; Wed, 06 Mar 2013 15:26:03 -0500 Received: by mail-wg0-f45.google.com with SMTP id dq12so8292143wgb.12 for ; Wed, 06 Mar 2013 12:26:02 -0800 (PST) In-Reply-To: <87lia0b9ac.fsf@Rainer.invalid> (Achim Gratz's message of "Wed, 06 Mar 2013 20:47:07 +0100") 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: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz 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: =C2=B0org-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 disable= d." > + 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 dis= abled." 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 sy= stem? " code-block block-name))) (prog1 nil (message (format "Evaluation of%scode-block%snot conf= irmed." 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, --=20 Nicolas Goaziou