Comments (15)
This might be possible, but it'd be pretty difficult. I've been considering it, but I was never really sure if there was much of a demand for this, besides the fact that it probably wouldn't work too well with an lhs+rhs.
Consider, any time any of the center-aligned segments changes length, they all move. With lhs/rhs, you sorta sort them in priority order -- only the buffer name and minor modes tend to change locations.
If you want it, though, I'll see if it'd be possible
from telephone-line.
Yeah, I really want to get this one. Even if centering doesn't stack well with lhs and rhs, an user can create only centered segments(if I understand your note about lhs+rhs correctly).
Consider, any time any of the center-aligned segments changes length, they all move.
Probably we need ability to create fixed-length segments in this case.
I don't know how much it will useful, but powerline for Emacs has ability to centering elements powerline-themes.el#L146
from telephone-line.
Ok, it's very rough, but I think I've got this working
It isn't documented yet, so here's how you can use it:
(setq telephone-line-center
'((segment pairs...)
center
(segment pairs...)))
You need to put a center
keyword in the middle (bare -- don't put it in a pair like everything else, this is no longer a proper alist) to mark where it switches from using right-separators to left-separators (left-right is reversed for appearance)
from telephone-line.
Things that don't work:
There's no concept of a center subseparator; there's nothing put where the 'center keyword shows up. You can see that in the example above between 0 and NO. I'm not going to add anything here, however; I think a space should be fine (otherwise, you can probably add your own graphic if you need -- it's not something I think I should automate anyway).
The center keyword doesn't necessarily end up in the center of the screen; the entire center supersegment will be centered, yes, but the left and right halves can be of any length; to center them, they'd need to be equal. I'm also not going to try to change this because forcing centering on the keyword would mean the supersegment isn't centered on unequal halves, which is just as bad.
EDIT: Basically, imagine you have length-4 stuff before the center keyword, and length-2 after it. I could handle it like this:
|..<****|**>..|
or like this:
|.<****|**>...|
In the former case, the entire <*|*>
is centered, though the middle bar is not, and in the latter it's the opposite. I went with the former.
from telephone-line.
Right, and to give you a full example, here's what I had to generate the center in that screenshot above:
(setq telephone-line-center
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-major-mode-segment))
(evil . (telephone-line-airline-position-segment))
center
(evil . (telephone-line-evil-tag-segment))
(accent . (telephone-line-vc-segment
telephone-line-erc-modified-channels-segment
telephone-line-process-segment))
(nil . (telephone-line-simple-minor-mode-segment
telephone-line-narrow-segment
telephone-line-simple-buffer-info-segment
telephone-line-simple-buffer-name-segment))))
from telephone-line.
I'm going to change the 'center keyword thing because it's a bit too magic. Either telephone-line-center will be a cons of the left and right halves of the center, or I'll split it into telephone-line-center-lhs and telephone-line-center-rhs. Opinion?
The latter would make it easier to customize in customize
, but the former would probably internally be a cleaner interface. I think the latter is more idiomatic though?
from telephone-line.
Awesome.
In the former case, the entire <|> is centered, though the middle bar is not, and in the latter it's the opposite. I went with the former.
Yes, the former is better for me too.
I'll split it into telephone-line-center-lhs and telephone-line-center-rhs. Opinion?
Imagine we have center-lhs and center-rhs, how to align only one segment in this case? If center-lhs and center-rhs will work with one segment, it's okay in my opinion. But as a user I want to put my segment in some variable and forget about them, i.e. I find their customization with two part of center segment a bit annoying. Not sure about customize
, because I'm not using that.
from telephone-line.
Doing one segment, regardless of which method I use, is going to be ugly no matter what. You'll need to mirror it with a nil segment of the same color on the other side (this includes what I have right now -- you'd need to put a nil segment before/after the 'center). I have to do this so that there's some way of inserting two types of separators -- any way of automating that would be extremely complicated and magic, I think.
from telephone-line.
Oh right, that said, if you're not using a separator, or if your single centered segment is using nil
for its color, then there's no need to mirror it.
from telephone-line.
I've decided on using telephone-line-center-(l/r)hs. I figure since it wasn't obvious to you that you (almost always) need both, it's better to make it more explicit that way. Doing a pair makes it somewhat more hidden.
from telephone-line.
I figure since it wasn't obvious to you that you (almost always) need both
I don't oppose using telephone-line-center-(l/r)hs, but it was a bit kinky at first glance. Now I can accept this. I mean no difference between just a single segment and segment with an extra segment for alignment in fact.
Though customization of segments is taking up a lot of time, so there's no point for me to be bothered about this split.
from telephone-line.
Well, the other thing is that keeping it this way means that customizing the center is as similar as possible to customizing the left and right. The first solution was an improper alist, which I don't like, and the other option was a pair of alists, which I think requires more explanation than the whole lhs/rhs thing.
Anyway, once the latest commit is up on MELPA, you should be good to go, I think.
from telephone-line.
Looks like it's up. Tell me when you try it out!
from telephone-line.
b3eaf4b works without any troubles for me. Thank you for your work! Also I'm glad that it works directly as telephone-line-lhs/rhs.
p.s. What's your Emacs font?
from telephone-line.
p.s. What's your Emacs font?
Iosevka, it's my favorite font https://be5invis.github.io/Iosevka/
from telephone-line.
Related Issues (20)
- Column number indicator one-based HOT 4
- Customize problems
- Support for changing font size HOT 5
- Feature request (and sample solution): Evil-like indicator for buffer modified state HOT 1
- Separator not rendering correctly when window is inactive. HOT 2
- Org-clock segment possible? HOT 1
- Rendering errors HOT 1
- Gap after airline segment HOT 3
- Optionally don't render segments if they are empty? HOT 1
- The mode line cannot display color
- hud segment rendering errors in terminal Emacs HOT 1
- Add support for project.el ? HOT 5
- Looking to apply airline-theme colors using telephone-line
- How can suppress the smiley face (`: )`) on the right corner?
- I'm too dumb: passing arguments to segments? HOT 3
- Some `mode-line` elements do not respect `telephone-line-accent-active`
- Error during redisplay: (eval (telephone-line-separator-render telephone-line-gradient
- Support for colors when using meow
- Right margin incorrect for proportional-width fonts
- Telephone line is slow to update HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telephone-line.