[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/jarchive b226bfd66c 09/33: Helper functions for matchin
From: |
ELPA Syncer |
Subject: |
[elpa] externals/jarchive b226bfd66c 09/33: Helper functions for matching parts of the jar/file path |
Date: |
Sat, 12 Nov 2022 17:57:56 -0500 (EST) |
branch: externals/jarchive
commit b226bfd66c86319116ac353423aca7bf25b6817b
Author: dannyfreeman <danny@dfreeman.email>
Commit: dannyfreeman <danny@dfreeman.email>
Helper functions for matching parts of the jar/file path
---
jarchive.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/jarchive.el b/jarchive.el
index 09d35e16ef..66b1bca79e 100644
--- a/jarchive.el
+++ b/jarchive.el
@@ -21,7 +21,15 @@
"A regex for matching paths to a jar file and a file path into the jar file.
Delimited by `!' or `::'")
-(defvar-local jarchive--managed-buffer nil
+(defun jarchive--match-jar (hybrid-filename)
+ (string-match jarchive--hybrid-path-regex hybrid-filename)
+ (substring hybrid-filename (match-beginning 1) (match-end 1)))
+
+(defun jarchive--match-file (hybrid-filename)
+ (string-match jarchive--hybrid-path-regex hybrid-filename)
+ (substring hybrid-filename (match-beginning 2) (match-end 2)))
+
+(defvar-local jarchive--managed-buffer nil ;; consider making a minor mode
"This value is t when a buffer is managed by jarchive.")
(defmacro jarchive--inhibit (op &rest body)
@@ -39,13 +47,13 @@ provided when calling OP."
(cond
((eq op 'get-file-buffer)
(let* ((file (car args))
- (match (string-match jarchive--hybrid-path-regex file))
- (jar (substring file (match-beginning 1) (match-end 1)))
- (file-in-jar (substring file (match-beginning 2)))
+ (jar (jarchive--match-jar file))
+ (file-in-jar (jarchive--match-file file))
+ ;; Use a different filename that doesn't match
`jarchive--hybrid-path-regex'
+ ;; so that this handler will not deal with existing open buffers.
(buffer-file (concat jar ":" file-in-jar)))
(or (find-buffer-visiting buffer-file)
(with-current-buffer (create-file-buffer buffer-file)
- (message "jarchive: writing buffer %s " args)
(setq-local jarchive--managed-buffer t)
(archive-zip-extract jar file-in-jar)
(goto-char 0)
- [elpa] externals/jarchive 059efdf37c 16/33: Make eglot-extend-to-xref work, breaking support for `zipfile:` uris, (continued)
- [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, 2022/11/12
- [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 <=
- [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
- [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