From d08d4fce6155316ea87488fe21c4b150f55b8c09 Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Sun, 12 Apr 2020 02:47:30 -0500 Subject: [PATCH] Rename internal functions for clarity The following changes are made: jupyter--run-handler-p -> jupyter--request-allows-handler-p jupyter--handler-dispatch -> jupyter--run-handler * jupyter-client.el: Do it. * test/jupyter-test.el: Do it. --- jupyter-client.el | 12 ++++++------ test/jupyter-test.el | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jupyter-client.el b/jupyter-client.el index 59796a4..ff4a408 100644 --- a/jupyter-client.el +++ b/jupyter-client.el @@ -784,7 +784,7 @@ received for it and it is not the most recently sent request." (jupyter-drop-request client req) (remhash (jupyter-request-id req) requests))))) -(defsubst jupyter--run-handler-p (req msg) +(defsubst jupyter--request-allows-handler-p (req msg) "Return non-nil if REQ doesn't inhibit the handler for MSG." (let* ((ihandlers (and req (jupyter-request-inhibited-handlers req))) (type (and (listp ihandlers) @@ -831,7 +831,7 @@ nil is returned otherwise." (:stdin . ,(handler-alist :input-reply :input-request))))) -(defun jupyter--handler-dispatch (client channel msg req) +(defun jupyter--run-handler (client channel msg req) (when (jupyter-handle-message-p client channel msg) (let* ((msg-type (jupyter-message-type msg)) (channel-handlers @@ -902,8 +902,8 @@ completed, requests from CLIENT's request table." (unwind-protect (jupyter--run-callbacks req msg) (unwind-protect - (when (jupyter--run-handler-p req msg) - (jupyter--handler-dispatch client channel msg req)) + (when (jupyter--request-allows-handler-p req msg) + (jupyter--run-handler client channel msg req)) (when (jupyter--message-completes-request-p msg) ;; Order matters here. We want to remove idle requests *before* ;; setting another request idle to account for idle messages @@ -915,8 +915,8 @@ completed, requests from CLIENT's request table." (when (and (or (jupyter-get client 'jupyter-include-other-output) ;; Always handle a startup message (jupyter-message-status-starting-p msg)) - (jupyter--run-handler-p req msg)) - (jupyter--handler-dispatch client channel msg req))))))) + (jupyter--request-allows-handler-p req msg)) + (jupyter--run-handler client channel msg req))))))) ;;; STDIN handlers diff --git a/test/jupyter-test.el b/test/jupyter-test.el index e739b0d..1474943 100644 --- a/test/jupyter-test.el +++ b/test/jupyter-test.el @@ -839,7 +839,7 @@ (req (jupyter-send-kernel-info-request client))) (should (equal (jupyter-request-inhibited-handlers req) '(:stream))) - (should-not (jupyter--run-handler-p + (should-not (jupyter--request-allows-handler-p req (jupyter-test-message req :stream (list :name "stdout" :text "foo")))) (setq jupyter-inhibit-handlers '(:foo))