Skip to content

Commit 8e491b7

Browse files
committed
Don't require prelude.gdn to be open when navigating existing garden files
1 parent e136ff7 commit 8e491b7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

editors/garden-mode.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,12 @@ the user entering a value in the *garden* buffer."
335335
(find-file file-name)
336336
;; For prelude and builtins, we don't have a fully qualified
337337
;; path. Switch to the current prelude.gdn or builtins.gdn,
338-
;; if open.
339-
(let ((target-buf (--find (string= (buffer-name it) file-name) (buffer-list))))
340-
(when target-buf
341-
(switch-to-buffer target-buf)))))
338+
;; relative to this elisp file.
339+
(let* ((elisp-file-path (symbol-file 'garden-mode))
340+
(elisp-dir (directory-file-name (file-name-directory elisp-file-path)))
341+
(garden-src-root (file-name-directory elisp-dir))
342+
(path (concat garden-src-root "src/" file-name)))
343+
(find-file path))))
342344

343345
(defun garden--visit (file-and-line-num)
344346
"Visit a position expressed in the format \"/path/foo.gdn:123\"."

0 commit comments

Comments
 (0)