From: Eli Zaretskii Date: Sat, 20 Jan 2024 11:25:59 +0000 (-0500) Subject: Merge from origin/emacs-29 X-Git-Tag: archive/raspbian/1%30.1+1-3+rpi1^2~2^2~20^2~2893 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1b31a784bfb56c3c5d138d906601428ebd3e737b;p=emacs.git Merge from origin/emacs-29 5bb5590dec9 Fix blunder in labeled_narrow_to_region 78ddb32fadb Fix documentation of icon-elements 725a3f32f8b ; Fix typos in symbol names 6653ee66ca5 Improve two docstrings in ox-latex 7d869a04029 Doc fix in auth-source-read-char-choice f149de223bf Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 1f97a878795 Fix info-xref-tests 51f391998b1 Add @kindex in manuals for existing keybindings on 'C-x x... --- 1b31a784bfb56c3c5d138d906601428ebd3e737b diff --cc lisp/jsonrpc.el index 7ff57daeb7d,f2060d3faa1..0ecde0a5425 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@@ -681,20 -540,35 +681,31 @@@ With optional CLEANUP, kill any associa (process-put proc 'jsonrpc-sentinel-cleanup-started t) (unwind-protect ;; Call all outstanding error handlers - (maphash (lambda (_id triplet) - (pcase-let ((`(,_success ,error ,_timeout) triplet)) - (funcall error '(:code -1 :message "Server died")))) - (jsonrpc--request-continuations connection)) + (mapc (jsonrpc-lambda (_id _method _success-fn error-fn _timer) + (funcall error-fn '(:code -1 :message "Server died"))) + (jsonrpc--continuations connection)) (jsonrpc--message "Server exited with status %s" (process-exit-status proc)) (delete-process proc) + (when-let (p (slot-value connection '-autoport-inferior)) (delete-process p)) (funcall (jsonrpc--on-shutdown connection) connection))))) -(defvar jsonrpc--in-process-filter nil - "Non-nil if inside `jsonrpc--process-filter'.") - (cl-defun jsonrpc--process-filter (proc string) "Called when new data STRING has arrived for PROC." + (when jsonrpc--in-process-filter + ;; Problematic recursive process filters may happen if + ;; `jsonrpc-connection-receive', called by us, eventually calls + ;; client code which calls `process-send-string' (which see) to, + ;; say send a follow-up message. If that happens to writes enough + ;; bytes for pending output to be received, we will lose JSONRPC + ;; messages. In that case, remove recursiveness by re-scheduling + ;; ourselves to run from within a timer as soon as possible + ;; (bug#60088) + (run-at-time 0 nil #'jsonrpc--process-filter proc string) + (cl-return-from jsonrpc--process-filter)) (when (buffer-live-p (process-buffer proc)) (with-current-buffer (process-buffer proc) - (let* ((jsonrpc--in-process-filter t) - (connection (process-get proc 'jsonrpc-connection)) - (expected-bytes (jsonrpc--expected-bytes connection))) + (let* ((conn (process-get proc 'jsonrpc-connection)) + (expected-bytes (jsonrpc--expected-bytes conn))) ;; Insert the text, advancing the process marker. ;; (save-excursion