Add a default and minimalist view
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
This commit is contained in:
parent
a940f5d1f8
commit
b06890364e
|
@ -141,16 +141,16 @@ Emacs knowing."
|
|||
(defvar noether--project "")
|
||||
|
||||
(defun noether--set-project ()
|
||||
"Set the current time to the internal var which is being watched."
|
||||
"Set the current project for the current buffer."
|
||||
(setq noether--project (projectile-project-name)))
|
||||
|
||||
(defun noether--format-project (_ v _ _)
|
||||
"Just return the current time V."
|
||||
"Just return the current project V."
|
||||
v)
|
||||
|
||||
|
||||
(noether-defunit projectile-project-unit
|
||||
"just the time for your bar."
|
||||
"Show the current project name for the current buffer"
|
||||
:label "P:"
|
||||
:len 30
|
||||
:init (lambda ()
|
||||
|
@ -163,6 +163,34 @@ Emacs knowing."
|
|||
:var 'noether--project
|
||||
:fn #'noether--format-project)
|
||||
|
||||
;; ============================================================================
|
||||
;; Git branch
|
||||
;; ============================================================================
|
||||
|
||||
(defvar noether--git-branch "")
|
||||
|
||||
(defun noether--set-git-branch ()
|
||||
"Set the branch name for the current buffer."
|
||||
(setq noether--git-branch
|
||||
(emacs-repository-branch-git (file-name-directory (buffer-file-name)))))
|
||||
|
||||
(defun noether--format-git-branch (_ v _ _)
|
||||
"Just return the branch name V}."
|
||||
v)
|
||||
|
||||
|
||||
(noether-defunit git-branch-unit
|
||||
"Show the git branch for the current buffer."
|
||||
:label "B:"
|
||||
:len 40
|
||||
:init (lambda ()
|
||||
(add-hook 'noether-on-buffer-change-hook #'noether--set-git-branch))
|
||||
:deinit (lambda ()
|
||||
(remove-hook 'noether-on-buffer-change-hook #'noether--set-git-branch))
|
||||
|
||||
:var 'noether--git-branch
|
||||
:fn #'noether--format-git-branch)
|
||||
|
||||
|
||||
(provide 'noether-units)
|
||||
;;; noether-units.el ends here
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
;;; noether.el --- A modeline which plays hide and seek -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2023 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; URL: https://devheroes.codes/lxsameer/noether
|
||||
;; Version: 0.1.0
|
||||
;; Keywords: frames, modeline
|
||||
;;
|
||||
;; 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:
|
||||
;;; Change Log:
|
||||
;;; Code:
|
||||
(require 'posframe)
|
||||
|
||||
(require 'noether)
|
||||
(require 'noether-units)
|
||||
|
||||
|
||||
(noether-defview noether-minimal-mode-line
|
||||
"A simple and minimalist mode-line like status bar"
|
||||
:managed? t
|
||||
:buffer "*mainview*"
|
||||
:binding (kbd "C-c 1")
|
||||
:separator "|"
|
||||
:frame
|
||||
(list
|
||||
:position nil
|
||||
:poshandler #'posframe-poshandler-frame-top-center
|
||||
:border-width 1
|
||||
:border-color "#bd93f9")
|
||||
|
||||
:units
|
||||
(list
|
||||
(line-unit :label "")
|
||||
(buffer-name-unit :label "B: ")
|
||||
(mode-name-unit :label "M: ")
|
||||
(projectile-project-unit :label "P: ")
|
||||
(git-branch-unit :label "Br: ")))
|
||||
|
||||
|
||||
|
||||
(provide 'noether-views)
|
||||
;;; noether-views.el ends here
|
|
@ -116,7 +116,7 @@ function."
|
|||
BODY will be parsed in a way that any starting pair of keyword and value
|
||||
will be used as the view properties and the rest will be the body of
|
||||
the show function."
|
||||
(declare (doc-string 2))
|
||||
(declare (doc-string 2) (indent defun))
|
||||
(let* ((parsed-body (noether--extract-props body))
|
||||
(show-body (car parsed-body))
|
||||
(props (cdr parsed-body))
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
(require 'projectile)
|
||||
(require 'all-the-icons)
|
||||
(require 'noether-units)
|
||||
(require 'noether-views)
|
||||
;;(debug-on-entry 'noether--update-buffer-name)
|
||||
|
||||
(noether-defview example-bar
|
||||
|
@ -73,7 +74,7 @@
|
|||
:group 'noether)
|
||||
|
||||
|
||||
(setq noether-views (list example-bar))
|
||||
(setq noether-views (list noether-minimal-mode-line))
|
||||
|
||||
(add-hook
|
||||
'noether-global-mode-hook
|
||||
|
|
Loading…
Reference in New Issue