rougier / nano-modeline

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

Expandability #1

Closed bestlem closed 3 years ago

bestlem commented 3 years ago

I would like to use nano-modeline as the basis for my mode-line.

nano-modeline seems simple enough and seems to work well.

However it is not that expandabnle as you have to copy all of the function nano-modeline and change that to alter the modelines for particular modes.

Could it be changed do that the let and eval section is put into a separate function so that users can just provide a new version of that function to expand nano.

rougier commented 3 years ago

I think best way would be to remove all the specific modeline and to keep only the default one. From this you can modify it any way you like.

bestlem commented 3 years ago

What I was after is having different modelines for some different modes ie adding to the cond case statement.

rougier commented 3 years ago

I could insert a user-defined-mode where you'll be free to do whatever you want. For instance, instead of testing if we're in a specific mode, I coudl test if a user defined function exists.

bestlem commented 3 years ago

Yes that could work

rougier commented 3 years ago

Do you want to make a PR?

bestlem commented 3 years ago

I have woirking code - the PR is a bit tricky as my set up will auto format code - sticking to the current setup.

Unfortunately you have hard tabs in some places and not others so diffs get large. What should they be so I can format first.

The simplest new code is as follows but the -p function should probably allow the user to continue with the rest of the cond

(defcustom nano-modeline-user-function nil
  "User supplied function to be evaluated for modeline."
  :type '(choice (const nil) function)
  :group 'nano-modeline)

(defun nano-modeline-user-function-p ()
  "Should the user supplied function be called for modeline?"
  nano-modeline-user-function)

and first line of the cond

((nano-modeline-user-function-p) (funcall ,nano-modeline-user-function))

rougier commented 3 years ago

Sorry for the delay. This might work actually but the two functions should be customizable, no?

HyunggyuJang commented 3 years ago

@rougier How about this?

I adopted doom modeline package's facilities to allow flexible configuration while optimize the mode line format's definition.

The one linked greatly modified to suit my personal taste, but you can get the idea by looking into nano-set-modeline-hook!.

It's still WIP, e.g. have to figure out org clock mode settings and so on, but I'm quite satisfied with it.

rougier commented 3 years ago

It make me think that we could also have a customization to activate /deactivate a specific mode instead of commenting/uncommenting.

rougier commented 3 years ago

I've just added the user mode.