Flycheck: I want to toggle flycheck errors window

Created on 1 Aug 2015  路  5Comments  路  Source: flycheck/flycheck

Hi, I'm very appreciated your project.

command flycheck-list-erros has not a toggle feature(delete flycheck errors window), so I want you to add command can toggling. It will be convenient for briefly check errors using flycheck errors window.

Like this:

(defun flycheck-list-errors-toggle ()
  "Toggle the error list for the current buffer."
  (interactive)
  (let ((flycheck-errors-window (get-buffer-window flycheck-error-list-buffer)))
    (if (not (window-live-p flycheck-errors-window))
        (call-interactively 'flycheck-list-errors)
      (delete-window flycheck-errors-window))))
wontfix

Most helpful comment

@Sarcasm , I had one naive but simple solution, of course you can bind this toggle function to other keys than f8.

(defun` toggle-flycheck-error-buffer ()
  "toggle a flycheck error buffer."
  (interactive)
  (if (string-match-p "Flycheck errors" (format "%s" (window-list)))
      (dolist (w (window-list))
        (when (string-match-p "*Flycheck errors*" (buffer-name (window-buffer w)))
          (delete-window w)
          ))
    (flycheck-list-errors)
    )
  )
(global-set-key (kbd "<f8>") 'toggle-flycheck-error-buffer)

All 5 comments

@mrlee23 Thanks for this idea. It's a cool feature, but I think it's better fit for your own configuration or an independent extension, the more since there are different approaches to implement this feature.

For instance, I have a display-buffer-alist entry for the error list which pins it to the bottom side window, combined with a custom command to close the side window. This works more like the typical error list dock windows in modern IDEs like Visual Studio or IntelliJ.

Closing as wontfix.

For instance, I have a display-buffer-alist entry for the error list which pins it to the bottom side window, combined with a custom command to close the side window. This works more like the typical error list dock windows in modern IDEs like Visual Studio or IntelliJ.

This sounds interesting, do you think you could share this code here for reference?

@Sarcasm I wrote about it on my blog a few months ago, at http://www.lunaryorn.com/2015/04/29/the-power-of-display-buffer-alist.html.

Alternatively take a look at my init file, and watch out for the display-buffer-alist setting and the lunaryorn-window package declaration.

Thanks ;)

@Sarcasm , I had one naive but simple solution, of course you can bind this toggle function to other keys than f8.

(defun` toggle-flycheck-error-buffer ()
  "toggle a flycheck error buffer."
  (interactive)
  (if (string-match-p "Flycheck errors" (format "%s" (window-list)))
      (dolist (w (window-list))
        (when (string-match-p "*Flycheck errors*" (buffer-name (window-buffer w)))
          (delete-window w)
          ))
    (flycheck-list-errors)
    )
  )
(global-set-key (kbd "<f8>") 'toggle-flycheck-error-buffer)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

choma picture choma  路  7Comments

manuel-uberti picture manuel-uberti  路  5Comments

jonathanj picture jonathanj  路  7Comments

DanPallas picture DanPallas  路  4Comments