Skip to content

alexmurray/flycheck-posframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flycheck-posframe

License GPL 3 MELPA Build Status

Display flycheck error messages via posframe.

flycheck-posframe screenshot

Installation

MELPA

The preferred way to install flycheck-posframe is via MELPA - then you can just M-x package-install RET flycheck-posframe RET

To enable then simply add the following to your init file:

(with-eval-after-load 'flycheck
  (require 'flycheck-posframe)
  (add-hook 'flycheck-mode-hook #'flycheck-posframe-mode))

We recommend to use use-package to make this automatic:

(use-package flycheck-posframe
  :ensure t
  :after flycheck
  :config (add-hook 'flycheck-mode-hook #'flycheck-posframe-mode))

Manual

If you would like to install the package manually, download or clone it and place within Emacs' load-path, then you can require it in your init file like this:

(require 'flycheck-posframe)
(add-hook 'flycheck-mode-hook #'flycheck-posframe-mode)

NOTE: This will also require the manual installation of flycheck if you have not done so already.

Configuration

Default Pretty Configuration

Calling (flycheck-posframe-configure-pretty-defaults) will configure flycheck-posframe to show warnings and errors with nicer faces (inheriting from warning and error respectively), and set the prefix for each to nicer unicode characters.

Manual Configuration

There are a few settings which can be configured to customise the display of error messages. These include the faces which are used to show the error messages flycheck-posframe-info-face, flycheck-posframe-warning-face and flycheck-posframe-error-face and a string which is used as the prefix for each message flycheck-posframe-info-prefix``flycheck-posframe-warning-prefix and flycheck-posframe-error-prefix. The background colour can be specified as the background attribute of the flycheck-posframe-background-face face. The position, as well as the border width and colour can also be customised via the flycheck-posframe-position, flycheck-posframe-border-widthandflycheck-posframe-border-color` variables respectively.

flycheck-posframe-LEVEL-face

By default each of flycheck-posframe-LEVEL-face inherits from the default face so should appear like the rest of the text in the buffer. If however you want to ensure error messages stand-out you could configure them to inherit from the error face:

(set-face-attribute 'flycheck-posframe-error-face nil :inherit 'error)

flycheck-posframe-LEVEL-prefix

By default flycheck-posframe-LEVEL-prefix is set to "➤ ". If however you wanted to show each warning message prefixed with the unicode WARNING SIGN symbol (U+26A0) "⚠ " you could configure it as follows:

(setq flycheck-posframe-warning-prefix "\u26a0 ")

flycheck-posframe-background-face

By default flycheck-posframe-background-face inherits from the default face, so the background colour should be the same as the standard window frame background colour. This can be customised like any other face (ie. by using customize-face or manually setting the :background face attribute)

flycheck-posframe-border-face

By default flycheck-posframe-border-face inherits from the default face, so the background colour should be the same as the standard foreground colour. This can be customised like any other face (ie. by using customize-face or manually setting the :foreground face attribute)

flycheck-posframe-border-use-error-face

By default flycheck-posframe-border-use-error-face is nil. When non-nil, it will override flycheck-posframe-border-face with the foreground of the face for the highest error level that is shown by posframe.

flycheck-posframe-border-width

By default flycheck-posframe-border-width is zero but this can be set to an integer number of pixels to specify the width of the border.

flycheck-posframe-position

By default flycheck-posframe-position is set to point-bottom-left-corner so that errors are shown just below point. This can be customised to any of the existing positions supported by posframe. For example, to display errors at the bottom-left of the window:

(setq flycheck-posframe-position 'window-bottom-left-corner)

License

Copyright © 2019 Alex Murray

Distributed under GNU GPL, version 3.