branch: externals/org
commit 14f176246f541a65f4a8499403a57af5aff492f8
Merge: 959534ba11 e4902995a0
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Merge branch 'bugfix'
---
 lisp/ob-C.el       |  2 +-
 lisp/ob-awk.el     |  2 +-
 lisp/ob-core.el    | 57 ++++++++++++++++++++++++++++--------------------------
 lisp/ob-ditaa.el   |  5 +++--
 lisp/ob-gnuplot.el |  6 +++---
 lisp/ob-groovy.el  |  2 +-
 lisp/ob-maxima.el  |  4 ++--
 lisp/ob-screen.el  |  2 +-
 lisp/ob-sed.el     |  2 +-
 9 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index d13c65d260..f7735ee72b 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -482,7 +482,7 @@ int get_column_num (int nbcols, const char** header, const 
char* column)
 (defun org-babel-C-header-to-C (head type)
   "Convert an elisp list of header table into a C or D vector
 specifying a variable with the name of the table."
-  (message "%S" type)
+  (unless noninteractive (message "%S" type))
   (let ((table (car head))
         (headers (cdr head))
         (typename (pcase type
diff --git a/lisp/ob-awk.el b/lisp/ob-awk.el
index 9577a39ee6..d94da405f0 100644
--- a/lisp/ob-awk.el
+++ b/lisp/ob-awk.el
@@ -61,7 +61,7 @@
   "Execute a block of Awk code BODY with org-babel.
 PARAMS is a plist of src block parameters .
 This function is called by `org-babel-execute-src-block'."
-  (message "Executing Awk source code block")
+  (unless noninteractive (message "Executing Awk source code block"))
   (let* ((result-params (cdr (assq :result-params params)))
          (cmd-line (cdr (assq :cmd-line params)))
          (in-file (cdr (assq :in-file params)))
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2e0e86f70c..0b329266a5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -855,8 +855,9 @@ guess will be made."
            (forward-line)
            (skip-chars-forward " \t")
            (let ((result (org-babel-read-result)))
-             (message (format "Cached: %s"
-                               (replace-regexp-in-string "%" "%%" (format "%S" 
result))))
+              (unless noninteractive
+               (message (format "Cached: %s"
+                                 (replace-regexp-in-string "%" "%%" (format 
"%S" result)))))
              result)))
         ((org-babel-confirm-evaluate info)
          (let* ((lang (nth 0 info))
@@ -879,18 +880,19 @@ guess will be made."
                 result exec-start-time)
            (unless (fboundp cmd)
              (error "No org-babel-execute function for %s!" lang))
-           (message "Executing %s %s %s..."
-                    (capitalize lang)
-                     (pcase executor-type
-                       ('src-block "code block")
-                       ('inline-src-block "inline code block")
-                       ('babel-call "call")
-                       ('inline-babel-call "inline call")
-                       (e (symbol-name e)))
-                    (let ((name (nth 4 info)))
-                      (if name
-                           (format "(%s)" name)
-                         (format "at position %S" (nth 5 info)))))
+            (unless noninteractive
+             (message "Executing %s %s %s..."
+                      (capitalize lang)
+                       (pcase executor-type
+                         ('src-block "code block")
+                         ('inline-src-block "inline code block")
+                         ('babel-call "call")
+                         ('inline-babel-call "inline call")
+                         (e (symbol-name e)))
+                      (let ((name (nth 4 info)))
+                        (if name
+                             (format "(%s)" name)
+                           (format "at position %S" (nth 5 info))))))
            (setq exec-start-time (current-time)
                   result
                  (let ((r
@@ -2760,20 +2762,21 @@ INFO may provide the values of these header arguments 
(in the
                           ;; In this case `table-align' does the work
                           ;; for us.
                           (not (and (listp result)
-                                    (member "append" result-params))))
+                                  (member "append" result-params))))
                  (indent-rigidly beg end indent))
-                (let ((time-info
-                       ;; Only show the time when something other than
-                       ;; 0s will be shown, i.e. check if the time is at
-                       ;; least half of the displayed precision.
-                       (if (and exec-time (> (float-time exec-time) 0.05))
-                           (format " (took %.1fs)" (float-time exec-time))
-                         "")))
-                  (if (null result)
-                      (if (member "value" result-params)
-                          (message "Code block returned no value%s." time-info)
-                        (message "Code block produced no output%s." time-info))
-                    (message "Code block evaluation complete%s." time-info))))
+                (unless noninteractive
+                  (let ((time-info
+                         ;; Only show the time when something other than
+                         ;; 0s will be shown, i.e. check if the time is at
+                         ;; least half of the displayed precision.
+                         (if (and exec-time (> (float-time exec-time) 0.05))
+                             (format " (took %.1fs)" (float-time exec-time))
+                           "")))
+                    (if (null result)
+                        (if (member "value" result-params)
+                            (message "Code block returned no value%s." 
time-info)
+                          (message "Code block produced no output%s." 
time-info))
+                      (message "Code block evaluation complete%s." 
time-info)))))
            (when end (set-marker end nil))
            (when outside-scope (narrow-to-region visible-beg visible-end))
            (set-marker visible-beg nil)
diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index ba8e65394f..715d8ddf07 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -113,8 +113,9 @@ This function is called by `org-babel-execute-src-block'."
     (unless (file-exists-p org-ditaa-jar-path)
       (error "Could not find ditaa.jar at %s" org-ditaa-jar-path))
     (with-temp-file in-file (insert body))
-    (message cmd) (shell-command cmd)
-    (when pdf-cmd (message pdf-cmd) (shell-command pdf-cmd))
+    (unless noninteractive (message cmd))
+    (shell-command cmd)
+    (when pdf-cmd (unless noninteractive (message pdf-cmd)) (shell-command 
pdf-cmd))
     nil)) ;; signal that output has already been written to file
 
 (defun org-babel-prep-session:ditaa (_session _params)
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index dc5cd0e521..956763c587 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -210,7 +210,7 @@ This function is called by `org-babel-execute-src-block'."
           (let ((script-file (org-babel-temp-file "gnuplot-script-")))
             (with-temp-file script-file
               (insert (concat body "\n")))
-            (message "gnuplot \"%s\"" script-file)
+            (unless noninteractive (message "gnuplot \"%s\"" script-file))
             (setq output
                   (shell-command-to-string
                   (format
@@ -219,7 +219,7 @@ This function is called by `org-babel-execute-src-block'."
                     script-file
                     (if (member system-type '(cygwin windows-nt ms-dos))
                         t nil)))))
-            (message "%s" output))
+            (unless noninteractive (message "%s" output)))
         (with-temp-buffer
           (insert (concat body "\n"))
           (gnuplot-mode)
@@ -232,7 +232,7 @@ This function is called by `org-babel-execute-src-block'."
   "Prepare SESSION according to the header arguments in PARAMS."
   (let* ((session (org-babel-gnuplot-initiate-session session))
          (var-lines (org-babel-variable-assignments:gnuplot params)))
-    (message "%S" session)
+    (unless noninteractive (message "%S" session))
     (org-babel-comint-in-buffer session
       (dolist (var-line  var-lines)
        (insert var-line)
diff --git a/lisp/ob-groovy.el b/lisp/ob-groovy.el
index 908df93372..d87ef4bb65 100644
--- a/lisp/ob-groovy.el
+++ b/lisp/ob-groovy.el
@@ -52,7 +52,7 @@ parameters may be used, like groovy -v"
 (defun org-babel-execute:groovy (body params)
   "Execute Groovy BODY according to PARAMS.
 This function is called by `org-babel-execute-src-block'."
-  (message "Executing Groovy source code block")
+  (unless noninteractive (message "Executing Groovy source code block"))
   (let* ((processed-params (org-babel-process-params params))
          (session (org-babel-groovy-initiate-session (nth 0 processed-params)))
          (result-params (nth 2 processed-params))
diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index ef875cfe8a..681154adfb 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -131,7 +131,7 @@ Return nil if LINE is zero-length or it matches a regexp in
 (defun org-babel-execute:maxima (body params)
   "Execute Maxima BODY according to PARAMS.
 This function is called by `org-babel-execute-src-block'."
-  (message "Executing Maxima source code block")
+  (unless noninteractive (message "Executing Maxima source code block"))
   (let ((result-params (split-string (or (cdr (assq :results params)) "")))
        (result
         (let* ((cmdline (or (cdr (assq :cmdline params)) ""))
@@ -151,7 +151,7 @@ This function is called by `org-babel-execute-src-block'."
                               (format "(linenum:0, %s(%S))$" batch/load 
in-file))
                              cmdline)))
           (with-temp-file in-file (insert (org-babel-maxima-expand body 
params)))
-          (message cmd)
+          (unless noninteractive (message cmd))
            ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
           (let ((raw (org-babel-eval cmd "")))
              (mapconcat
diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el
index ffb66d6596..a56afc7050 100644
--- a/lisp/ob-screen.el
+++ b/lisp/ob-screen.el
@@ -52,7 +52,7 @@ In case you want to use a different screen than one selected 
by your $PATH")
 (defun org-babel-execute:screen (body params)
   "Send BODY via screen to a terminal using Babel, according to PARAMS.
 \"default\" session is used when none is specified in the PARAMS."
-  (message "Sending source code block to interactive terminal session...")
+  (unless noninteractive (message "Sending source code block to interactive 
terminal session..."))
   (save-window-excursion
     (let* ((session (cdr (assq :session params)))
            (socket (org-babel-screen-session-socketname session)))
diff --git a/lisp/ob-sed.el b/lisp/ob-sed.el
index fa6a2bb199..83d9684ade 100644
--- a/lisp/ob-sed.el
+++ b/lisp/ob-sed.el
@@ -65,7 +65,7 @@
 BODY is the source inside a sed source block and PARAMS is an
 association list over the source block configurations.  This
 function is called by `org-babel-execute-src-block'."
-  (message "Executing sed source code block")
+  (unless noninteractive (message "Executing sed source code block"))
   (let* ((result-params (cdr (assq :result-params params)))
          (cmd-line (cdr (assq :cmd-line params)))
          (in-file (cdr (assq :in-file params)))

Reply via email to