FG42/core/fg42/modeline.el

52 lines
1.7 KiB
EmacsLisp

;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2023 Sameer Rahmani <lxsameer@gnu.org>
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/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)
(defmacro defmode-line (name &rest body)
`(defun ,name () ,@body))
;; The default modeline has to be nil to let the
;; modeline setters know that they can use their
;; default modeline
(defmode-line fg42/default-modeline)
(defun fg42/default-mode-line-setter (def)
"Set the modeline definition in X to the `fg42-modeline'."
(unless (null def)
(setq mode-line-format (plist-get def :brief))
(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))
(provide 'fg42/modeline)
;;; modeline.el ends here