emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/code-cells 016750ca70 4/5: Refactor code-cells--call-pr


From: ELPA Syncer
Subject: [elpa] externals/code-cells 016750ca70 4/5: Refactor code-cells--call-process
Date: Sun, 15 Oct 2023 09:57:39 -0400 (EDT)

branch: externals/code-cells
commit 016750ca70ba31b1f6d3e1db3b94bd1d3a3ee41b
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>

    Refactor code-cells--call-process
---
 code-cells.el | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/code-cells.el b/code-cells.el
index 0bc7d18816..8fce55593c 100644
--- a/code-cells.el
+++ b/code-cells.el
@@ -358,22 +358,21 @@ Returns the process exit code.  COMMAND is a list of 
strings, the
 program name followed by arguments."
   (unless (executable-find (car command))
     (error "Can't find %s" (car command)))
-  (let ((logfile (make-temp-file "emacs-cells-")))
-    (prog1
-        (apply #'call-process-region nil nil (car command) nil
-               (list buffer logfile) nil
-               (cdr command))
-      (with-temp-buffer
-        (insert-file-contents logfile)
-        (when (> (buffer-size) 0)
-          (display-warning 'code-cells (buffer-substring-no-properties
-                                        (point-min) (point-max))))
-        (delete-file logfile)))))
-
-;;;###autoload
-(defun code-cells-convert-ipynb ()
-  "Convert buffer from ipynb format to a regular script."
-  (interactive)
+  (let ((logfile (make-temp-file "emacs-code-cells-")))
+    (unwind-protect
+        (prog1
+            (apply #'call-process-region nil nil (car command) nil
+                   (list buffer logfile) nil
+                   (cdr command))
+          (with-temp-buffer
+            (insert-file-contents logfile)
+            (unless (zerop (buffer-size))
+              (lwarn 'code-cells :warning
+                     "Notebook conversion command %s said:\n%s"
+                     command
+                     (buffer-substring-no-properties
+                      (point-min) (point-max))))))
+      (delete-file logfile))))
   (goto-char (point-min))
   (let* ((nb (cl-letf ;; Skip over the possibly huge "cells" section
                  (((symbol-function 'json-read-array) 'forward-sexp))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]