emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH][BUG] org-babel-confirm-evaluate
@ 2015-11-07  0:11 Charles C. Berry
  2015-11-07 10:48 ` Aaron Ecay
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2015-11-07  0:11 UTC (permalink / raw)
  To: Org-Mode mailing list, aaronecay

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]


Seems like this commit

   commit 40356ae3765d123fd9950a961718530219fa5cb8
   Author: Aaron Ecay <aaronecay@gmail.com>
   Date:   Thu Nov 5 15:51:06 2015 +0000

broke Babel. At least I cannot get C-c C-c to execute sec blocks when I 
respond 'y' to queries.

I think this patch fixes it (and some typos), but I hesitate to push it in 
case there is something I am not seeing about the recent changes.

Chuck

[-- Attachment #2: confirm-eval patch --]
[-- Type: text/plain, Size: 1597 bytes --]

From 35edc2835bea76f494df9c42d3d7927d4a10bbd0 Mon Sep 17 00:00:00 2001
From: Charles Berry <ccberry@ucsd.edu>
Date: Fri, 6 Nov 2015 16:00:50 -0800
Subject: [PATCH] ob-core.el: org-babel-confirm-evaluate bugfix

* lisp/ob-core.el (org-babel-confirm-evaluate): Return t/nil for y/n answer to query.   Minor edits of prompt and message.
---
 lisp/ob-core.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 739bbcd..53aa1f5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -344,15 +344,17 @@ environment, to override this check."
     (pcase evalp
       (`nil nil)
       (`t t)
-      (`query (unless
-		  (and (not (org-bound-and-true-p
-			     org-babel-confirm-evaluate-answer-no))
-		       (yes-or-no-p
-			(format "Evaluate this %s code block%son your system? "
-				lang name-string)))
-		(message "Evaluation of this %s code-block%sis aborted."
-			 lang name-string)))
-      (x (error "Unexepcted value `%s' from `org-babel-check-confirm-evaluate'" x)))))
+      (`query (or
+	       (and (not (org-bound-and-true-p
+			  org-babel-confirm-evaluate-answer-no))
+		    (yes-or-no-p
+		     (format "Evaluate this %s code block%s on your system? "
+			     lang name-string)))
+	       (and
+		(message "Evaluation of this %s code-block%s is aborted."
+			 lang name-string)
+		nil)))
+      (x (error "Unexpected value `%s' from `org-babel-check-confirm-evaluate'" x)))))
 
 ;;;###autoload
 (defun org-babel-execute-safely-maybe ()
-- 
2.4.9 (Apple Git-60)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][BUG] org-babel-confirm-evaluate
  2015-11-07  0:11 [PATCH][BUG] org-babel-confirm-evaluate Charles C. Berry
@ 2015-11-07 10:48 ` Aaron Ecay
  2015-11-07 18:13   ` Charles C. Berry
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Ecay @ 2015-11-07 10:48 UTC (permalink / raw)
  To: Charles C. Berry, Org-Mode mailing list

Hi Chuck,

The patch is fundamentally correct, please push it.  A couple minor
comments:

2015ko azaroak 7an, "Charles C. Berry"-ek idatzi zuen:

[...]

> +      (`query (or
> +	       (and (not (org-bound-and-true-p
> +			  org-babel-confirm-evaluate-answer-no))
> +		    (yes-or-no-p
> +		     (format "Evaluate this %s code block%s on your system? "
                                                          ^^^
Rather than inserting that space, you should make the no-name value of
name-string a single space.  Otherwise there will be two spaces if the
block does have a name.

> +			     lang name-string)))
> +	       (and
> +		(message "Evaluation of this %s code-block%s is aborted."
> +			 lang name-string)
> +		nil)))

I think ‘progn’ would be better than ‘and’ here, just as a matter of
style.  Same comment as above applies about the extra space.

Thanks very much for the patch, and sorry for the breakage,
Aaron

PS Git gave me some strange errors about trailing whitespace when trying
to apply your patch, until I converted it from DOS to Unix line
endings.  I’ve never seen git do that before – I think it usually copes
very well with different line ending styles.  Does anyone know what to
do in this scenario?  Manually changing the line endings of the patch
file seems hackish.

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][BUG] org-babel-confirm-evaluate
  2015-11-07 10:48 ` Aaron Ecay
@ 2015-11-07 18:13   ` Charles C. Berry
  2015-11-07 21:36     ` Aaron Ecay
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2015-11-07 18:13 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: Org-Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Sat, 7 Nov 2015, Aaron Ecay wrote:

> Hi Chuck,
>
> The patch is fundamentally correct, please push it.  A couple minor
> comments:
>

Thanks for the comments. I've revised as suggested. The patch has been 
pushed as

   commit 3f6e71e62e558f4a1c4316c9ecf0519a905e87f3
   Author: Charles Berry <ccberry@ucsd.edu>
   Date:   Fri Nov 6 16:00:50 2015 -0800


>
> PS Git gave me some strange errors about trailing whitespace when trying
> to apply your patch, until I converted it from DOS to Unix line
> endings.  I’ve never seen git do that before – I think it usually copes
> very well with different line ending styles.  Does anyone know what to
> do in this scenario?  Manually changing the line endings of the patch
> file seems hackish.

Strange.

I produced the patch on Mac OS X 10.11.1 with the usual

 	git format-patch master -o <path>

command line using

 	git version 2.4.9 (Apple Git-60)

and sent it as an email attachment using alpine as the client.

Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][BUG] org-babel-confirm-evaluate
  2015-11-07 18:13   ` Charles C. Berry
@ 2015-11-07 21:36     ` Aaron Ecay
  0 siblings, 0 replies; 4+ messages in thread
From: Aaron Ecay @ 2015-11-07 21:36 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: Org-Mode mailing list

Hi Chuck,

2015ko azaroak 7an, "Charles C. Berry"-ek idatzi zuen:
> 
> 
> Thanks for the comments. I've revised as suggested. The patch has been 
> pushed as

Thanks.

> 
> Strange.
> 
> I produced the patch on Mac OS X 10.11.1 with the usual
> 
>  	git format-patch master -o <path>
> 
> command line using
> 
>  	git version 2.4.9 (Apple Git-60)
> 
> and sent it as an email attachment using alpine as the client.

Strange indeed.  I re-downloaded the patch file from gmail (in case my
MUA had done something perverse) and checked it with emacs and even a
hex editor – it definitely has \r\n line endings.  Mysteries of life I
suppose.  :)

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-07 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  0:11 [PATCH][BUG] org-babel-confirm-evaluate Charles C. Berry
2015-11-07 10:48 ` Aaron Ecay
2015-11-07 18:13   ` Charles C. Berry
2015-11-07 21:36     ` Aaron Ecay

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).