From: Eli Zaretskii Date: Sat, 20 Jan 2024 11:37:09 +0000 (-0500) Subject: ; Fix merge snafus X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f71712f59b0d9318d88830d1325e3fe9c937ce51;p=emacs.git ; Fix merge snafus * lisp/jsonrpc.el: * lisp/progmodes/eglot.el: Fix merge snafus. (cherry picked from commit 8bb5525b62163d7c3617a8b61da94f1a12a8d8e8) --- diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index 0ecde0a5425..1f8e1b1a876 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -689,6 +689,9 @@ With optional CLEANUP, kill any associated buffers." (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 diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5d3f7159161..c5cfdd3cedd 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1803,49 +1803,6 @@ If optional MARKER, return a marker instead" vec) "Like `url-path-allowed-chars' but more restrictive.") -(defun eglot--path-to-uri (path) - "URIfy PATH." - (let ((truepath (file-truename path))) - (if (and (url-type (url-generic-parse-url path)) - ;; It might be MS Windows path which includes a drive - ;; letter that looks like a URL scheme (bug#59338) - (not (and (eq system-type 'windows-nt) - (file-name-absolute-p truepath)))) - ;; Path is already a URI, so forward it to the LSP server - ;; untouched. The server should be able to handle it, since - ;; it provided this URI to clients in the first place. - path - (concat "file://" - ;; Add a leading "/" for local MS Windows-style paths. - (if (and (eq system-type 'windows-nt) - (not (file-remote-p truepath))) - "/") - (url-hexify-string - ;; Again watch out for trampy paths. - (directory-file-name (file-local-name truepath)) - eglot--uri-path-allowed-chars))))) - -(declare-function w32-long-file-name "w32proc.c" (fn)) -(defun eglot--uri-to-path (uri) - "Convert URI to file path, helped by `eglot--current-server'." - (when (keywordp uri) (setq uri (substring (symbol-name uri) 1))) - (let* ((server (eglot-current-server)) - (remote-prefix (and server (eglot--trampish-p server))) - (url (url-generic-parse-url uri))) - ;; Only parse file:// URIs, leave other URI untouched as - ;; `file-name-handler-alist' should know how to handle them - ;; (bug#58790). - (if (string= "file" (url-type url)) - (let* ((retval (url-unhex-string (url-filename url))) - ;; Remove the leading "/" for local MS Windows-style paths. - (normalized (if (and (not remote-prefix) - (eq system-type 'windows-nt) - (cl-plusp (length retval))) - (w32-long-file-name (substring retval 1)) - retval))) - (concat remote-prefix normalized)) - uri))) - (defun eglot--snippet-expansion-fn () "Compute a function to expand snippets. Doubles as an indicator of snippet support."