Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation mode in REPL buffer #45

Open
martinbiel opened this issue Jan 14, 2021 · 7 comments
Open

Compilation mode in REPL buffer #45

martinbiel opened this issue Jan 14, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@martinbiel
Copy link

Could an option be added to enable the functionality implemented in #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 🙂

@gcv
Copy link
Owner

gcv commented Jan 14, 2021

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?

@gcv gcv added the enhancement New feature or request label Jan 14, 2021
@martinbiel
Copy link
Author

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 🙂

@gcv
Copy link
Owner

gcv commented Jan 14, 2021

Looks good, thanks!

@martinbiel
Copy link
Author

Of note, the original functionality in the error buffer appears like this:
image
while the same error link in the julia-snail-buffer (using the use-hook above) appears like this
image
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.

@gcv
Copy link
Owner

gcv commented Jul 29, 2021

@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.

@gcv
Copy link
Owner

gcv commented Jul 30, 2021

@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.

@prittjam
Copy link

prittjam commented Oct 7, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants