Add the default mechanism to create and modify modelines
This commit is contained in:
parent
d75f69d53a
commit
8d13a3ec3e
|
@ -24,6 +24,9 @@
|
||||||
(require 'server)
|
(require 'server)
|
||||||
(require 'fpkg)
|
(require 'fpkg)
|
||||||
(require 'fg42/cube)
|
(require 'fg42/cube)
|
||||||
|
(require 'fg42/utils)
|
||||||
|
(require 'fg42/modeline)
|
||||||
|
(require 'cubes/modeline)
|
||||||
|
|
||||||
(defflag font-icons
|
(defflag font-icons
|
||||||
"Enable the support for font icones in FG42." t)
|
"Enable the support for font icones in FG42." t)
|
||||||
|
@ -234,10 +237,17 @@
|
||||||
|
|
||||||
(when-flag server
|
(when-flag server
|
||||||
(if (not (server-running-p))
|
(if (not (server-running-p))
|
||||||
|
(when-wm
|
||||||
|
(setq server-name "fg42-wm"))
|
||||||
(server-start)))
|
(server-start)))
|
||||||
|
|
||||||
;; Call the editor related cubes. They will be run only if
|
;; Call the editor related cubes. They will be run only if
|
||||||
;; their flag is active otherwise they will be skipped
|
;; their flag is active otherwise they will be skipped
|
||||||
|
(let ((mline (or (plist-get fg42/editor-cube-params :modeline)
|
||||||
|
fg42/default-modeline)))
|
||||||
|
(fg42/modeline-cube)
|
||||||
|
(fg42/setup-modeline-format mline))
|
||||||
|
|
||||||
(fg42/font-cube)
|
(fg42/font-cube)
|
||||||
(fg42/pinentry-cube)
|
(fg42/pinentry-cube)
|
||||||
(fg42/exec-path-cube)
|
(fg42/exec-path-cube)
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
:flag smart-mode-line
|
:flag smart-mode-line
|
||||||
:flag-default t)
|
:flag-default t)
|
||||||
|
|
||||||
|
(defun fg42/mini-modeline-setter (def)
|
||||||
|
(setq mini-modeline-l-format (plist-get def :long))
|
||||||
|
(setq mini-modeline-r-format (plist-get def :brief)))
|
||||||
|
|
||||||
(fpkg/use smart-mode-line
|
(fpkg/use smart-mode-line
|
||||||
:straight (smart-mode-line :source melpa)
|
:straight (smart-mode-line :source melpa)
|
||||||
:defer nil
|
:defer nil
|
||||||
|
@ -40,14 +44,15 @@
|
||||||
(setq sml/no-confirm-load-theme t)
|
(setq sml/no-confirm-load-theme t)
|
||||||
(sml/setup)))
|
(sml/setup)))
|
||||||
|
|
||||||
|
|
||||||
(fpkg/use mini-modeline
|
(fpkg/use mini-modeline
|
||||||
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
|
:straight (mini-modeline :repo "kiennq/emacs-mini-modeline"
|
||||||
:host github
|
:host github
|
||||||
:type git)
|
:type git)
|
||||||
:after smart-mode-line
|
:after smart-mode-line
|
||||||
:init
|
:init
|
||||||
(setq mini-modeline-enhance-visual t)
|
(progn
|
||||||
|
(setq mini-modeline-enhance-visual t)
|
||||||
|
(setq fg42/modeline-setter #'fg42/mini-modeline-setter))
|
||||||
:defer nil
|
:defer nil
|
||||||
:config
|
:config
|
||||||
(mini-modeline-mode t)))
|
(mini-modeline-mode t)))
|
||||||
|
|
|
@ -32,13 +32,6 @@
|
||||||
"The flag to enable WM mode in FG42.")
|
"The flag to enable WM mode in FG42.")
|
||||||
|
|
||||||
|
|
||||||
(defmacro when-wm (&rest body)
|
|
||||||
"Run the BODY only if in wm mode."
|
|
||||||
(if (string= (getenv "FG42_WM") "true")
|
|
||||||
`(progn ,@body)
|
|
||||||
nil))
|
|
||||||
|
|
||||||
|
|
||||||
(defcube fg42/wm-cube
|
(defcube fg42/wm-cube
|
||||||
"This cube will setup *FG42* to act as a window manager."
|
"This cube will setup *FG42* to act as a window manager."
|
||||||
(:title "Window manager cube"
|
(:title "Window manager cube"
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copyright (c) 2010-2022 Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;;
|
||||||
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
|
;; URL: https://gitlab.com/FG42/FG42
|
||||||
|
;; Version: 3.0.0
|
||||||
|
;;
|
||||||
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
;;
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defvar fg42/modeline-setter #'fg42/default-mode-line-setter)
|
||||||
|
(defvar fg42/default-modeline '(:brief mode-line-format :long ""))
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/default-mode-line-setter (_)
|
||||||
|
"Set the modeline definition in X to the `fg42-modeline'."
|
||||||
|
(setq mode-line-format (plist-get fg42/default-modeline :brief)))
|
||||||
|
|
||||||
|
|
||||||
|
(defun fg42/setup-modeline-format (definition)
|
||||||
|
"Setup the modeline by calling the setter function and passing the DEFINITION."
|
||||||
|
(funcall fg42/modeline-setter definition))
|
||||||
|
|
||||||
|
|
||||||
|
(defmacro defmode-line (name body)
|
||||||
|
`(defvar ,name ,@body))
|
||||||
|
|
||||||
|
(provide 'fg42/modeline)
|
||||||
|
;;; modeline.el ends here
|
|
@ -171,5 +171,12 @@ is non-nil value it means that the function can be called interactively."
|
||||||
,docstring ,interactive))
|
,docstring ,interactive))
|
||||||
|
|
||||||
|
|
||||||
|
(defmacro when-wm (&rest body)
|
||||||
|
"Run the BODY only if in wm mode."
|
||||||
|
(if (string= (getenv "FG42_WM") "true")
|
||||||
|
`(progn ,@body)
|
||||||
|
nil))
|
||||||
|
|
||||||
|
|
||||||
(provide 'fg42/utils)
|
(provide 'fg42/utils)
|
||||||
;;; utils.el ends here
|
;;; utils.el ends here
|
||||||
|
|
Loading…
Reference in New Issue