TheBB / spaceline

Powerline theme from Spacemacs
GNU General Public License v3.0
536 stars 59 forks source link

Add customize option for always leaving flycheck status shown #52

Open cmarqu opened 8 years ago

cmarqu commented 8 years ago

I'm trying to minimize the amount of visual distractions going on in the modeline, so I'd like a way to always show the flycheck status even when there are no errors/warnings/infos to report. A customize option for that would be nice. FWIW, I (almost) managed to achieve that by the following hacks in spaceline-segments.el:

(defmacro spaceline--flycheck-lighter (state)
  "Return flycheck information for the given error type STATE."
  `(let* ((counts (flycheck-count-errors flycheck-current-errors))
          (errorp (flycheck-has-current-errors-p ',state))
          (err (or (cdr (assq ',state counts)) "?"))
          (running (eq 'running flycheck-last-status-change)))
;     (if (or errorp running) (format "•%s" err))
     (format "•%s" err)
     ))

(dolist (state '(error warning info))
  (let ((segment-name (intern (format "flycheck-%S" state)))
        (face (intern (format "spaceline-flycheck-%S" state))))
    (eval
     `(spaceline-define-segment ,segment-name
        ,(format "Information about flycheck %Ss. Requires `flycheck-mode' to be enabled" state)
        (let ((lighter (spaceline--flycheck-lighter ,state)))
          (when lighter (powerline-raw (s-trim lighter) ',face)))
;        :when (and (bound-and-true-p flycheck-mode)
;;                   (or flycheck-current-errors
;;                       (eq 'running flycheck-last-status-change))
;                   )
        ))))
user471 commented 8 years ago

:+1: I also commented this condition. It could show green when there is no errors.