emacselispmodeline

How to display compilation status in modified mode-line?


I modified my mode-line to appear cleaner. Sadly this prevents compilation buffers from displaying their exit status.

Normaly a failed compilation would display something like: (Compilation:exit [1])

Through my modifications the the compilation status "exit [1]" is lost.

I defined major and minor modes as following:

(setq my-modeline-major-mode
  ;; major modes
  (list
    '(:eval (propertize "%m" 'face 'font-lock-string-face
                       'help-echo buffer-file-coding-system))))

(setq my-modeline-minor-modes
  ;; list of minor modes
  (list
    minor-mode-alist))

The modeline itself is structured as followed:

(setq-default mode-line-format
          (list
           "  ["
           my-modeline-major-mode
           "]["
           my-modeline-minor-modes
           "]"
           " %-" ;; fill with '-'
           ))

M-x customize-group compilation didn't provide any help.


Solution

  • You need to include the value of mode-line-process in your custom mode line. This seems to work:

    (setq my-modeline-major-mode 
      ;; major modes
      (list
        '(:eval (propertize "%m" 'face 'font-lock-string-face
                           'help-echo buffer-file-coding-system))
        '("" mode-line-process)))