diff --git a/modules/ui/popup/autoload/popup.el b/modules/ui/popup/autoload/popup.el index f6ac1da82..6b1b11a55 100644 --- a/modules/ui/popup/autoload/popup.el +++ b/modules/ui/popup/autoload/popup.el @@ -215,23 +215,24 @@ restoring it if `+popup-buffer-mode' is disabled." ;;;###autoload (defun +popup|set-modeline-on-enable () "Don't show modeline in popup windows without a `modeline' window-parameter. +Possible values for this parameter are: -+ If one exists and it's a symbol, use `doom-modeline' to grab the format. -+ If non-nil, show the mode-line as normal. -+ If nil (or omitted), then hide the modeline entirely (the default). -+ If a function, it takes the current buffer as its argument and must return one - of the above values." + t show the mode-line as normal + nil hide the modeline entirely (the default) + a function `mode-line-format' is set to its return value + +Any non-nil value besides the above will be used as the raw value for +`mode-line-format'." (when (bound-and-true-p +popup-buffer-mode) (let ((modeline (+popup-parameter 'modeline))) (cond ((eq modeline 't)) - ((or (eq modeline 'nil) - (null modeline)) + ((null modeline) ;; TODO use `mode-line-format' window parameter instead (emacs 26+) (hide-mode-line-mode +1)) - ((functionp modeline) - (funcall modeline)) - ((symbolp modeline) - (when-let* ((hide-mode-line-format (doom-modeline modeline))) + ((let ((hide-mode-line-format + (if (functionp modeline) + (funcall modeline) + modeline))) (hide-mode-line-mode +1))))))) (put '+popup|set-modeline-on-enable 'permanent-local-hook t) diff --git a/modules/ui/popup/autoload/settings.el b/modules/ui/popup/autoload/settings.el index 3d9d82f65..e700e5445 100644 --- a/modules/ui/popup/autoload/settings.el +++ b/modules/ui/popup/autoload/settings.el @@ -143,11 +143,11 @@ PLIST can be made up of any of the following properties: (where you were before the popup opened). The popup system does nothing else and ignores the function's return value. -:modeline BOOL|SYMBOL|FN - Can be t (show the default modeline), a symbol representing the name of a - modeline defined with `def-modeline!', nil (show no modeline) or a function - that returns a modeline format. The function takes no arguments and is run in - the context of the popup buffer. +:modeline BOOL|FN|LIST + Can be t (show the default modeline), nil (show no modeline), a function that + returns a modeline format or a valid value for `mode-line-format' to be used + verbatim. The function takes no arguments and is run in the context of the + popup buffer. :autosave BOOL|FN This parameter determines what to do with modified buffers when closing popup diff --git a/modules/ui/popup/test/test-popup.el b/modules/ui/popup/test/test-popup.el index 332a2fded..0f666affe 100644 --- a/modules/ui/popup/test/test-popup.el +++ b/modules/ui/popup/test/test-popup.el @@ -140,10 +140,9 @@ (display-buffer a) (expect mode-line-format :to-equal (default-value 'mode-line-format))) (it "uses a predefined mode-line if passed a symbol" - (def-modeline! test-popup-modeline ("x") ()) - (set-popup-rule! "a" :modeline 'test-popup-modeline :select t) + (set-popup-rule! "a" :modeline '("x") :select t) (display-buffer a) - (expect mode-line-format :to-equal (doom-modeline 'test-popup-modeline))) + (expect mode-line-format :to-equal '("x"))) (it "runs the handler if passed a function" (set-popup-rule! "a" :modeline (lambda () (setq mode-line-format '("x"))) :select t) (display-buffer a)