emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix obsolete sleep-for usage
@ 2023-10-21 10:16 gerard.vermeulen
  2023-10-21 13:10 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: gerard.vermeulen @ 2023-10-21 10:16 UTC (permalink / raw)
  To: Emacs orgmode, Ihor Radchenko

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

Hi,

Emacs-30 obsoletes the second integer  'millisec' argument of 
'sleep-for'
and tells to use a float argument.  This patch fixes the obsolete usage.

Regards -- Gerard

[-- Attachment #2: 0001-Fix-obsolete-sleep-for-usage.patch --]
[-- Type: application/octet-stream, Size: 7191 bytes --]

From 5dcf80b908b1af0217f3ef12ec6a8ada3829d3b2 Mon Sep 17 00:00:00 2001
From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
Date: Sat, 21 Oct 2023 11:50:22 +0200
Subject: [PATCH] Fix obsolete sleep-for usage

* lisp/ob-lua.el, lisp/ob-python.el, testing/lisp/test-ob-R.el,
testing/lisp/test-ob-julia.el, testing/lisp/test-ob-python.el: Replace
deprecated two integer argument sleep-for calls with one float
sleep-for calls.
---
 lisp/ob-lua.el                 |  2 +-
 lisp/ob-python.el              |  4 ++--
 testing/lisp/test-ob-R.el      | 16 ++++++++--------
 testing/lisp/test-ob-julia.el  |  6 +++---
 testing/lisp/test-ob-python.el |  6 +++---
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el
index dd02d6aee..64d15f75c 100644
--- a/lisp/ob-lua.el
+++ b/lisp/ob-lua.el
@@ -335,7 +335,7 @@ PREAMBLE string is appended to BODY."
 If RESULT-TYPE equals `output' then return standard output as a
 string.  If RESULT-TYPE equals `value' then return the value of the
 last statement in BODY, as elisp."
-  (let* ((send-wait (lambda () (comint-send-input nil t) (sleep-for 0 5)))
+  (let* ((send-wait (lambda () (comint-send-input nil t) (sleep-for 0.005)))
 	 (dump-last-value
 	  (lambda
 	    (tmp-file pp)
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index d6bc10eee..6c568a36d 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -280,7 +280,7 @@ then create.  Return the initialized session."
       ;; multiple prompts during initialization.
       (with-current-buffer py-buffer
         (while (not org-babel-python--initialized)
-          (sleep-for 0 10)))
+          (sleep-for 0.010)))
       (setq org-babel-python-buffers
 	    (cons (cons session py-buffer)
 		  (assq-delete-all session org-babel-python-buffers)))
@@ -435,7 +435,7 @@ with open('%s') as f:
 		      (body (org-babel-python-format-session-value
 			     tmp-src-file results-file result-params)))
 		 (org-babel-python-send-string session body)
-		 (sleep-for 0 10)
+		 (sleep-for 0.010)
 		 (org-babel-eval-read-file results-file)))))))
     (org-babel-result-cond result-params
       results
diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index 192c9f33b..9ffbf3afd 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -174,7 +174,7 @@ log10(10)
 	       (and (not (string= expected (org-babel-execute-src-block)))
 		    (string= expected
 			     (progn
-			       (sleep-for 0 200)
+			       (sleep-for 0.200)
 			       (goto-char (org-babel-where-is-src-block-result))
 			       (org-babel-read-result)))))))))
 
@@ -191,7 +191,7 @@ log10(10)
 	       (and (not (string= expected (org-babel-execute-src-block)))
 		    (string= expected
 			     (progn
-			       (sleep-for 0 200)
+			       (sleep-for 0.200)
 			       (goto-char (org-babel-where-is-src-block-result))
 			       (org-babel-read-result)))))))))
 
@@ -208,7 +208,7 @@ log10(10)
     (org-test-with-temp-text
      (concat src-block results-before)
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block results-after)
                              (buffer-string)))))))
 
@@ -223,7 +223,7 @@ log10(10)
     (org-test-with-temp-text
      (concat src-block results-before)
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block results-after)
                              (buffer-string)))))))
 
@@ -239,7 +239,7 @@ log10(10)
     (org-test-with-temp-text
      src-block
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block result)
                              (buffer-string)))))))
 
@@ -253,7 +253,7 @@ log10(10)
     (org-test-with-temp-text
      src-block
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block result)
                              (buffer-string)))))))
 
@@ -268,7 +268,7 @@ log10(10)
     (org-test-with-temp-text
      src-block
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block result)
                              (buffer-string)))))))
 
@@ -312,7 +312,7 @@ x
   (org-babel-next-src-block)
   (should (progn  
             (org-babel-execute-src-block)
-            (sleep-for 0 200)
+            (sleep-for 0.200)
             (string= (concat text result)
                      (buffer-string)))))))
 
diff --git a/testing/lisp/test-ob-julia.el b/testing/lisp/test-ob-julia.el
index e2ec922a2..f5666a93a 100644
--- a/testing/lisp/test-ob-julia.el
+++ b/testing/lisp/test-ob-julia.el
@@ -224,7 +224,7 @@ print('Yep!')
 	       (and (not (string= expected (org-babel-execute-src-block)))
 		    (string= expected
 			     (progn
-			       (sleep-for 0 200)
+			       (sleep-for 0.200)
 			       (goto-char (org-babel-where-is-src-block-result))
 			       (org-babel-read-result)))))))))
 
@@ -248,7 +248,7 @@ print(\"Yep!\")
     (org-test-with-temp-text
      (concat src-block results-before)
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block results-after)
                              (buffer-string)))))))
 
@@ -268,7 +268,7 @@ print(list(range(3)))
     (org-test-with-temp-text
      src-block
      (should (progn (org-babel-execute-src-block)
-                    (sleep-for 0 200)
+                    (sleep-for 0.200)
                     (string= (concat src-block result)
                              (buffer-string)))))))
 
diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
index c11e1d0c2..18861444e 100644
--- a/testing/lisp/test-ob-python.el
+++ b/testing/lisp/test-ob-python.el
@@ -242,7 +242,7 @@ print('Yep!')
 	        (and (not (string= expected (org-babel-execute-src-block)))
 		     (string= expected
 			      (progn
-			        (sleep-for 0 200)
+			        (sleep-for 0.200)
 			        (goto-char (org-babel-where-is-src-block-result))
 			        (org-babel-read-result)))))))))
 
@@ -269,7 +269,7 @@ print(\"Yep!\")
     (org-test-with-temp-text
         (concat src-block results-before)
       (should (progn (org-babel-execute-src-block)
-                     (sleep-for 0 200)
+                     (sleep-for 0.200)
                      (string= (concat src-block results-after)
                               (buffer-string)))))))
 
@@ -292,7 +292,7 @@ print(list(range(3)))
     (org-test-with-temp-text
         src-block
       (should (progn (org-babel-execute-src-block)
-                     (sleep-for 0 200)
+                     (sleep-for 0.200)
                      (string= (concat src-block result)
                               (buffer-string)))))))
 
-- 
2.42.0


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

end of thread, other threads:[~2023-10-21 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-21 10:16 [PATCH] Fix obsolete sleep-for usage gerard.vermeulen
2023-10-21 13:10 ` Ihor Radchenko

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