rougier / nano-modeline

GNU Emacs / N Λ N O Modeline
GNU General Public License v3.0
175 stars 31 forks source link

Showing obvious/boring information #33

Closed DamienCassou closed 2 years ago

DamienCassou commented 2 years ago

I'm wondering if nano-modeline should show what I would consider obvious/boring information or if it should display nothing. Examples of what I would consider obvious/boring:

Information I would really appreciate seeing: "RO" in a file-visiting buffer that is read-only. This is rare and important information. The other cases are obvious and don't deserve my attention.

rougier commented 2 years ago

The RW is mostly useful when it becomes ** to signal file has been modified. We could keep only the ** but it will "disrupts" the modeline. Also, spaces before/after prefix are used to enlarge the modeline. Nonetheless, I agree with your analysis and there may be a better way to be find.

DamienCassou commented 2 years ago

We could keep only the **

this is my point indeed.

it will "disrupts" the modeline

Do you mean that the "name" and "primary" parts would move left each time the user saves? Is that a problem?

What about only using the face to convey the information:

Then we don't need any text (except a few spaces to apply the face on) and no disruption occurs.

rougier commented 2 years ago

I've just pushed a "no-prefix" experimental branch.

aaronjensen commented 2 years ago

I think this direction is reasonable, though not as aesthetically pleasing. I'm OK with that though. One could add the bar of color to the left a la doom/mood-line if one wanted that.

There are a few things that I'm doing on my fork that may be worth doing on the main line. This is modified from no-prefix, it's the final concat in nano-modeline-render:

(concat
       (propertize " "  'face face-secondary 'display `(space :width left-fringe))
       left
       (propertize " "  'face face-secondary 'display `(raise ,nano-modeline-space-top))
       (propertize " "  'face face-secondary 'display `(raise ,nano-modeline-space-bottom))
       (propertize " "  'face face-secondary 'display `(space :align-to (- right-fringe ,right-len)))
       right)

A few things to note:

  1. I use a variable pitch font for all my modeline primary faces and a fixed one for secondary, so I used secondary for everything above, though the only concrete impact that has is that it uses the height of the secondary + the raises rather than the height of the primary (my secondary is a little taller)
  2. I put the raises in between the primary and secondary so the size of their space is largely irrelevant.
  3. I use fringe width on both the right and left to pad the mode line. I simplified the align-to on the right to something I think is equivalent to what it was w/o the minus 0.

I may play with adding a * after the file name to indicate that it is modified (or a round circle as is the VS Code style, especially since * is a common in emacs buffer names).

DamienCassou commented 2 years ago

I've just started trying the no-prefix branch and I have to say I like it. Quick feedback: instead of multiplying the number of faces, can't you combine them? I.e., have active, inactive, RW, RO and modified faces and use 2 of them?

rougier commented 2 years ago

@aaronjensen I also find it less pleasant aesthetically and I end up adding a " ☰ " (not commited) instead of prefix that is clickable to show the mode menu. I never use it but I like the contrast the prefix brings. I will add it as an option. If you add the fringe space in front, that would need to be balanced with a space at the end of the prefix. With such prefix, we can use color to tell buffer is modified but if a user decide to have no prefix, then we need another way. I've played with color for the name but it's not satisfactory.

@DamienCassou I agree that faces could be merged, I'll look into that.

aaronjensen commented 2 years ago

@rougier I've gotten used to it without anything on the left but the name of the buffer. I also switched to using a :box on the faces, rather than the display :raise and :space to give the right shape and size to the header line. This has the benefit of making the size more consistent, but means I can't put a colored bar or something like that on the far left.

Here's an example:

`(nano-modeline-active               ((,light (:background ,nano-light-background-alt
                                               :box (:line-width (8 . 4) :color ,nano-light-background-alt :style nil)))
                                      (,dark (:background ,nano-dark-background-alt 
                                               :box (:line-width (8 . 4) :color ,nano-dark-background-alt :style nil))))

I mention the colored bar because the one current problem I have is it's too hard do differentiate between the active and inactive windows with my theme. Previously I relied on the colored RW and I mildly lightened the primary text in the header line. I'll keep playing with it.

CleanShot 2022-04-07 at 04 10 02@2x
rougier commented 2 years ago

Gorgeous. I just discovered box are now configurable in H/V direction which is great. This is precisely what I was trying to achieve with the up/down spaces. I also like the smaller size of primary information. Ideally, right part could also beneficiate from a reduced size but it messes up with the align method. By the way, is is the tabbar above?

aaronjensen commented 2 years ago

As long as the align has the same face as the right and it is a fixed pitch face the align should work. I use this:

(propertize " "  'face face-secondary 'display `(space :align-to (- right-fringe ,right-len)))

And yes, that's the tab bar with this theme and these customizations:

  (setq tab-bar-show t
        tab-bar-new-tab-choice t
        tab-bar-new-button nil
        tab-bar-close-button nil
        tab-bar-new-tab-to 'rightmost
        tab-bar-tab-name-function #'aj/name-tab-by-project-or-default
        tab-bar-tab-name-format-function #'aj/tab-bar-tab-name-format
        tab-bar-separator ""
        tab-bar-format '(tab-bar-format-history
                         tab-bar-format-tabs
                         aj/tab-bar-suffix
                         tab-bar-format-add-tab))

  (defun aj/tab-bar-suffix ()
    "Empty space to ensure that the last tab's face does not extend to the end of the tab bar"
    " ")

  (defun aj/tab-bar-tab-name-format (tab i)
    (let ((current-p (eq (car tab) 'current-tab)))
      (propertize
       (concat
        (propertize " " 'display '(space :width (8)))
        (if tab-bar-tab-hints (format "%d " i) "")
        (alist-get 'name tab)
        (or (and tab-bar-close-button-show
                 (not (eq tab-bar-close-button-show
                          (if current-p 'non-selected 'selected)))
                 tab-bar-close-button)
            "")
        (propertize " " 'display '(space :width (8))))
       'face (funcall tab-bar-tab-face-function tab))))
rougier commented 2 years ago

Thanks I've made the modification for the space / align-to. I've also added an option for the prefix such that user can now choose to have the default RO/RW/** prefix, no prefix or an icon that is sutomizable for each mode (I still need to modify the custom type for allowing cusomization but I'm a bit stuck with the syntax)

aaronjensen commented 2 years ago

On the spacing, did you find you had to do ,(- right-len 0) vs ,right-len? I don't understand what the - 0 is for.

The icons are an interesting idea. Can you share a screenshot of some of them? I don't have patched fonts installed.

aaronjensen commented 2 years ago

Here's where I am now. I left enough space between the name and the primary so that the modified bullet can appear w/o shifting anything.

CleanShot 2022-04-08 at 06 25 53@2x
rougier commented 2 years ago

The 0 come from a debug session, I just forgot to remove it. Extra spaces might be a good idea indeed.

Screenshot 2022-04-08 at 14 30 39
aaronjensen commented 2 years ago

What is the bottom line?

rougier commented 2 years ago

Just an underline in the nano-modeline-active face (in my config, I did not make it default)

DamienCassou commented 2 years ago
(defcustom nano-modeline-prefix 'default ...)

I don't think the default value should be named default because:

I suggest something like status or file-mode or similar instead.

DamienCassou commented 2 years ago

Just an underline in the nano-modeline-active face (in my config, I did not make it default)

Setting underline to t doesn't have the same impact for me: 2022-04-10-103620

rougier commented 2 years ago

'status sounds good. I'll make the change.

For the uderline, this should be for the 'nano-modeline-active' (that is inherited) and then you have to disable some settings:

(setq x-underline-at-descent-line t)
(setq x-use-underline-position-properties nil)
(setq underline-minimum-offset 10)
mclearc commented 2 years ago

If it's of interest I've incorporated some changes in my fork of nano-modeline that might be of interest. I have made the status symbol configurable, or you can just not display it at all. There are also differences set for GUI vs. TTY. Here's a screenshot of the normal R/W buffer in GUI.

Screen Shot 2022-04-11 at 19 11 09

The code is here: https://github.com/Lambda-Emacs/lambda-line

rougier commented 2 years ago

Nice. Configuring the RO/RW/** prefixes seem to be a good idea indee. I'll add the option.

DamienCassou commented 2 years ago

What is the status of this experimental work?

rougier commented 2 years ago

Ready to be merged!

DamienCassou commented 2 years ago

You seem to have released 0.7 out of the no-prefix branch but this one is not merged into master yet.

rougier commented 2 years ago

Oh, I'll fix it.

rougier commented 2 years ago

done.

DamienCassou commented 2 years ago

thank you. I think we can close this issue now.