From 9ba6ad331e42d177aadf119e1a0b3104ef9bf014 Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Mon, 8 Jan 2018 21:43:07 -0600 Subject: [PATCH] Remove uses of `lexical-let` --- jupyter-channels.el | 3 +-- jupyter-client.el | 3 +-- jupyter-repl-client.el | 47 ++++++++++++++++++++---------------------- jupyter-tests.el | 4 ++-- 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/jupyter-channels.el b/jupyter-channels.el index aa6fb23..cf53e68 100644 --- a/jupyter-channels.el +++ b/jupyter-channels.el @@ -245,8 +245,7 @@ connected." (oset channel timer (run-with-timer 0 (oref channel time-to-dead) - (lexical-let ((identity identity) - (sent nil)) + (let ((sent nil)) (lambda (channel) (let ((sock (oref channel socket))) (when sent diff --git a/jupyter-client.el b/jupyter-client.el index da0c1d9..9d07bfa 100644 --- a/jupyter-client.el +++ b/jupyter-client.el @@ -527,8 +527,7 @@ that if no TIMEOUT is given, `jupyter-default-timeout' is used." (declare (indent 1)) (setq timeout (or timeout jupyter-default-timeout)) (cl-check-type timeout number) - (lexical-let ((msg nil) - (cb cb)) + (let ((msg nil)) (jupyter-add-callback req msg-type (lambda (m) (setq msg (when (funcall cb m) m)))) (with-timeout (timeout nil) diff --git a/jupyter-repl-client.el b/jupyter-repl-client.el index 14b1517..159204b 100644 --- a/jupyter-repl-client.el +++ b/jupyter-repl-client.el @@ -841,31 +841,28 @@ kernel that the REPL buffer is connected to." (candidates (cons :async - (lexical-let ((arg arg)) - (lambda (cb) - (let ((client jupyter-repl-current-client)) - (with-jupyter-repl-buffer client - (jupyter-add-callback - (jupyter-complete-request - client - :code (jupyter-repl-cell-code) - ;; Consider the case when completing - ;; - ;; In [1]: foo| - ;; - ;; The cell code position will be at position 4, i.e. where - ;; the cursor is at, but the cell code will only be 3 - ;; characters long. - :pos (1- (jupyter-repl-cell-code-position))) - :complete-reply - (apply-partially - (lambda (cb msg) - (cl-destructuring-bind (&key status matches - &allow-other-keys) - (jupyter-message-content msg) - (if (equal status "ok") (funcall cb matches) - (funcall cb '())))) - cb)))))))) + (lambda (cb) + (let ((client jupyter-repl-current-client)) + (with-jupyter-repl-buffer client + (jupyter-add-callback + (jupyter-complete-request + client + :code (jupyter-repl-cell-code) + ;; Consider the case when completing + ;; + ;; In [1]: foo| + ;; + ;; The cell code position will be at position 4, i.e. where + ;; the cursor is at, but the cell code will only be 3 + ;; characters long. + :pos (1- (jupyter-repl-cell-code-position))) + :complete-reply + (lambda (msg) + (cl-destructuring-bind (&key status matches + &allow-other-keys) + (jupyter-message-content msg) + (if (equal status "ok") (funcall cb matches) + (funcall cb '())))))))))) (sorted t) (doc-buffer (let ((msg (jupyter-wait-until-received :inspect-reply diff --git a/jupyter-tests.el b/jupyter-tests.el index 544d004..f7fe63b 100644 --- a/jupyter-tests.el +++ b/jupyter-tests.el @@ -180,8 +180,8 @@ testing the callback functionality of a (setq ran-callbacks (nreverse ran-callbacks)) (should (equal ran-callbacks '(1 1 1 2 2 2))))) (ert-info ("Multiple callbacks for a single message type") - (lexical-let* ((ran-callbacks nil) - (req (jupyter-execute-request client :code "foo"))) + (let* ((ran-callbacks nil) + (req (jupyter-execute-request client :code "foo"))) (jupyter-add-callback req :execute-reply (lambda (_msg) (push 1 ran-callbacks))) (jupyter-add-callback req