[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jarchive 149f37507e 31/33: Separate Eglot patching proc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jarchive 149f37507e 31/33: Separate Eglot patching process to be invoked manually by the user |
Date: |
Sat, 12 Nov 2022 17:57:58 -0500 (EST) |
branch: externals/jarchive
commit 149f37507e2e8c88dd66e3c821611414b615e317
Author: dannyfreeman <danny@dfreeman.email>
Commit: dannyfreeman <danny@dfreeman.email>
Separate Eglot patching process to be invoked manually by the user
package-lint gives warnings about using `with-eval-after-load' in
packages, that it belongs in user configurations. If that is the case
then having the user decided when to call the eglot patching process is
the best solution IMO.
Information is added to the readme to help explain.
---
CHANGELOG.md | 9 ++++++++-
README.md | 22 +++++++++++++++++++---
jarchive.el | 19 ++++++++++++++-----
3 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cb9ba24a3..c8e2cfe39b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Change Log
-## 2022-11-11 Release Notes
+
+## 2022-11-12 0.2.0 Release Notes
+- Documentation updates in preparation for submitting to elpa or melpa
+- BREAKING: Patching legacy Eglot no longer happens automatically when calling
`jarchive-setup`.
+ - Users can call `(with-eval-after-load 'eglot (jarchive-patch-eglot))` now
in their config instead.
+- `jarchive-patch-eglot` attempts to print warnings when it is called at the
wrong time.
+
+## 2022-11-11 0.1.0 Release Notes
- Now operates on full jar URIs and zipfile URIs
- For example `jar:file:///path/to/library.jar!/path/in/jar/source.ext`
diff --git a/README.md b/README.md
index 69ca122433..a5d789bf9d 100644
--- a/README.md
+++ b/README.md
@@ -35,16 +35,32 @@ It can also be done in a hook (recommended)
``` emacs-lisp
(add-hook 'eglot-managed-mode-hook #'jarchive-setup)
+;; OR something like
+(add-hook 'clojure-mode-hook #'jarchive-setup)
```
-
or interactively, via `M-x jarchive-setup`.
+## Working with Eglot
+
+Jarchive will open jar dependencies provided to Eglot by lsp servers.
+
+If you are using an older version of Eglot, like the melpa version released on
[2022-10-20](https://melpa.org/packages/eglot-20221020.1010.el "Eglot Melpa
Release 2022-10-20"), then you need to call `jarchive-patch-eglot` after Eglot
is loaded, like so
+
+``` emacs-lisp
+(with-eval-after-load 'eglot
+ (jarchive-patch-eglot))
+```
+
+This is _not_ required on newer versions of eglot. Installs that are up to
date with eglot on [ELPA devel](https://elpa.gnu.org/devel/eglot.html "Eglot
ELPA Devel Release") or eglot bundled with emacs 29 will work without patching.
+This patch function is included so those on older releases of eglot can also
take advantage of this package.
+Eventually it will be removed (with some advanced notice).
+
## Note about when to call `jarchive-setup`
-Some Emacs "distributions" like doom set the `file-name-handler-alist` var to
nil on startup, then restore it's value when startup is complete.
+Some Emacs distributions like [Doom](https://github.com/doomemacs/doomemacs)
(and many personal configurations), set the `file-name-handler-alist` var to
nil on startup, then restore it's value when startup is complete.
If this is the case for you, `jarchive-setup` should be called AFTER
everything is initialized.
-This package modifies `file-name-handler-alist`, so it relies on it not being
reset after `jarchive-setup` is invoked.
+This package modifies `file-name-handler-alist`, so it relies on it _not_
being reset after `jarchive-setup` is invoked.
# Usage
diff --git a/jarchive.el b/jarchive.el
index 4a042b1f98..621fd21638 100644
--- a/jarchive.el
+++ b/jarchive.el
@@ -158,16 +158,25 @@ handle it. If it is not a jar call ORIGINAL-FN."
(apply 'funcall original-fn args)
uri)))
+;;;###autoload
+(defun jarchive-patch-eglot ()
+ "Patch old versions of Eglot to work with Jarchive."
+ (interactive) ;; TODO, remove when eglot is updated in melpa
+ (cond
+ ((version<= "29" emacs-version)
+ (message "[jarchive] Eglot does not need to be patched. Skipping."))
+ ((or (not (fboundp 'eglot--path-to-uri))
+ (not (fboundp 'eglot--uri-to-path)))
+ (message "[jarchive] Eglot is not loaded, try calling
`jarchive-patch-eglot' after loading eglot."))
+ (t (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)
+ (message "[jarchive] Eglot successfully patched."))))
+
;;;###autoload
(defun jarchive-setup ()
"Setup jarchive, enabling Emacs to open files inside jar archives.
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 bb2467f8f9 10/33: Add warning to readme, (continued)
- [elpa] externals/jarchive bb2467f8f9 10/33: Add warning to readme, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 3a2b3096cd 11/33: Add autoload directive to jarchive-setup function, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 059efdf37c 16/33: Make eglot-extend-to-xref work, breaking support for `zipfile:` uris, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 9148ed7ada 18/33: WIP eglot setting to control jar URI parsing, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 81c4b345bf 20/33: Set dependency-scheme to "jar" on clojure-lsp initialization, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 214a7db52f 22/33: Update readme with better examples and explanations, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 305dbc947a 23/33: Don't for jar dependency scheme, just use whatever works., ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 8b738ec31b 26/33: Add changelog, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive abea8e79ec 28/33: Typo, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 0361896bdc 29/33: Address package-lint feedback, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 149f37507e 31/33: Separate Eglot patching process to be invoked manually by the user,
ELPA Syncer <=
- [elpa] externals/jarchive d209394a47 08/33: Set a different buffer name that doesn't match the jarchive-regex, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive b226bfd66c 09/33: Helper functions for matching parts of the jar/file path, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive ec1da7f538 14/33: Allow user to relocate extracted files to the previous project., ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive d8fa586e1c 21/33: Also work with "zipfile" scheme URIs from clojure-lsp, ELPA Syncer, 2022/11/12
- [elpa] externals/jarchive 72465b705a 30/33: Address checkdoc feedback, ELPA Syncer, 2022/11/12
- [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