reddit / emacs

Flycheck buffers splitting up vertically since emacs 28 update

bananafingerz · 2022-07-20 17:50
back in v27, flycheck-error-list and flycheck-verify-setup used to appear in a small buffer on the bottom of the frame. They are now hijacking the sides of my frame which is annoying, since i cant event read the error. why is that? flycheck docs advises this, but it doesnt work: [https://www.flycheck.org/en/latest/user/error-list.html](https://www.flycheck.org/en/latest/user/error-list.html) (add-to-list 'display-buffer-alist `(,(rx bos "*Flycheck errors*" eos) (display-buffer-reuse-window display-buffer-in-side-window) (side . bottom) (reusable-frames . visible) (window-height . 0.33))) ​
PhantomSeahorse · 2022-07-20 18:38
Do you mean horizontally?
bananafingerz · 2022-07-20 19:42
they end up being two vertical buffers, side by side, and I want then to be two horizontal buffers one on top of another.
PhantomSeahorse · 2022-07-20 20:00
Yeah having two windows side of side is called splitting horizontally since you are increasing the number of windows along the x-axis
bananafingerz · 2022-07-20 23:16
right. do you know to force it to split vertically likr it used to happen in 27 ?
PhantomSeahorse · 2022-07-21 00:11
Interesting. I’m on emacs 28 and I don’t have this problem. Can you post some screenshot? You can also try putting emacs to full screen. Sometimes the frame size changes window behavior
Lucius_Martius · 2022-07-21 13:13
I have found that using a predicate function and checking for modes is a lot more reliable and flexible than pattern matching buffer names. Here's what I do for flycheck: (add-to-list 'display-buffer-alist '(my-window-bottom-left-side-window-p (display-buffer-in-side-window) (window-height . 0.30) (window-width . 0.55) (dedicated . t) (side . bottom) (slot . 0) (window-parameters . ((no-other-window . t) (no-delete-other-windows . t) (mode-line-format . 'none))))) (defvar my-window-bottom-left-modes '()) (defun my-window-bottom-left-side-window-p (buf act) (with-current-buffer buf (member major-mode my-window-bottom-left-modes))) ;; Then down in the flycheck configuration (add-to-list 'my-window-bottom-left-modes 'flycheck-error-list-mode) I have the bottom region split into two halves (thus `window-width` and `slot`), one for flycheck (actually now flymake, but it worked a couple weeks ago), search and other info windows on the left, one for shells on the right. But it should work for a single bottom side-window as well. The `dedicated . t` and `window-parameters` are not necessary, but help making the side windows not targetable by other functions and save some space by omitting the mode-line. Also note that display-buffer-alist working as expected often hinges on other calls to display-buffer not doing weird things either (which they tend to). I find it works best if you route any and all calls to display-buffer through display-buffer-alist by ending the list with a catch-all predicate and a custom `my-display-buffer-main-windows-only` function that only selects non-side-windows. Otherwise you will always have stray buffers popping up on top of or splitting your carefully arranged side-windows.
bananafingerz · 2022-07-21 14:18
[https://webmshare.com/ZovRG](https://webmshare.com/ZovRG) here you go
bananafingerz · 2022-07-21 14:22
woah thank you my dude. Is it true then, that flymake is doing better than flycheck rn?
Lucius_Martius · 2022-07-21 14:46
>Is it true then, that flymake is doing better than flycheck rn? To be honest, I slightly prefer flycheck, but eglot only works with flymake by default and I prefer eglot over lsp-mode. Also flymake has the benefit of being built-in, and since I don't use any of the additional checkers flycheck supports I don't really care enough to bother with getting flycheck to work with eglot.
bananafingerz · 2022-07-21 17:42
>(add-to-list 'display-buffer-alist'(my-window-bottom-left-side-window-p(display-buffer-in-side-window)(window-height . 0.30)(window-width . 0.55)(dedicated . t)(side . bottom)(slot . 0)(window-parameters . ((no-other-window . t)(no-delete-other-windows . t)(mode-line-format . 'none)))))(defvar my-window-bottom-left-modes '())(defun my-window-bottom-left-side-window-p (buf act)(with-current-buffer buf (member major-mode my-window-bottom-left-modes)));; Then down in the flycheck configuration(add-to-list 'my-window-bottom-left-modes 'flycheck-error-list-mode) it still opens to the side :( the other options are applied though (not targetable and no mode-line) can you give me directions to configure flymake? Does it work nicely with typescript and react? I\`m using spacemacs
Lucius_Martius · 2022-07-21 21:29
>it still opens to the side On vanilla emacs this is not really possible. [display-buffer-alist comes very high up in the priority](https://www.gnu.org/software/emacs/manual/html_node/elisp/Choosing-Window.html) and the `display-buffer-in-side-window` function does not leave much for interpretation if it is in fact called, which it must be, if the window-parameters are applied. Can you check using `describe-function` to see if any advices (i.e. modifications to the function) are listed at the bottom for `display-buffer-in-side-window`? Are you also sure that you don't enable some fancy window management thing, like golden-ratio.el, shackle or something? PS: Please also check that the variable `display-buffer-overriding-action` is nil. >can you give me directions to configure flymake? Does it work nicely with typescript and react? Sadly, I can't tell you much. You need to add your checker to `flymake-diagnostic-functions`. Both eglot and lsp-mode do this automatically when they are loaded (lsp-mode only as a fallback if flycheck is not installed). There is a [typescript language server](https://github.com/typescript-language-server/typescript-language-server) here you can use with either eglot or lsp-mode. Other than those general pointers you are on your own. I'm a C/C++ dev and use vanilla instead of spacemacs so I can't help you much on the specifics.