kiennq/emacs-mini-modeline

(setq mini-modeline-display-gui-line t) is not honored if emacs is started in server mode

Opened this issue · 3 comments

Observed behavior:

In emacs server/client mode:

If (mini-modeline-mode t) is activated in init.el then the mode is started as expected,
however, the mini-modeline-display-gui-line is not activated after emacs client has been started, i.e. the frame has been created.

Expected behavior:

Regardless, whether emacs is started in normal mode or in server/client mode, mini-modeline-display-gui-line should be active, is set accordingly in init.el.

Mitigation:

	(if (daemonp)
			(add-hook 'after-make-frame-functions (lambda (frame)
				(with-selected-frame frame
					(if (window-system frame)
						(mini-modeline-mode 1)))))
		(mini-modeline-mode 1))

However, I feel, this is not as clean is it could be...

See #37. I don’t know if there is much emacs can do when starting in server mode (with no gui-frames launched?). I suppose your code could be added to the mode definition, making it much more complicated. Otherwise a note in the readme could be an idea?

A readme note would be good, I think.

  • if emacs is started in server mode, the mini-modeline-mode can't be enabled (because of terminal mode)
  • in that case this / or that hook should be used (note: focus-in-hook as described in #37 is obsolet (emacs 27.2))

@hpgisler for the new after-focus-change-function interface I now use something like

(add-function :after after-focus-change-function
              #'(lambda ()
                  (unless mini-modeline-mode
                    (mini-modeline-mode)
                    (modus-themes-load-operandi))))

which works for me.

Though I agree that it should be mentioned in the README—fancy opening a pr?