Git Product home page Git Product logo

Comments (11)

ogdenwebb avatar ogdenwebb commented on August 15, 2024 1
  • Foreground color?
  • Truncation -- limit segment to N characters. Could even replace use-short-tag.
  • Padding for x/y on position segment(s)

+1

Would be nice to have a feature to specify in telephone-line segment either list of ignored major mode or list of Emacs modes, which will display a segment.
For example, I have the modified-status segment, but I don't want to see the segment in some major modes such as Warnings, Messages, etc. So I wanna get the ability to write list of modes like the following:

(my-modified-status-segment :ignore ("Warnings" "Messages" ...))
;; vice versa
(telephone-line-vc-segment :modes ("Emacs-lisp" "Fundamental"))

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

I've started on this stuff. In order to add segment-specific modifiers, however, I needed to make segments able to have arguments. As such, latest update breaks backwards compatability for defsegments -- you now need an arglist after the segment name, as with defun, etc.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Another huge commit, redid the defsegments again (sorry!). Now they throw face into scope (kinda messy, but better than what I had), and defsegment* is for when you want to do trimming, or for segments that will always be displayed (e.g. evil-tag, buffer, etc)

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Just to clarify a bit more -- the new defsegment is basically the old defsegment*, and the new defsegment* does even less; it doesn't trim nor check for empty strings. To get the old defsegment behavior, you should use defsegment* and manaully call telephone-line-raw.

I did this because it's not likely users will need to do trimming; it's mostly something that would be done in the preset segments. Also because fixed segments (again, like evil-tag) are now slightly more efficient.

The defsegment* -> defsegment change, on the other hand, is because 90% of the time you want that functionality (that is, the current defsegment and old defsegment*), so it didn't make sense to have an asterisk on it -- that should be for the less used, more advanced one.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

That last comment probably just confused things more by comparing old behavior and new, so I'll just describe the current behavior now:

defsegment ensures the segment will not render if it's an empty string. It does not do trimming. This is what you want in most cases, unless you're wrapping built in mode-line features.

defsegment* does not make any guarantees. It should be used if you want to do your own trimming, or if you know your segment will never be empty. Builtin segments under the latter case include evil-tag, major-mode, and airline-position (normal position doesn't count because it requires trimming).

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

Any changes? Related to #53, now I wanna get padding options to align my center segments.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

This is definitely the next thing on my list, it's just that I need to rewrite parts of it to allow for you to use more than one modifier at a time.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Alright, latest commit adds :args, :truncate, and you can now use more than one modifier on a single segment. However, API change -- each segment with modifiers needs to be a proper plist. As an example, here's the config I was testing with:

  (setq telephone-line-lhs
        '((evil   . ((telephone-line-evil-tag-segment
                      :truncate 2)))
          (accent . (telephone-line-vc-segment
                     telephone-line-erc-modified-channels-segment
                     telephone-line-process-segment))
          (nil    . (telephone-line-buffer-segment))))

  (setq telephone-line-rhs
        '((nil    . (telephone-line-misc-info-segment))
          (accent . (telephone-line-major-mode-segment))
          (evil   . ((telephone-line-airline-position-segment
                      :args (5 5)
                      :active t)))))

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Also I should point out that truncate is inefficient at this level since it needs to collapse the segment to a string; using :args you can implement a more efficient truncation within the segment definition itself.

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

What does :args actually do? Is it add extra spaces around a segment or not?

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

It passes arguments to segments that were defined with them. Look at the definition of telephone-line-airline-position-segment in telephone-line-segments.el -- it takes arguments for padding the lines/columns.

I have not added a generic padding keyword, yet.

from telephone-line.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.