From d8e729c7d8c758c3e359bb6d4ca06e394670b468 Mon Sep 17 00:00:00 2001 From: Artur Manuel Date: Sat, 3 May 2025 18:04:12 +0100 Subject: [PATCH 1/2] refactor: remake pankomacs --- README.org | 61 +++++++++++++++++++------------- config/config-dev.el | 24 ------------- config/config-ivy.el | 29 --------------- config/config-languages.el | 69 +++++++----------------------------- config/config-org.el | 42 ++++++++++++++++++++++ config/config-ui.el | 28 +++++++-------- config/config.el | 72 ++++++++++++++++++-------------------- flake.lock | 18 +++++----- lib.nix | 15 +++----- 9 files changed, 150 insertions(+), 208 deletions(-) delete mode 100644 config/config-dev.el delete mode 100644 config/config-ivy.el create mode 100644 config/config-org.el diff --git a/README.org b/README.org index bb94b9e..bc065a3 100644 --- a/README.org +++ b/README.org @@ -1,35 +1,46 @@ -#+html: -#+options: toc:nil +#+title: Pankomacs +#+options: num:nil -** Pankomacs +#+html: -****** opinionated opinionated emacs configuration (ft. flakes) +Pankomacs is an "opinionated opinionated emacs configuration" which uses flakes +and emacs-overlay to manage packages instead of straight.el. It tries to use +builtin tools when possible to keep the size of the configuration reasonable. ------ +* How do I use this configuration? -#+html: +Add pankomacs and nixpkgs (assuming you don't have it) into your flake inputs +like this: +#+begin_src nix +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + pankomacs = { + url = "git+https://copeberg.org/amadaluzia/pankomacs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; +} +#+end_src ------ +You can then, for example, use it in your NixOS configuration by using this in +your NixOS configuration: +#+begin_src nix + {inputs, pkgs, ...}: { + services.emacs = { + enable = true; + package = inputs.pankomacs.lib.mkPankomacs { + inherit pkgs; + emacs = pkgs.emacs-pgtk; # non-specific + }; + }; + } +#+end_src -*** Disclaimer +* Where did the name come from? -This config is bound to change for any reason if I feel like it that day. - -You are fine to use it, but do know that it may change for any reason on my end. - ------ - -*** What is this configuration? - -This is a Nix flake for my Emacs configuration, similar to [[https://github.com/nix-community/kickstart-nix.nvim][kickstart-nix.nvim]]. - -This was put in my =~/.emacs.d/= so I added some files to exclude in my =.gitignore=. - ------ - -*** Where did the name come from? - -Pankomacs and "opinionated opinionated emacs configuration" came from a mix between Emacs and [[https://www.instagram.com/fatfatpankocat/][fatfatpankocat]]. +Pankomacs and "opinionated opinionated emacs configuration" came from a mix +between Emacs and [[https://www.instagram.com/fatfatpankocat/][fatfatpankocat]]. Other suggested named were "Plusmacs" based off of this discord conversation: diff --git a/config/config-dev.el b/config/config-dev.el deleted file mode 100644 index b981192..0000000 --- a/config/config-dev.el +++ /dev/null @@ -1,24 +0,0 @@ -;; -*- lexical-binding: t -*- - - -(defun config-init-dev () - (use-package which-key - :defer t - :commands (which-key-mode) - :custom - (which-key-mode t)) - - (use-package envrc - :defer t - :commands (envrc-global-mode envrc-mode) - :custom - (envrc-global-mode t)) - - (use-package eglot - :defer t - :commands (eglot eglot-ensure) - :hook (prog-mode . eglot-ensure) - :config - (add-to-list 'eglot-server-programs '((nim-mode nimscript-mode) . ("nimlsp"))))) - -(provide 'config-dev) diff --git a/config/config-ivy.el b/config/config-ivy.el deleted file mode 100644 index 26c6bab..0000000 --- a/config/config-ivy.el +++ /dev/null @@ -1,29 +0,0 @@ -;; -*- lexical-binding: t -*- - - -(defun config-init-ivy () - (use-package ivy - :custom - (ivy-mode t) - (counsel-mode t) - (ivy-use-virtual-buffers t) - :bind (("C-s" . swiper-isearch) - ("C-c C-r" . ivy-resume) - ("" . ivy-resume) - ("M-x" . counsel-M-x) - ("C-x C-f" . counsel-find-file) - (" f" . counsel-describe-function) - (" v" . counsel-describe-variable) - (" o" . counsel-describe-symbol) - (" l" . counsel-find-library) - (" i" . counsel-info-lookup-symbol) - (" u" . counsel-unicode-char) - ("C-c g" . counsel-git) - ("C-c j" . counsel-git-grep) - ("C-c k" . counsel-ag) - ("C-x l" . counsel-locate) - ("C-S-o" . counsel-rhythmbox) - :map minibuffer-local-map - ("C-r" . counsel-minibuffer-history)))) - -(provide 'config-ivy) diff --git a/config/config-languages.el b/config/config-languages.el index ec0ed30..86235d3 100644 --- a/config/config-languages.el +++ b/config/config-languages.el @@ -1,61 +1,16 @@ -;; -*- lexical-binding: t -*- +;;; config-languages --- Language configuration -*- lexical-binding: t -*- -(defun config-init-languages () +;;; Commentary: + +;; I need to provide configuration for things like +;; Nix, Nim, etc. so why not just write it down +;; here? + +;;; Code: +(defun init-languages-config () + "Just provide some language configuration." (use-package nix-ts-mode - :defer t - :commands (nix-ts-mode) - :mode "\\.nix\\'") - - (use-package rust-ts-mode - :defer t - :commands (rust-ts-mode) - :mode "\\.rs\\'") - - (use-package qml-mode - :defer t - :commands (qml-mode) - :mode "\\.qml\\'") - - (use-package haskell-mode - :defer t - :commands (haskell-mode) - :mode "\\.hs\\'") - - (use-package python - :defer t - :commands (python-ts-mode python-mode) - :custom - (python-indent-offset 4)) - - (use-package cc-mode - :defer t - :commands (c-ts-mode - c++-ts-mode - c++-mode - c-mode) - :custom - (c-basic-offset 4)) - - (use-package nushell-mode - :defer t - :commands (nushell-mode) - :mode "\\.nu\\'") - - (use-package tuareg - :defer t - :commands (tuareg-mode tuareg-opam-mode) - :mode "\\.ml\\'") - - (use-package nim-mode - :defer t - :commands (nim-mode) - :mode (("\\.nim\\'" . nim-mode) - ("\\.nims\\'" . nimscript-mode))) - - (use-package go-ts-mode - :defer t - :commands (go-ts-mode go-mod-ts-mode) - :mode (("\\.go\\'" . go-ts-mode) - ("go.mod\\'" . go-mod-ts-mode)))) + :mode "\\.nix\\'")) (provide 'config-languages) +;;; config-languages.el ends here diff --git a/config/config-org.el b/config/config-org.el new file mode 100644 index 0000000..22fdb7c --- /dev/null +++ b/config/config-org.el @@ -0,0 +1,42 @@ +;;; config-org --- Configuration for Org-mode -*- lexical-binding: t -*- + +;;; Commentary: + +;; I need to do Org-mode configuration and this is +;; a decent place to do that. + +;;; Code: +(defun init-org-config () + "Just provide Org-mode configuration." + (defun my/org-mode-borders () + (modify-all-frames-parameters + '((right-divider-width . 20) + (internal-border-width . 20))) + (dolist (face '(window-divider + window-divider-first-pixel + window-divider-last-pixel)) + (face-spec-reset-face face) + (set-face-foreground face (face-attribute 'default :background))) + (set-face-background 'fringe (face-attribute 'default :background))) + (use-package org + :custom + ;; Edit settings + (org-auto-align-tags nil) + (org-tags-column 0) + (org-fold-catch-invisible-edits 'show-and-error) + (org-special-ctrl-a/e t) + (org-insert-heading-respect-content t) + + ;; Org styling, hide markup etc. + (org-hide-emphasis-markers t) + (org-pretty-entities t) + (org-agenda-tags-column 0) + (org-ellipsis "…") + :hook (org-mode . my/org-mode-borders)) + (use-package org-modern + :hook (org-mode . org-modern-mode)) + (use-package org-bullets + :hook org-mode)) + +(provide 'config-org) +;;; config-org.el ends here diff --git a/config/config-ui.el b/config/config-ui.el index 57a05cb..a7d1b32 100644 --- a/config/config-ui.el +++ b/config/config-ui.el @@ -1,24 +1,20 @@ -;; -*- lexical-binding: t -*- +;;; config-ui --- UI configuration -*- lexical-binding: t -*- +;;; Commentary: -(defun config-init-ui () - (defun my/doom-modeline-for-new-frames (&optional frame) - (setq doom-modeline-height (+ (frame-char-height) 8)) - (with-selected-frame (or frame (selected-frame)) - (doom-modeline-mode 1))) +;; I need to do UI configuration and this is a +;; decent place to do that. - (use-package doom-modeline - :defer t - :commands (doom-modeline-mode) - :custom - (doom-modeline-mode (not (daemonp))) - (doom-modeline-env-load-string "") - :hook ((server-after-make-frame) . my/doom-modeline-for-new-frames) - ;; ^^^^^^^^^^^^^^^^^^^^^^^ this hook is my goat - ) +;;; Code: +(defun init-ui-config () + "Just provide UI configuration." (use-package base16-theme :config - (load-theme 'base16-rose-pine t))) + (load-theme 'base16-rose-pine t)) + (use-package doom-modeline + :custom + (doom-modeline-mode t))) (provide 'config-ui) +;;; config-ui.el ends here diff --git a/config/config.el b/config/config.el index 910afc0..e722c18 100644 --- a/config/config.el +++ b/config/config.el @@ -1,64 +1,62 @@ ;;; config.el --- my emacs configuration -*- lexical-binding: t -*- -;; Author: Artur Manuel -;; URL: https://copeberg.org/amadaluzia/pankomacs -;; Version: 0.0.0 - ;;; Commentary: -;; All this does is provide a configuration for Emacs to use. +;; Not much to gather here. ;;; Code: (require 'config-ui) -(require 'config-dev) -(require 'config-ivy) +(require 'config-org) (require 'config-languages) -(require 'use-package) -(defun config-initialise () - (config-init-dev) - (config-init-ui) - (config-init-languages) - (config-init-ivy) +(defun init-config () + "The actual configuration to initialise at startup." (use-package emacs :init (setq frame-resize-pixelwise t window-resize-pixelwise t frame-inhibit-implied-resize t) - (defun crm-indicator (args) - (cons (format "[CRM%s] %s" - (replace-regexp-in-string - "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" - crm-separator) - (car args)) - (cdr args))) - (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) :custom - (initial-scratch-message nil) - (inhibit-startup-screen t) - (inhibit-splash-screen t) - (menu-bar-mode nil) - (tool-bar-mode nil) - (scroll-bar-mode nil) + ;; vertico setup + (read-extended-command-predicate #'command-completion-default-include-p) + (minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (enable-recursive-buffer t) + (tab-always-indent 'complete) + ;; essentials for me (delete-selection-mode t) (column-number-mode t) - (enable-recursive-buffer t) - (read-extended-command-predicate #'command-completion-default-include-p) - (tab-always-indent 'complete) + ;; get rid of unneeded ui elements + (scroll-bar-mode nil) + (tool-bar-mode nil) + (menu-bar-mode nil) + ;; get rid of the startup screen + (initial-scratch-message nil) + (inhibit-startup-screen t) :hook (prog-mode . display-line-numbers-mode)) - (use-package savehist :defer t :commands (savehist-mode) :custom - (savehist-mode t))) + (savehist-mode t)) + (use-package ibuffer + :bind ("C-x C-b" . ibuffer)) + (use-package which-key + :custom + (which-key-mode t)) + (use-package icomplete + :custom + (fido-mode t) + (icomplete-vertical-mode t)) + (use-package flycheck + :custom + (global-flycheck-mode t)) + (init-ui-config) + (init-org-config) + (init-languages-config)) -(add-hook #'after-init-hook #'config-initialise) +(init-config) (provide 'config) - ;;; config.el ends here diff --git a/flake.lock b/flake.lock index 4c4e4c0..4122efa 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1743991507, - "narHash": "sha256-sRyA1LOsRSeF8W2drXEuGU2U+actcYEKdk1f+2kDKb8=", + "lastModified": 1746116666, + "narHash": "sha256-OVk7gw5B9BTpIK+zV1gMObiO6ERnM2iBv1qCd+mB8dk=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "ac8af15c5f586879c08cd257b69749f791d94e68", + "rev": "d496a053874af07a757eec3e26b4f3cb918aae9f", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1743827369, - "narHash": "sha256-rpqepOZ8Eo1zg+KJeWoq1HAOgoMCDloqv5r2EAa9TSA=", + "lastModified": 1745930157, + "narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=", "owner": "nixos", "repo": "nixpkgs", - "rev": "42a1c966be226125b48c384171c44c651c236c22", + "rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae", "type": "github" }, "original": { @@ -39,11 +39,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1743813633, - "narHash": "sha256-BgkBz4NpV6Kg8XF7cmHDHRVGZYnKbvG0Y4p+jElwxaM=", + "lastModified": 1746055187, + "narHash": "sha256-3dqArYSMP9hM7Qpy5YWhnSjiqniSaT2uc5h2Po7tmg0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7819a0d29d1dd2bc331bec4b327f0776359b1fa6", + "rev": "3e362ce63e16b9572d8c2297c04f7c19ab6725a5", "type": "github" }, "original": { diff --git a/lib.nix b/lib.nix index a11bf7a..7fd21ba 100644 --- a/lib.nix +++ b/lib.nix @@ -18,19 +18,12 @@ let epkgs: builtins.attrValues { inherit (epkgs) - spacious-padding - doom-modeline - ivy - counsel - swiper base16-theme + doom-modeline nix-ts-mode - haskell-mode - qml-mode - tuareg - nushell-mode - nim-mode - envrc + flycheck + org-bullets + org-modern ; treesit-grammars = epkgs.treesit-grammars.with-all-grammars; config = epkgs.trivialBuild { From 6e25f44300e6b20fe591c59ecd32ac3ebf2b7bdd Mon Sep 17 00:00:00 2001 From: Artur Manuel Date: Sat, 3 May 2025 19:12:11 +0100 Subject: [PATCH 2/2] refactor: remake pankomacs --- README.org | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.org b/README.org index bc065a3..9938624 100644 --- a/README.org +++ b/README.org @@ -1,5 +1,5 @@ #+title: Pankomacs -#+options: num:nil +#+options: toc:nil num:nil #+html: @@ -26,15 +26,15 @@ like this: You can then, for example, use it in your NixOS configuration by using this in your NixOS configuration: #+begin_src nix - {inputs, pkgs, ...}: { - services.emacs = { - enable = true; - package = inputs.pankomacs.lib.mkPankomacs { - inherit pkgs; - emacs = pkgs.emacs-pgtk; # non-specific - }; +{ inputs, pkgs, ... }: { + services.emacs = { + enable = true; + package = inputs.pankomacs.lib.mkPankomacs { + inherit pkgs; + emacs = pkgs.emacs-pgtk; # non-specific }; - } + }; +} #+end_src * Where did the name come from?