Skip to content

Commit

Permalink
Don't require prelude.gdn to be open when navigating existing garden …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
Wilfred committed Oct 21, 2024
1 parent e136ff7 commit 8e491b7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions editors/garden-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,12 @@ the user entering a value in the *garden* buffer."
(find-file file-name)
;; For prelude and builtins, we don't have a fully qualified
;; path. Switch to the current prelude.gdn or builtins.gdn,
;; if open.
(let ((target-buf (--find (string= (buffer-name it) file-name) (buffer-list))))
(when target-buf
(switch-to-buffer target-buf)))))
;; relative to this elisp file.
(let* ((elisp-file-path (symbol-file 'garden-mode))
(elisp-dir (directory-file-name (file-name-directory elisp-file-path)))
(garden-src-root (file-name-directory elisp-dir))
(path (concat garden-src-root "src/" file-name)))
(find-file path))))

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

0 comments on commit 8e491b7

Please sign in to comment.