0

When coding in not too wide buffer flycheck errors tally that should be visible in line-mode gets truncated. How do I guarantee that flycheck mode tally comes first in the order of major/minor modes in line-mode?

phils
  • 71,335
  • 11
  • 153
  • 198
SFbay007
  • 1,917
  • 1
  • 20
  • 39
  • Am i right in saying you want to rearrange the mode line or have I got it wrong? Can you give an example of what you have and how you want it to be? – Kind Stranger Jun 07 '17 at 19:35
  • Thanks for commenting. something like (eldoc flyc projectile) to become (flyc eldoc projectile). But I found that moving flycheck to the bottom of my init file causing it to appear first. So kind of a workaround for now. – SFbay007 Jun 07 '17 at 20:23

1 Answers1

3

The minor modes are displayed in the order of minor-mode-alist. By default this simply reflects the load order (hence the kind-of-workaround you noted, but noting that the workaround would fail once additional minor modes were loaded).

Manipulating the list after libraries are loaded lets you maintain a desired display order on an ongoing basis.

(defun my-promote-flycheck (&optional _file)
  "Give `flycheck-mode' priority position in `minor-mode-alist'.

Called via `after-load-functions', as well as `after-init-hook'."
  (unless (eq (caar minor-mode-alist) 'flycheck-mode)
    (let ((found (assq 'flycheck-mode minor-mode-alist)))
      (when found
        (assq-delete-all 'flycheck-mode minor-mode-alist)
        (push found minor-mode-alist)))))

(add-hook 'after-load-functions 'my-promote-flycheck)
(add-hook 'after-init-hook 'my-promote-flycheck)
phils
  • 71,335
  • 11
  • 153
  • 198