dbordak / telephone-line

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

Nyan mode - any chance? #41

Closed technician77 closed 6 years ago

technician77 commented 7 years ago

As the author of nyan mode writes it doesn't work with powerline, but he is open to suggestions to fix it. Do you see a chance to get it working in telephone-line?

dbordak commented 7 years ago

I've just added telephone-line-nyan-segment. This should work -- but only in nil segments. Basically, try putting it after the buffer identification segment in any of the basic examples, or at the beginning of the rhs.

Here's an example:

(setq telephone-line-lhs
      '((accent . (telephone-line-vc-segment
                   telephone-line-erc-modified-channels-segment
                   telephone-line-process-segment))
        (nil    . (telephone-line-minor-mode-segment
                   telephone-line-buffer-segment
                   telephone-line-nyan-segment))))

If you put it in an accent segment, it'll constantly trimmed down to 1 or... 3? characters, depending upon whether you're at the top or not. This is probably my fault for how I handle changing the background colors, but I'm not sure if there's anything I can do about it here...

Besides that, you probably don't want to put this segment in accent or anything -- this segment always consumes its max length, so putting it anywhere other than the middle will reveal this fact by spacing the separator way out in the middle of nowhere.

Also, props to the creator of nyan-mode for making this so easy (if you look at the segment definition, it's only 2 lines) -- a lot of mode-line modifications directly alter built-in mode-line variables, which makes them somewhat harder.

dbordak commented 7 years ago

Oh right, one other thing: you don't need to enable nyan-mode to use this segment, just require it. I'm not sure if avoiding that call improves performance (I haven't looked into what enabling the mode does exactly) but it might?

dbordak commented 7 years ago

Did you ever get a chance to try this out?

technician77 commented 7 years ago

Yes, seems to work now. Thanks!

image

Some comments. First as oposed to my first post, the author of nyan mode is wrong. It works in powerline, but as you wrote there is a spacing problem. Thanks for your expainations. Now (I think) I understand the reason for the background of the powerline spacing problem with nyan mode. See https://github.com/milkypostman/powerline/issues/133 A you can see in the ticket I worked around that by adding a a separator). Nyan mode in nil doesn't look good with my selected colours but I might fix this by swaping them. In my "production enviroment" I still use milkypostmans powerline but when I got everything working in telephone-line as I need I'll switch to it. The implementation seems to be a lot more userfriendly in customizing by using the segments you pre-defined.

Please keep up the good work!

technician77 commented 7 years ago

One more question: Is it possible to make the segment below a bit prettier, like in milkypostmans powerline? I have to admit that I haven't checked if powerline ommits information at that segment by making it prettier, though.

image

dbordak commented 7 years ago

Oh, the buffer info segment? Not as such -- that one is pulled directly from the built in mode-line. However, it's easy to add an alternate prettier segment. I might even add one to the package if I can find one that's sufficiently nice.

What sort of format are you looking for/what do you want it to look like?

technician77 commented 7 years ago

Below is how milkypostmans powerline displays the three states mentioned, but I don't know if there are states that the native modeline displays and powerline doesn't. You might need to check the code. I'm good with it though, (I think) I just need the three below. Can't you copy and paste the powerline code? (said by someone who has no idea about coding).

Unchanged: image

Changed: image

Read-only: image

dbordak commented 7 years ago

Oh, ok, it's only slightly abbreviated from the standard emacs mode-line. All this is displayed (in a slightly different order) before the buffer name, but with an additional character to show whether the file being edited is local or remote, as well using two characters to show file modification state (I don't know why it needs 2?).

I don't really like the way powerline does that there since the colon/backslash was clearly meant to be in the middle, but they put it off to the right end... hm

I guess if I was going to simplify it, I'd keep the mule-info (that is, "U:") followed by a single character for modification and display nothing for local files?

dbordak commented 7 years ago

Ok, so the reason for the built-in having two characters is because you can have modified read-only buffers. The first one shows % if read only; else if modified; else -, the second shows if modified; else % if read only; else -; so in the case of a modified read-only buffer you'd get "%*"

dbordak commented 6 years ago

Doing some cleanup here

Since the original issue was resolved, I'm going to close this. If you still want a simplified segment as you had described... however many months ago (sorry), please make a new issue.