rougier / nano-modeline

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

New branch "simpler" #49

Closed rougier closed 1 year ago

rougier commented 1 year ago

I've fully rewritten the modeline to make it easier to maintain and faster to display. Usage is now (for example):

(add-hook 'prog-mode-hook #'nano-modeline-prog-mode)

This installs the nano-modeline-prog-mode line for prog-mode that has been defined as:


(defun nano-modeline-prog-mode (&optional default)
  "Nano line for prog mode. Can be made DEFAULT mode."

  (funcall nano-modeline-position
            '((nano-modeline-buffer-status) " "
              (nano-modeline-buffer-name) " "
              (nano-modeline-git-info))
            '((nano-modeline-cursor-position)
              (nano-modeline-window-dedicated))
            default))

It should now be easier to contribute new dedicated modes. Also the modeline is aligned with left/right margins but includes fringes. This is not an option yet but if people are interested, it can be made an option.

aaronjensen commented 1 year ago

What's the recommended way to disable the mode line when using this as a header now?

rougier commented 1 year ago

I personally use

(setq-default mode-line-format "")
(set-face-attribute 'mode-line nil
                    :foreground (face-background 'default)
                    :background (face-background 'default)
                    :overline (face-foreground 'default)
                    :underline nil
                    :height 0.25
                    :box nil)
(set-face-attribute 'mode-line-inactive nil
                    :foreground (face-background 'default)
                    :background (face-background 'default)
                    :height 0.25
                    :overline (face-foreground 'nano-faded)
                    :underline nil
                    :box nil)
aaronjensen commented 1 year ago

Thanks. I use the mode line on occasion, so I'll just set (setq-default mode-line-format nil)

I've started working on porting my tweaks over, trying to see if I can use this package without forking it like I did before.

I first tried declaring all new modelines that were composed of my custom pieces. Then I tried using override advice to replace existing ones, but I ran into a wall, plus I had to do nasty things like:

(advice-add 'nano-modeline-git-info :override #'aj-nano-modeline-project)

So I think I'll probably maintain my own modelines, likely as a separate package that depends on this package.

In any case, at first blush most of these seem like good changes.

I don't know that the changes to the semantics of the faces are positive. Before there was name, primary, and secondary. They were semantically meaningful and I could define them as I wanted (for example, I made secondary smaller, and name a variable width font). Now, with names like "bold" and "faded" it seems like misappropriation to change their style to anything but bold or faded variants.

rougier commented 1 year ago

The point is that you can now define your own modeline quite easily and just inject your element in a given mode or make a new one entirely. As for the names of the face, you're right. I'll change them back to original name

aaronjensen commented 1 year ago

Copy that. I think the thing that led me to wanting to override some was not wanting to have to define multiple different modelines for the different modes, but that gives me the best customization, so I may as well. Do you have a sense of when you plan to merge, and is there any chance you won't be merging (i.e., how experimental is this?)

rougier commented 1 year ago

I'm waiting for some feedback and if positive I'll merge.