julia-snail
julia-snail copied to clipboard
Compilation mode in REPL buffer
Could an option be added to enable the functionality implemented in https://github.com/gcv/julia-snail/pull/12 also to the snail REPL buffer? I like the ability to follow error links when testing my packages interactively.
I tried to just manually enable this in a hacky hook:
:hook ((julia-snail-repl-mode . (lambda()
(with-current-buffer julia-snail-repl-buffer
(setq-local compilation-error-regexp-alist-alist
julia-snail--compilation-regexp-alist)
(setq-local compilation-error-regexp-alist
(mapcar #'car compilation-error-regexp-alist-alist))
(compilation-shell-minor-mode 1)
(setq-local basedir (gethash julia-snail-repl-buffer julia-snail--cache-proc-basedir))
(setq-local compilation-search-path (list basedir))
(message basedir)
))))
which appeared to enable the feature I am asking for. Error links became clickable and correctly pointed to my package code. However, Emacs crashed at one point when clicking one of the error links, so this temporary solution is not the way to go :slightly_smiling_face:
Your approach seems fine overall, though it should be moved out of a use-package hook when we merge it into Snail. The crash must have come from vterm. Do you think you can reproduce it well enough to open a ticket there?
I modified the hook into
:hook ((julia-snail-repl-mode . (lambda()
(with-current-buffer julia-snail-repl-buffer
(setq-local compilation-error-regexp-alist-alist
julia-snail--compilation-regexp-alist)
(setq-local compilation-error-regexp-alist
(mapcar #'car compilation-error-regexp-alist-alist))
(compilation-shell-minor-mode 1)
(setq-local compilation-search-path (list (julia-snail--capture-basedir julia-snail-repl-buffer)))
))))
and it now works without crashing. I am not sure I retrieved the cached basedir correctly earlier, so that was probably the reason for the (SIGSEGV) crash. It should work without problems if implemented in Snail :slightly_smiling_face:
Looks good, thanks!
Of note, the original functionality in the error buffer appears like this:
while the same error link in the julia-snail-buffer (using the use-hook above) appears like this
In other words, it show the full path for some reason. Also, this particular error link is not clickable, which also seem to happen at times. I am not that confident in Elisp, so I cannot really suggest any reason for this discrepancy, or why the links are sometimes not clickable, but I thought it could be worthwhile to point out.
@martinbiel: Looking to merge this suggestion. I can't get clickable links in vterm buffers at all. Can you confirm that it worked intermittently for you? I'm wondering if vterm behavior with regard to allowing links changed between the time you opened this ticket and now.
@martinbiel: Take a look at this branch which essentially copies your hook: https://github.com/gcv/julia-snail/tree/compilation-mode-in-repl
It doesn't seem to make the REPL clickable for me.
This would be a very useful feature. Unfortunately, it doesn't seem to be able to find the path of the currently edited file for some reason.