[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jarchive 5736d46d33 24/33: Include hack to work with le
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jarchive 5736d46d33 24/33: Include hack to work with legacy versions of eglot. |
Date: |
Sat, 12 Nov 2022 17:57:57 -0500 (EST) |
branch: externals/jarchive
commit 5736d46d33945a92e74182947b5a04c582ac27fe
Author: dannyfreeman <danny@dfreeman.email>
Commit: dannyfreeman <danny@dfreeman.email>
Include hack to work with legacy versions of eglot.
When eglot is updated to match the Emacs master branch version of eglot,
this code can be removed.
---
jarchive.el | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/jarchive.el b/jarchive.el
index 2ee4377d6b..89590ebc20 100644
--- a/jarchive.el
+++ b/jarchive.el
@@ -7,6 +7,7 @@
(require 'arc-mode)
(require 'cl-macs)
(require 'seq)
+(require 'url-parse)
(defconst jarchive--uri-regex
(rx
@@ -106,6 +107,22 @@ TODO: this might be unnecessary, try to remove"
(and (string-match-p jarchive--uri-regex buffer-file-name)
t))
+(defun jarchive--wrap-legacy-eglot--path-to-uri (original-fn &rest args)
+ "Hack until eglot is updated.
+If path is a jar URI, don't parse. If it is not a jar call original impl."
+ (let ((path (file-truename (car args))))
+ (if (equal "jar" (url-type (url-generic-parse-url path)))
+ path
+ (apply 'funcall original-fn args))))
+
+(defun jarchive--wrap-legacy-eglot--uri-to-path (original-fn &rest args)
+ "Hack until eglot is updated.
+If URI is a jar URI, don't parse and let the `jarchive--file-name-handler'
handle it.
+If it is not a jar call original impl."
+ (let ((uri (car args)))
+ (if (string= "file" (url-type (url-generic-parse-url uri)))
+ (apply 'funcall original-fn args)
+ uri)))
;;;###autoload
(defun jarchive-setup ()
@@ -113,6 +130,10 @@ TODO: this might be unnecessary, try to remove"
the files can be identified with the `jar' uri scheme."
(interactive)
(with-eval-after-load 'eglot
+ (when (version< emacs-version "29") ;; TODO, remove when eglot is updated
in melpa
+ (advice-add 'eglot--path-to-uri :around
#'jarchive--wrap-legacy-eglot--path-to-uri)
+ (advice-add 'eglot--uri-to-path :around
#'jarchive--wrap-legacy-eglot--uri-to-path)))
+
(add-to-list 'file-name-handler-alist (cons jarchive--uri-regex
#'jarchive--file-name-handler))
(add-to-list 'find-file-not-found-functions #'jarchive--find-file-not-found))
- [elpa] externals/jarchive 4aa2e5d394 13/33: Add section to readme for mailing list, (continued)
- [elpa] externals/jarchive 4aa2e5d394 13/33: Add section to readme for mailing list, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive a4505a4784 32/33: Add FSF as copyright holder, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive b93da9f976 17/33: Do NOT implement file-attributes, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 3ff89ae9cb 05/33: Update doc string, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 0733e1fcb3 07/33: Use find-buffer-visiting instead of local var check, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive c9fdbe909d 19/33: Cleanup docstring, and ensure var is set after eglot loads, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 050436241e 27/33: Update README now that this includes hacks to fix legacy eglot, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 2c182b3cf9 06/33: Make setup function interactive for convenience, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 82ff9f791f 12/33: Remove unnecessary local variable, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive a5ab89db3f 15/33: Do not set default-directory, and manually set buffer-file-name, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 5736d46d33 24/33: Include hack to work with legacy versions of eglot.,
ELPA Syncer <=
- [elpa] externals/jarchive c8c12f1c9b 25/33: Update file preamble, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive bfcc201cca 33/33: Bump to version 0.1.0 was 0.3.0, ELPA Syncer, 2022/11/12