branch: externals/websocket
commit b3a0153c0bc553892f8cf64a6dea9e8c54b70783
Author: Yuya Minami <yuya...@me.com>
Commit: Yuya Minami <yuya...@me.com>

    remove long line lambda
    
    it is easier to distinguish lambda dependency
---
 websocket.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/websocket.el b/websocket.el
index 01bbe6ea37..b7d62f45de 100644
--- a/websocket.el
+++ b/websocket.el
@@ -728,21 +728,24 @@ to the websocket protocol.
                             (websocket-outer-filter websocket output))))
     (set-process-sentinel
      conn
-     (lambda (process change)
-       (let ((websocket (process-get process :websocket)))
-         (websocket-debug websocket "State change to %s" change)
-         (let ((status (process-status process)))
-           (when (and nowait (eq status 'open))
-             (websocket-handshake url conn key protocols extensions 
custom-header-alist))
-
-           (when (and (member status '(closed failed exit signal))
-                      (not (eq 'closed (websocket-ready-state websocket))))
-             (websocket-try-callback 'websocket-on-close 'on-close 
websocket))))))
+     (websocket-sentinel url conn key protocols extensions custom-header-alist 
nowait))
     (set-process-query-on-exit-flag conn nil)
     (unless nowait
       (websocket-handshake url conn key protocols extensions 
custom-header-alist))
     websocket))
 
+(defun websocket-sentinel (url conn key protocols extensions 
custom-header-alist nowait)
+  #'(lambda (process change)
+      (let ((websocket (process-get process :websocket)))
+        (websocket-debug websocket "State change to %s" change)
+        (let ((status (process-status process)))
+          (when (and nowait (eq status 'open))
+            (websocket-handshake url conn key protocols extensions 
custom-header-alist))
+
+          (when (and (member status '(closed failed exit signal))
+                     (not (eq 'closed (websocket-ready-state websocket))))
+            (websocket-try-callback 'websocket-on-close 'on-close 
websocket))))))
+
 (defun websocket-handshake (url conn key protocols extensions 
custom-header-alist)
   (let ((url-struct (url-generic-parse-url url))
         (websocket (process-get conn :websocket)))

Reply via email to