Replace eldev with nix and add support for permanent views
This commit is contained in:
parent
849712fa91
commit
22bbd9c174
5
Eldev
5
Eldev
|
@ -1,5 +0,0 @@
|
|||
; -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||
(eldev-use-package-archive 'melpa)
|
||||
(eldev-use-package-archive 'gnu-elpa)
|
||||
(eldev-add-extra-dependencies 'emacs 'projectile)
|
||||
(eldev-add-extra-dependencies 'emacs 'all-the-icons)
|
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
"nodes": {
|
||||
"emacs-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1707815184,
|
||||
"narHash": "sha256-WFoDXgaPdhjgQB3ut+ZN+VT7e60Yw+KUyvUkOSu5Wto=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "0f7f3b39157419f3035a2dad39fbaf8a4ba0448d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "0f7f3b39157419f3035a2dad39fbaf8a4ba0448d",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707689078,
|
||||
"narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1707650010,
|
||||
"narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1707451808,
|
||||
"narHash": "sha256-UwDBUNHNRsYKFJzyTMVMTF5qS4xeJlWoeyJf+6vvamU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
# 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/>.
|
||||
#
|
||||
{
|
||||
description = "A modeline which plays hide and seek";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e";
|
||||
inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ inputs.emacs-overlay.overlays.package ];
|
||||
};
|
||||
|
||||
|
||||
emacs = pkgs.emacs29.override {
|
||||
} // (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||
# Gtk causes a flickering issue on WM mode
|
||||
withGTK3 = false;
|
||||
toolkit = "lucid";
|
||||
});
|
||||
|
||||
|
||||
noether = pkgs.emacsPackages.trivialBuild {
|
||||
pname = "noether-mode";
|
||||
version = "0.1.0";
|
||||
buildInputs = [ pkgs.emacsPackages.posframe ];
|
||||
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
emacsPkgs = (pkgs.emacsPackagesFor emacs).withPackages (epkgs: [
|
||||
epkgs.projectile
|
||||
epkgs.posframe
|
||||
noether
|
||||
]);
|
||||
|
||||
test-noether = pkgs.writeShellApplication {
|
||||
name = "test-noether";
|
||||
runtimeInputs = [ emacsPkgs ];
|
||||
|
||||
text = ''
|
||||
${emacsPkgs}/bin/emacs -Q -l ./test-noether.el "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
packages.default = noether;
|
||||
packages.${system}.default = noether;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = [ noether emacsPkgs test-noether ];
|
||||
buildInputs = [ noether emacsPkgs pkgs.nerdfonts ];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -174,7 +174,7 @@ Emacs knowing."
|
|||
(when (buffer-file-name)
|
||||
(let ((dir (file-name-directory (buffer-file-name))))
|
||||
(setq noether--git-branch
|
||||
(string-trim (shell-command-to-string (format "git -C %s branch --show-current" dir)))))))
|
||||
(string-trim (shell-command-to-string (format "git -C %s branch --show-current 2> /dev/null" dir)))))))
|
||||
|
||||
(defun noether--format-git-branch (_ v _ _)
|
||||
"Just return the branch name V}."
|
||||
|
|
10
noether.el
10
noether.el
|
@ -57,7 +57,7 @@ on demand.")
|
|||
:position '(0 . 0)
|
||||
:border-width 0
|
||||
:accewpt-focus nil
|
||||
:timeout 10
|
||||
;;:timeout 10
|
||||
:refresh 1))
|
||||
|
||||
|
||||
|
@ -151,7 +151,7 @@ key/value from the original definition."
|
|||
|
||||
`(defun ,name (&rest f-props)
|
||||
,docs
|
||||
(append '(:name ,(intern (format ":%s" name)))
|
||||
(append '(:name ,(intern (format ":%s" (symbol-name name))))
|
||||
f-props (list ,@orig-props)))))
|
||||
|
||||
|
||||
|
@ -289,12 +289,16 @@ E.g. the updaters list."
|
|||
(noether--reset-view-state view)
|
||||
|
||||
(let ((name (noether--view-get view :name))
|
||||
(binding (noether--view-get view :binding)))
|
||||
(binding (noether--view-get view :binding))
|
||||
(visible (noether--view-get view :visible?)))
|
||||
|
||||
(when (not (null binding))
|
||||
(define-key noether-global-mode-map binding
|
||||
(lambda () (interactive) (noether-show view))))
|
||||
|
||||
(when visible
|
||||
(noether-show view))
|
||||
|
||||
(with-current-buffer (get-buffer-create (noether--view-get view :buffer (format "*%s*" name)))
|
||||
(erase-buffer)
|
||||
(goto-char 0)
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
;;; 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
|
||||
;; Package-Requires: ((posframe "1.4.2") (emacs "27.1"))
|
||||
;;
|
||||
;; 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:
|
||||
;; A simple frame manager framework that can be utilized to create a mode line
|
||||
;; alternative.
|
||||
;;; Change Log:
|
||||
;;; Code:
|
||||
|
||||
|
||||
(setq debug-on-error t)
|
||||
|
||||
(require 'noether)
|
||||
(require 'noether-units)
|
||||
(require 'noether-views)
|
||||
(require 'nerd-icons)
|
||||
(require 'projectile)
|
||||
|
||||
(noether-defview mode-line
|
||||
"A simple and minimalist mode-line like status bar"
|
||||
:managed? t
|
||||
:buffer "*modeline*"
|
||||
;;:binding (kbd "C-c 1")
|
||||
:timeout 0
|
||||
:separator "|"
|
||||
:visible? t
|
||||
:frame
|
||||
(list
|
||||
:position (cons (- (frame-outer-width) 10)
|
||||
(- (frame-outer-height) 40))
|
||||
;;:poshandler #'posframe-poshandler-frame-top-center
|
||||
:border-width 0
|
||||
: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: ")
|
||||
))
|
||||
(setq noether-views (list noether-minimal-mode-line noether-minimal-location noether-minimal-exwm mode-line))
|
||||
|
||||
|
||||
(projectile-global-mode t)
|
||||
(noether-global-mode t)
|
||||
|
||||
|
||||
(provide 'test-noether)
|
||||
;;; test-noether.el ends here
|
Loading…
Reference in New Issue