diff options
| author | João Távora | 2018-07-03 08:21:42 +0100 |
|---|---|---|
| committer | João Távora | 2018-07-03 08:21:56 +0100 |
| commit | 4ee502ca9db022ef85c736888ec6d6b471e0332a (patch) | |
| tree | 80b7a3f2b7e7d99745e5af9148218502d3824618 | |
| parent | 40db29fc5562d416a2af6c2a45b9f3f5e6a302db (diff) | |
| download | emacs-4ee502ca9db022ef85c736888ec6d6b471e0332a.tar.gz emacs-4ee502ca9db022ef85c736888ec6d6b471e0332a.zip | |
Adjust previous jsonrpc change
(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.
| -rw-r--r-- | lisp/jsonrpc.el | 7 | ||||
| -rw-r--r-- | test/lisp/jsonrpc-tests.el | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index add2285bbe4..b2ccea5c143 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el | |||
| @@ -5,11 +5,11 @@ | |||
| 5 | ;; Author: João Távora <joaotavora@gmail.com> | 5 | ;; Author: João Távora <joaotavora@gmail.com> |
| 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> | 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> |
| 7 | ;; Keywords: processes, languages, extensions | 7 | ;; Keywords: processes, languages, extensions |
| 8 | ;; Package-Requires: ((emacs "25.1")) | 8 | ;; Package-Requires: ((emacs "25.2")) |
| 9 | ;; Version: 1.0.0 | 9 | ;; Version: 1.0.0 |
| 10 | 10 | ||
| 11 | ;; This is an Elpa :core package. Don't use functionality that is not | 11 | ;; This is an Elpa :core package. Don't use functionality that is not |
| 12 | ;; compatible with Emacs 25.1. | 12 | ;; compatible with Emacs 25.2. |
| 13 | 13 | ||
| 14 | ;; This program is free software; you can redistribute it and/or modify | 14 | ;; This program is free software; you can redistribute it and/or modify |
| 15 | ;; it under the terms of the GNU General Public License as published by | 15 | ;; it under the terms of the GNU General Public License as published by |
| @@ -437,8 +437,7 @@ connection object, called when the process dies .") | |||
| 437 | "Call CONNECTION's deferred actions, who may again defer themselves." | 437 | "Call CONNECTION's deferred actions, who may again defer themselves." |
| 438 | (when-let ((actions (hash-table-values (jsonrpc--deferred-actions connection)))) | 438 | (when-let ((actions (hash-table-values (jsonrpc--deferred-actions connection)))) |
| 439 | (jsonrpc--debug connection `(:maybe-run-deferred | 439 | (jsonrpc--debug connection `(:maybe-run-deferred |
| 440 | ,(mapcar (lambda (action) (car (cdr (cdr action)))) | 440 | ,(mapcar (apply-partially #'nth 2) actions))) |
| 441 | actions))) | ||
| 442 | (mapc #'funcall (mapcar #'car actions)))) | 441 | (mapc #'funcall (mapcar #'car actions)))) |
| 443 | 442 | ||
| 444 | (defun jsonrpc--process-sentinel (proc change) | 443 | (defun jsonrpc--process-sentinel (proc change) |
diff --git a/test/lisp/jsonrpc-tests.el b/test/lisp/jsonrpc-tests.el index 16986eb46f6..1a84c30e33d 100644 --- a/test/lisp/jsonrpc-tests.el +++ b/test/lisp/jsonrpc-tests.el | |||
| @@ -48,7 +48,11 @@ | |||
| 48 | (setq listen-server | 48 | (setq listen-server |
| 49 | (make-network-process | 49 | (make-network-process |
| 50 | :name "Emacs RPC server" :server t :host "localhost" | 50 | :name "Emacs RPC server" :server t :host "localhost" |
| 51 | :service 44444 | 51 | :service (if (version<= emacs-version "26.1") |
| 52 | 44444 | ||
| 53 | ;; 26.1 can automatically find ports if | ||
| 54 | ;; one passes 0 here. | ||
| 55 | 0) | ||
| 52 | :log (lambda (listen-server client _message) | 56 | :log (lambda (listen-server client _message) |
| 53 | (push | 57 | (push |
| 54 | (make-instance | 58 | (make-instance |