[I’ve just added one more question which is highly related.]
I’m using julia-mode
and eglot-jl
on emacs
. On the left margin of the emacs window, you see green and amber exclamation marks. I guess amber means warning but how do you get the message associated with the warning?
What does the green exclamation mark mean? If there is an associated message, how do you see it? [ ← This is the additional question.]
I use emacs 28.2
from Homebrew on Mac and the following is my emacs settings, which I stole from the Internet and forgot who the author was. (Sorry! but you can google it to find the source(s).)
(use-package julia-repl
:ensure t
; :bind (:map julia-repl-mode-map
; ("C-c C-c" . julia-repl-send-buffer)
; ("C-c C-r" . julia-repl-send-region-or-line)
; )
:config
(add-hook 'julia-repl-mode-hook
(lambda ()
(local-set-key (kbd "C-c C-c") 'julia-repl-send-buffer)
(local-set-key (kbd "C-c C-r") 'julia-repl-send-region-or-line)
))
)
(use-package eglot-jl
:ensure t
)
(use-package julia-mode
:ensure t
:after (julia-repl eglot-jl)
:config
(set-language-environment "UTF-8")
(add-hook 'julia-mode-hook 'julia-repl-mode)
(add-hook 'julia-mode-hook 'eglot-jl-init)
(add-hook 'julia-mode-hook 'eglot-ensure)
;; this caused a timeout error with the default settings
(setq eglot-connect-timeout 300)
;; see Julia manual for the detailed description of this var
(setenv "JULIA_NUM_THREADS" "4")
(setq julia-indent-offset 2)
)
Some part of the expression in front of the exclamation mark should be highlighted with a wiggly underline (“foo” in the screenshot below). When point is on it, an explanation for the issue should be displayed in the minibuffer.
Another possibility is to hover over the problematic part of the expression, and an explanation should be displayed in a pop-up:
3 Likes
Thank you for your kind and detailed explanation with those helpful screenshots!!! You are of course right. It was stupid of me not having noticed that!
As I test it, I realize that the response time of the minibuffer message is a bit too slow for my natural reaction time so that I tend to move my text cursor away from the wiggly line before the message shows up. I’ll see what I can do with that, but that’s not essential now that I know the message is there!
I’ve added one more question to my original post. What does the green exclamation mark mean? I’m sure green means “fine” but I don’t know the difference between lines with green exclamation marks and those without.
I recommend skimming the “Using Flymake” info node (or view the html version here). Flymake is what eglot uses for these linting diagnostics. It’s only a few pages and can be skimmed in under five minutes.
But to directly answer your question: to find out what the symbols in the fringe mean, take a look at the values of the flymake-*-bitmap
variables. It might be more clear to just get a view of everything by invoking flymake-show-buffer-diagnostics
; this could also serve as an alternative to the minibuffer messages, so the display speed there won’t matter for your workflow.
3 Likes
Thank you for your help!
Do you mean that my “detective work” should start from here? I’m sure that reading this documentation will tell you where you should look at next. Going from one reference to another, you’ll eventually find out what the green exclamation mark is trying to tell you. I guess that’s why you point me to this documentation.
take a look at the values of the flymake-*-bitmap
variables
If I’m not mistaken, these variables only tell you what symbols are used at the fringe for the three types of diagnostics: error, warning & note. I don’t know how you find out the message associated with a green exclamation mark.
It might be more clear to just get a view of everything by invoking flymake-show-buffer-diagnostics
Great! This lists all the diagnostics in your julia buffer.
So, probably this is the only practical way to see the messages associated with diagnostics without wiggly lines.
What was puzzling me was that there are green exclamation marks whose line doesn’t include wiggly underlines. Thanks to the list, now I understand the green exclamation marks I’ve been seeing are “Variable has been assigned but not used”.
. . . But, that makes me wonder why the variable in question doesn’t get a wiggly line . . .
1 Like
I guess there was a misunderstanding on my part. I thought you were asking what the green exclamation point indicates in a general sense for emacs. You were actually trying to find out how to access the specific message associated with an instance of a green exclamation point. Which is fair enough.
This is a good question. If you look at the gif in the README of eglot-jl, you can see that it used to get a squiggle, but I can replicate your experience that it doesn’t currently. Digging in, I see that the variable in question doesn’t have a squiggle but is a little lighter compared to other variables. When you describe-char
over the variable you can see that it has the face eglot-diagnostic-unnecessary-face
which doesn’t get a squiggle but just shadow.
So since the gif was taken, either eglot changed so that the face it shows for the diagnostic class doesn’t have a squiggle, or LanguageServer.jl changed the class of the diagnostic. If you want a squiggle, you can just customize-face
on eglot-diagnostic-unnecessary-face
to e.g. match flymake-note
face.
1 Like
Digging in, I see that the variable in question doesn’t have a squiggle but is a little lighter compared to other variables.
Thank you for your investigation! Everything is now very clear.
I would say that a squiggle would be kinder to general users. If you didn’t tell me about the difference in faces, I would have never paid attention to the difference. I’m happy with the different face without a squiggle now, only because I know what it is, thanks to your message.