emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: gerard.vermeulen@posteo.net
To: Emacs orgmode <emacs-orgmode@gnu.org>,
	Ihor Radchenko <yantar92@gmail.com>
Subject: [PATCH] Fix obsolete sleep-for usage
Date: Sat, 21 Oct 2023 10:16:30 +0000	[thread overview]
Message-ID: <0a85085d7cf890ad635dff280bc74589@posteo.net> (raw)

[-- 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


             reply	other threads:[~2023-10-21 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-21 10:16 gerard.vermeulen [this message]
2023-10-21 13:10 ` [PATCH] Fix obsolete sleep-for usage Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a85085d7cf890ad635dff280bc74589@posteo.net \
    --to=gerard.vermeulen@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).