Skip to content

Commit d94c5cf

Browse files
committed
Fix cider-jump-to for tramp
Fix the opening of resources in jar files on tramp connections (broken by 7a63d2b).
1 parent 05c3090 commit d94c5cf

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

cider-interaction.el

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,29 @@ path or an entry within a zip/jar archive."
574574
(path (cider--file-path file))
575575
(name (format "%s:%s" path entry)))
576576
(or (get-file-buffer name)
577-
(with-current-buffer (generate-new-buffer
578-
(file-name-nondirectory entry))
579-
(archive-zip-extract path entry)
580-
(set-visited-file-name name)
581-
(setq-local default-directory (file-name-directory path))
582-
(setq-local buffer-read-only t)
583-
(set-buffer-modified-p nil)
584-
(set-auto-mode)
585-
(current-buffer)))))))
577+
(if (tramp-tramp-file-p path)
578+
(progn
579+
;; Use emacs built in archiving
580+
(find-file path)
581+
(goto-char (point-min))
582+
;; Make sure the file path is followed by a newline to
583+
;; prevent eg. clj matching cljs.
584+
(search-forward (concat entry "\n"))
585+
;; moves up to matching line
586+
(forward-line -1)
587+
(let ((opened-buffer (current-buffer)))
588+
(archive-extract)
589+
(current-buffer)))
590+
;; Use external zip program to just extract the single file
591+
(with-current-buffer (generate-new-buffer
592+
(file-name-nondirectory entry))
593+
(archive-zip-extract path entry)
594+
(set-visited-file-name name)
595+
(setq-local default-directory (file-name-directory path))
596+
(setq-local buffer-read-only t)
597+
(set-buffer-modified-p nil)
598+
(set-auto-mode)
599+
(current-buffer))))))))
586600

587601
(defun cider-find-var (var)
588602
"Return a buffer visiting the definition for VAR, or nil if not found."

0 commit comments

Comments
 (0)