]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust previous jsonrpc change
authorJoão Távora <joaotavora@gmail.com>
Tue, 3 Jul 2018 07:21:42 +0000 (08:21 +0100)
committerJoão Távora <joaotavora@gmail.com>
Tue, 3 Jul 2018 07:21:56 +0000 (08:21 +0100)
(nth 2) is probably a better alternative to caddr, and in Emacs 26.1
we can pass 0 as :service to automatically find an available port.

* lisp/jsonrpc.el (jsonrpc--call-deferred): Use cl-caddr.

* test/lisp/jsonrpc-tests.el
(jsonrpc--call-with-emacsrpc-fixture): Pass 0 as :service to when
making the listen server.

lisp/jsonrpc.el
test/lisp/jsonrpc-tests.el

index add2285bbe460d31ef2717c910db52623f516273..b2ccea5c143d7fc6484ff8e3917d09a3e9b89fd8 100644 (file)
@@ -5,11 +5,11 @@
 ;; Author: João Távora <joaotavora@gmail.com>
 ;; Maintainer: João Távora <joaotavora@gmail.com>
 ;; Keywords: processes, languages, extensions
-;; Package-Requires: ((emacs "25.1"))
+;; Package-Requires: ((emacs "25.2"))
 ;; Version: 1.0.0
 
 ;; This is an Elpa :core package.  Don't use functionality that is not
-;; compatible with Emacs 25.1.
+;; compatible with Emacs 25.2.
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -437,8 +437,7 @@ connection object, called when the process dies .")
   "Call CONNECTION's deferred actions, who may again defer themselves."
   (when-let ((actions (hash-table-values (jsonrpc--deferred-actions connection))))
     (jsonrpc--debug connection `(:maybe-run-deferred
-                                 ,(mapcar (lambda (action) (car (cdr (cdr action))))
-                                          actions)))
+                                 ,(mapcar (apply-partially #'nth 2) actions)))
     (mapc #'funcall (mapcar #'car actions))))
 
 (defun jsonrpc--process-sentinel (proc change)
index 16986eb46f6c2038e0933502fdddce23759c2d10..1a84c30e33dcab19757bc8eb24132fbf9229dd01 100644 (file)
           (setq listen-server
                 (make-network-process
                  :name "Emacs RPC server" :server t :host "localhost"
-                 :service 44444
+                 :service (if (version<= emacs-version "26.1")
+                              44444
+                            ;; 26.1 can automatically find ports if
+                            ;; one passes 0 here.
+                            0)
                  :log (lambda (listen-server client _message)
                         (push
                          (make-instance