Closed DamienCassou closed 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.
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.
I've just pushed a "no-prefix" experimental branch.
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:
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).
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?
@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.
@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.
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?
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))))
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)
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.
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.
The 0 come from a debug session, I just forgot to remove it. Extra spaces might be a good idea indeed.
What is the bottom line?
Just an underline in the nano-modeline-active
face (in my config, I did not make it default)
(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.
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:
'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)
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.
The code is here: https://github.com/Lambda-Emacs/lambda-line
Nice. Configuring the RO/RW/** prefixes seem to be a good idea indee. I'll add the option.
What is the status of this experimental work?
Ready to be merged!
You seem to have released 0.7 out of the no-prefix
branch but this one is not merged into master yet.
Oh, I'll fix it.
done.
thank you. I think we can close this issue now.
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.