From: João Távora Date: Tue, 3 Jul 2018 07:21:42 +0000 (+0100) Subject: Adjust previous jsonrpc change X-Git-Tag: emacs-27.0.90~4725 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4ee502ca9db022ef85c736888ec6d6b471e0332a;p=emacs.git 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. --- 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 @@ ;; Author: João Távora ;; Maintainer: João Távora ;; 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) 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 @@ (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