dbordak / telephone-line

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

Can't add segments #84

Open BowenWang opened 5 years ago

BowenWang commented 5 years ago

Hi, I am a new user to telephone line, I tried to add as many segments as possible in my configuration, but it seems that it doesn't work, here is my configuration

(require 'telephone-line)

(setq telephone-line-lhs
 '((red . (telephone-line-vc-segment
           telephone-line-process-segment
           telephone-line-position-segment
           telephone-line-misc-info-segment))
    (blue . (telephone-line-buffer-segment
             telephone-line-input-info-segment
             telephone-line-atom-eol-segment))
    (organge . (telephone-line-atom-encoding-segment
                telephone-line-filesize-segment
                telephone-line-simple-major-mode-segment))
    (green .  (telephone-line-simple-minor-mode-segment
               telephone-line-narrow-segment
               telephone-line-window-number-segment))
  ))
(telephone-line-mode t)

I only tried to add segments to the left side, here is the screenshot of the mode line: emacs

It seems that I didn't add anything, I didn't set the right side, it is just the Spacemacs default.

Any ideas?

dbordak commented 5 years ago

Hi,

I'm guessing you copied those from the rainbow example? Those colorsyms aren't defined in the package; you need to define them (and any faces along with them).

Also, you typo'd orange

(defface my-red '((t (:foreground "white" :background "red"))) "")
(defface my-orange '((t (:foreground "dim grey" :background "orange"))) "")
(defface my-green '((t (:foreground "dim grey" :background "green"))) "")
(defface my-blue '((t (:foreground "white" :background "blue"))) "")

(setq telephone-line-faces
      '((red . (my-red . my-red))
        (orange . (my-orange . my-orange))
        (green . (my-green . my-green))
        (blue . (my-blue . my-blue))
        (evil . telephone-line-evil-face)
        (accent . (telephone-line-accent-active . telephone-line-accent-inactive))
        (nil . (mode-line . mode-line-inactive))))
BowenWang commented 5 years ago

Ok, you are right, I have already fixed the problem.

I have another issue, is that possible to set the telephone-line so that the modelines in inactive buffers are different from the current active buffer so that I can quickly figure out which buffer I am looking into?

Thanks.

dbordak commented 5 years ago

Yes, you can use the :active and :inactive modifiers.

Basically, replace

a-segment

in your lhs/rhs with

(a-segment :active)

and now it'll only appear for an active window. Same for :inactive

So for example, if you only wanted line numbers on an active window, you'd do

(setq telephone-line-lhs
 '((red . (telephone-line-vc-segment
           telephone-line-process-segment
           (telephone-line-position-segment :active)
           telephone-line-misc-info-segment))
(...)
BowenWang commented 5 years ago

Ok, I tried the try to modify my configuration, but it seems it doesn't work: (setq telephone-line-lhs '((red . ((telephone-line-vc-segment :active))) (ored . ((telephone-line-process-segment :active))) (yellow . ((telephone-line-atom-encoding-segment :active))) (chartreuse . ((telephone-line-atom-eol-segment :active))) (green . ((telephone-line-filesize-segment :active :active))) (sgreen . ((telephone-line-major-mode-segment :active))) (cyan . ((telephone-line-minor-mode-segment :active))) (blue . ((telephone-line-narrow-segment :active))) (dmagenta . ((telephone-line-window-number-segment :active))) ))

Do you know how to fix this?

dbordak commented 5 years ago

I'd need to see the error you're getting (*Messages* and *Warnings* buffers).