milkypostman / powerline

emacs powerline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make rhs and lhs customizable

technician77 opened this issue · comments

Currently to achieve the powerline I like I use the default theme, delete the powerline-themes.elc and change corresponding .el the following way. Everytime any microupdate comes from melpa I need to do this over and over again. Is there any smarter way to solve this? I thought of making rhs and lhs a variable that can be customized so I wouldn't need to fiddle in the .el.

                          (lhs (list
                                     (powerline-raw "%*" face1 'l)
                                     (when powerline-display-buffer-size
                                       (powerline-buffer-size face1 'l))
                                     (powerline-raw " " face1)
                                     (funcall separator-left face1 face2)
                                     (when powerline-display-mule-info
                                       (powerline-raw mode-line-mule-info face2 'l))
                                     (powerline-raw " " face2)
                                     (funcall separator-left face2 face0)
                                     (powerline-buffer-id `(mode-line-buffer-id ,face0))
                                     (when (and (boundp 'which-func-mode) which-func-mode)
                                       (powerline-raw which-func-format face0 'l))
                                     (powerline-raw " " face0)
                                     (funcall separator-left face0 face2)
                                     (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
                                       (powerline-raw erc-modified-channels-object face2 'l))
                                     (powerline-major-mode face2 'l)
                                     (powerline-raw " " face2)
                                     (funcall separator-left face2 face1)
                                     (powerline-process face1)
                                     (powerline-minor-modes face1 'l)
                                     (powerline-raw " " face1)
                                     (funcall separator-left face1 face2)
                                     (powerline-narrow face2 'l)
                                     (powerline-raw " " face2)
                                     (powerline-vc face2 'r)
                                     (funcall separator-left face2 face1)
                                     (when (bound-and-true-p nyan-mode)
                                       (powerline-raw (list (nyan-create)) face1 'l))
                                     (funcall separator-left face1 face2)
                                     ))
                          (rhs (list
                                     (powerline-raw global-mode-string face2 'r)
                                     (funcall separator-right face2 face1)
                                     (when (and (boundp 'evil-mode) evil-mode)
                                       (powerline-raw evil-mode-line-tag face1))
                                     (funcall separator-right face1 face0)
                                     (powerline-raw mode-line-misc-info face0 'r)
                                     (funcall separator-right mode-line face1)
                                     (unless window-system
                                       (powerline-raw (char-to-string #xe0a1) face1 'l))
                                     (powerline-raw "%4l" face1 'l)
                                     (powerline-raw ":" face1 'l)
                                     (powerline-raw "%3c" face1 'r)
                                     (funcall separator-right face1 face2)
                                     (powerline-raw " " face2)
                                     (powerline-raw "%6p" face2 'r)
                                     (when powerline-display-hud
                                       (powerline-hud face0 face1))
                                     )))

are you concerned you may miss something that gets added to the default powerline?

my intention was actually that people would write their own functions to define the theme they wanted and just call that from their init file. so start with something like powerline-default-theme and then make a custom function ininit.el.

would that work?

First, I'm not a programmer. My knowledge of coding sums up to more or less zero. Now things get funny, when someone like me talks about coding, but I'm ready to play the fool in order to learn something. Your tip was gold, that works so far, so I don't have to redo the process above anymore unless something substancially changes. And yes, I think with your question you pointed in the right direction of my intention I was not aware of conciously.

If I'm correct the first things you learn in programming is the separation of data an program code. Isn't that right? So when I look at rhs and lhs I would define this as data. It is a list of values that define how the modeline should look like. If a theme is a function isn't this data mixed with program code? So if you change something incompatible in the coding I would have to adapt my old function to the new coding. But as a user I don't wan't to do this. I just want to define the data-values, the program should take care of how it is applied.

As said, above paragraph might not be technically correct here an there, but I hope I could get my point across anyway.

lisp is unique in that it kinda mixes data and process. in this case it's all the same because when you define your lhs and rhs those are still functions that are being called many times. anyways I think you got the gist of it!