dhall-mode
dhall-mode copied to clipboard
error buffer takes focus
First of all, thanks for writing this package! I seem to be having an issue where, while I'm typing, as long as the expression is invalid (which is almost always true while typing), the error buffer pops up and also takes focus away. I have to hit Esc to close the error buffer and get back to typing.
If it helps, I'm using Emacs 26 with EVIL mode.
Which error buffer? I assume you mean *dhall-buffer-type-errors*, but you might also mean an error buffer that results from calling dhall-format.
If you mean the former, I don't find that the focus switches. The buffer is displayed via shell-command-on-region calling display-buffer in the event of an error. The behaviour of display-buffer can be overridden using display-buffer-alist, and it seems likely that you have something else in your config which is changing that variable or otherwise hooking/advising shell-command-on-region.
@purcell thanks, yes it's the *dhall-buffer-type-errors* buffer. I took at look at the display-buffer-alist variable, but its value is huge (see below). I have not intentially changed it but perhaps something in doom-emacs or other packages have added a lot of stuff to it...any suggestions for how to troubleshoot this further (I'm unfortunately not well-versed in elisp)?
I have not seen any behavior like this from any other languages/modes. I wonder if it would make sense for dhall to use something like flycheck instead -- I'm guessing that could be a large effort, but thought I'd mention it anyway.
here's my display-buffer-alist value:
(("^CAPTURE.*\\.org$"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.2)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl . 5)
(quit)
(select . t)
(modeline)
(autosave . t)))
("^\\*Org Src"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.3)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl)
(quit)
(select . t)
(modeline)
(autosave . t)))
("^\\*Org Agenda"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*\\(?:Agenda Com\\|Calendar\\|Org \\(?:Export Dispatcher\\|Select\\)\\)"
(+popup-buffer)
(actions)
(side . bottom)
(size function +popup-shrink-to-fit)
(window-width . 40)
(window-height . 0.16)
(slot . -1)
(vslot . -1)
(window-parameters
(ttl . 0)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\*Org Links"
(+popup-buffer)
(actions)
(side . bottom)
(size . 2)
(window-width . 40)
(window-height . 0.16)
(slot . -1)
(vslot . -1)
(window-parameters
(ttl . 0)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" nil)
("^ \\*Treemacs"
(+popup-buffer)
(actions)
(side . left)
(size . 35)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl . 0)
(quit)
(select . ignore)
(modeline)
(autosave)))
("^\\*xref\\*$" nil)
("^\\*ivy-occur"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl . 0)
(quit)
(select . ignore)
(modeline)
(autosave)))
("^\\*Command Line"
(+popup-buffer)
(actions)
(side . bottom)
(size . 8)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl . 5)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\*evil-registers"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.3)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot)
(window-parameters
(ttl . 5)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\*Memory-Profiler-Report "
(+popup-buffer)
(actions)
(side . bottom)
(size)
(window-width . 0.5)
(window-height . 0.4)
(slot . 2)
(vslot . 100)
(window-parameters
(ttl . 5)
(quit)
(select . ignore)
(modeline)
(autosave)))
("^\\*CPU-Profiler-Report "
(+popup-buffer)
(actions)
(side . bottom)
(size)
(window-width . 0.5)
(window-height . 0.4)
(slot . 1)
(vslot . 100)
(window-parameters
(ttl . 5)
(quit)
(select . ignore)
(modeline)
(autosave)))
("^\\*Backtrace"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.4)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . 99)
(window-parameters
(ttl . 5)
(quit)
(select . ignore)
(modeline)
(autosave)))
("^\\*Warnings"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.25)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . 99)
(window-parameters
(ttl . 5)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\*info\\*$"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.45)
(window-width . 40)
(window-height . 0.16)
(slot . 2)
(vslot . 2)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*eww\\*"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -11)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*[Hh]elp"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.35)
(slot . 2)
(vslot . -2)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)
(transient . t)
(no-other-window . t)))
("^ \\*undo-tree\\*"
(+popup-buffer)
(actions)
(side . left)
(size . 20)
(window-width . 40)
(window-height . 0.16)
(slot . 2)
(vslot)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*Customize"
(+popup-buffer)
(actions)
(side . right)
(size)
(window-width . 40)
(window-height . 0.16)
(slot . 2)
(vslot)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*Calc"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.4)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -7)
(window-parameters
(ttl . 0)
(quit)
(select . t)
(modeline)
(autosave)))
("^\\*\\(?:Wo\\)?Man "
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.45)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -6)
(window-parameters
(ttl . 0)
(quit . t)
(select . t)
(modeline)
(autosave)))
("^\\*doom:\\(?:v?term\\|eshell\\)-popup"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -5)
(window-parameters
(ttl)
(quit)
(select . t)
(modeline . t)
(autosave)))
("^\\*doom:"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.35)
(window-width . 40)
(window-height . 0.35)
(slot)
(vslot . -4)
(window-parameters
(ttl . t)
(quit)
(select . t)
(modeline . t)
(autosave . t)
(transient . t)
(no-other-window . t)))
("^\\*\\(?:doom \\|Pp E\\)"
(+popup-buffer)
(actions)
(side . bottom)
(size . +popup-shrink-to-fit)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -3)
(window-parameters
(ttl . 0)
(quit . t)
(select . ignore)
(modeline)
(autosave . t)))
("^\\*\\(?:Compil\\(?:ation\\|e-Log\\)\\|Messages\\)"
(+popup-buffer)
(actions)
(side . bottom)
(size . 0.3)
(window-width . 40)
(window-height . 0.16)
(slot)
(vslot . -2)
(window-parameters
(ttl)
(quit . t)
(select . ignore)
(modeline)
(autosave . t)))
("^\\*Completions"
(+popup-buffer)
(actions)
(side . bottom)
(size)
(window-width . 40)
(window-height . 0.16)
(slot . -1)
(vslot . -2)
(window-parameters
(ttl . 0)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^ \\*"
(+popup-buffer)
(actions)
(side . bottom)
(size . +popup-shrink-to-fit)
(window-width . 40)
(window-height . 0.16)
(slot . 1)
(vslot . -1)
(window-parameters
(ttl . 5)
(quit . t)
(select . ignore)
(modeline)
(autosave)))
("^\\*"
(+popup-buffer)
(actions)
(side . bottom)
(size)
(window-width . 40)
(window-height . 0.16)
(slot . 1)
(vslot . -1)
(window-parameters
(ttl . 5)
(quit . t)
(select . t)
(modeline)
(autosave)
(transient . t)
(no-other-window . t))))
Yeah, I'd quite like to add flycheck support, in which case the type errors displayed when calculating the buffer's overall type could be suppressed.
In the meantime, we could make it so that the error buffer is never normally displayed, but only pops up when the header line is clicked. That would probably avoid your mysterious issue altogether.
Regarding debugging the settings above, I don't have any useful suggestions, really. Normal practice would be to comment out swathes of your config to home in on what causes the breakage.
(One of the issues with flycheck support has been that it can be slow to evaluate an entire file if it has unpinned remote expression references, but I don't think that need stop us from trying.)