dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
554 stars 51 forks source link

A little thing about compilation result in mode-line #80

Closed hidsh closed 6 years ago

hidsh commented 6 years ago

M-x compile opens *compilation* buffer and represents gcc's compilation result in its modeline.

compilation-result

The indication is composed of numbers of [ error warning info ]. However, their background colors is not telephone-line-accent-active and -inactive's one. It seems that their colors are used faces mode-line-active and -inactive respectively.

So I tried to fix as below.

(dolist (f '(compilation-info compilation-warning compilation-error))
  (set-face-background f (face-attribute 'telephone-line-accent-active :background)))

But this workaround is static, not change regardless of whitch *compilation* buffer is active or inactive. Does anybody know better solution?

dbordak commented 6 years ago

I might have a workaround, but I probably can't address this for a bit. I'll get back to this on Monday.

hidsh commented 6 years ago

Thank you dbordak, Please let me know if you get anything about it.

dbordak commented 6 years ago

I just checked up on my possible solution, but it doesn't look like that one's going to work.

Here's one thing you could do: Move this subsegment out into the nil supersegment, so that it's appropriately colored. I'm considering moving the entire process segment out in that way since that's very often used for colored text -- it's far more likely than anything else, I think.

Would that be a good solution for you?

hidsh commented 6 years ago

Thank you for your suggestion. But I don't make sense that what I should do specifically, because I don't familiar with telephone-line.

I would appreciate it if you could put some code snippet.

My current setting is below.

  (defface telephone-line-accent2-active
    '((t (:background "#5e5e5e" :inherit telephone-line-accent-active))) "")

  (defface telephone-line-accent2-inactive
    '((t (:background "#3a3a3a" :inherit telephone-line-accent-inactive))) "")

  (add-to-list 'telephone-line-faces
               '(accent2 . (telephone-line-accent2-active . telephone-line-accent2-inactive)))

  (setq telephone-line-lhs
        '((evil   . (telephone-line-evil-tag-segment))
          (accent . (telephone-line-vc-segment
                     telephone-line-process-segment))
          (accent2 . (telephone-line-buffer-info-segment))
          (nil    . (telephone-line-buffer-segment))))
  (setq telephone-line-rhs
        '((nil    . (telephone-line-misc-info-segment))
          (accent2 . (telephone-line-minor-mode-segment))
          (accent . (telephone-line-major-mode-segment))
          (evil   . (telephone-line-position-segment))))

  (telephone-line-defsegment* telephone-line-buffer-info-segment ()
    `(""
      mode-line-mule-info
      mode-line-modified
      ;; mode-line-client
      ;; mode-line-remote
      ;; mode-line-frame-identification
      ;; ,(telephone-line-raw mode-line-buffer-identification t)
      ))

  (telephone-line-defsegment* telephone-line-buffer-segment ()
    `(; mode-line-mule-info
      ;; mode-line-modified
      ;; mode-line-client
      ;; mode-line-remote
      mode-line-frame-identification
      ,(telephone-line-raw mode-line-buffer-identification t)))

  (setq telephone-line-primary-left-separator 'telephone-line-identity-left
        telephone-line-secondary-left-separator 'telephone-line-identity-hollow-left
        telephone-line-primary-right-separator 'telephone-line-identity-left
        telephone-line-secondary-right-separator 'telephone-line-identity-hollow-left)

  (setq telephone-line-height 16
        telephone-line-evil-use-short-tag nil)

  (telephone-line-defsegment* telephone-line-position-segment ()
    (telephone-line-raw-mod
     (if (eq major-mode 'paradox-menu-mode)
         ;;Paradox fills this with position info.
         mode-line-front-space
       mode-line-position) t))
dbordak commented 6 years ago

Here are two solutions:

One is to move the segment out into the nil supersegment, so that the colors wouldn't look out of place

  (setq telephone-line-lhs
        '((evil   . (telephone-line-evil-tag-segment))
          (accent . (telephone-line-vc-segment))
          (accent2 . (telephone-line-buffer-info-segment))
          (nil    . (telephone-line-buffer-segment
                     telephone-line-process-segment))))

(or put it right before telephone-line-buffer-segment if you want it to the left)

The other is to redefine the process segment so that it forces the entire thing to be compiled and repropertized. This will, however, lose the mouseover text.

(telephone-line-defsegment* telephone-line-process-segment ()
  (telephone-line-raw mode-line-process t))
hidsh commented 6 years ago

Your both solutions have work for me. I'll use the first one since it is easy to read the error info near buffer-name.

fixed

Thanks!