From 3712c888b7c2956a2348177ffc6e816481d63591 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 12 Oct 2023 17:03:21 -0700 Subject: Add golden-ratio to Emacs configuration --- oni/home/config/rincewind.scm | 4 +++- oni/home/services/emacs.scm | 45 +++++++++++++++++++++++++++++++++++++++++-- oni/packages/emacs.scm | 28 +++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) (limited to 'oni') diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index b28bc25..4592104 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -76,7 +76,8 @@ home-emacs-dashboard-configuration home-emacs-eros-service-type home-emacs-ace-link-service-type - home-emacs-ace-link-configuration)) + home-emacs-ace-link-configuration + home-emacs-golden-ratio-service-type)) #:use-module ((oni home services environment) #:select (home-environment-service)) #:use-module ((oni home services flameshot) @@ -427,6 +428,7 @@ (default-key "C-S-e") (goto-address-key "C-S-e") (org-mode-key "C-S-e"))) + (service home-emacs-golden-ratio-service-type) (service home-flameshot-service-type) diff --git a/oni/home/services/emacs.scm b/oni/home/services/emacs.scm index 360ce3b..12c62d7 100644 --- a/oni/home/services/emacs.scm +++ b/oni/home/services/emacs.scm @@ -30,7 +30,8 @@ #:use-module ((guix packages) #:select (package?)) #:use-module ((oni packages emacs) - #:select (emacs-yasnippet-capf)) + #:select (emacs-yasnippet-capf + emacs-golden-ratio)) #:export (home-emacs-service-type home-emacs-configuration @@ -48,7 +49,10 @@ home-emacs-eros-configuration home-emacs-ace-link-service-type - home-emacs-ace-link-configuration)) + home-emacs-ace-link-configuration + + home-emacs-golden-ratio-service-type + home-emacs-golden-ratio-configuration)) (define-maybe string) @@ -298,3 +302,40 @@ (compose identity) (default-value (home-emacs-ace-link-configuration)) (description "Install and configure emacs-ace-link."))) + +(define-configuration/no-serialization home-emacs-golden-ratio-configuration + (package + (package emacs-golden-ratio) + "Package to use for setting emacs-golden-ratio.") + (configurations + (text-config '()) + "Configuration for emacs-golden-ratio.")) + +(define (add-emacs-golden-ratio-configuration config) + (home-emacs-extension + (configurations + (append + (list (mixed-text-file "golden-ratio-config" + ";;;;; golden-ratio-config starts here.\n" + "(golden-ratio-mode)\n" + "(with-eval-after-load 'ace-window\n" + " (advice-add 'ace-window :after #'golden-ratio))\n" + ";;;;; golden-ratio-config ends here.\n")) + (home-emacs-golden-ratio-configuration-configurations config))))) + +(define (add-emacs-golden-ratio-packages config) + (list (home-emacs-golden-ratio-configuration-package config))) + +(define home-emacs-golden-ratio-service-type + (service-type + (name 'home-emacs-golden-ratio) + (extensions + (list (service-extension + home-emacs-service-type + add-emacs-golden-ratio-configuration) + (service-extension + home-profile-service-type + add-emacs-golden-ratio-packages))) + (compose identity) + (default-value (home-emacs-golden-ratio-configuration)) + (description "Install and configure emacs-golden-ratio."))) diff --git a/oni/packages/emacs.scm b/oni/packages/emacs.scm index 9d488e4..ad6ee92 100644 --- a/oni/packages/emacs.scm +++ b/oni/packages/emacs.scm @@ -444,3 +444,31 @@ new-theme for a while. I couldn't think of a name so I named it after him.") (description "This package provides an Emacs-based interface to the Notmuch mail system."))) + +(define-public emacs-golden-ratio + (let ((commit "375c9f287dfad68829582c1e0a67d0c18119dab9") + (revision "0")) + (package + (name "emacs-golden-ratio") + (version (git-version "1.0.0" revision commit)) + (source + (origin + (uri (git-reference + (url "https://github.com/roman/golden-ratio.el.git") + (commit commit))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "0a635a3h6jx0clgwmhwc48i14y3xy5q29y37lp2sjnbxx1hlmkli")))) + (build-system emacs-build-system) + (home-page "https://github.com/roman/golden-ratio.el") + (synopsis "Automatic resizing of Emacs windows to the golden ratio") + (description "When working with many windows at the same time, each window has a size that is +not convenient for editing. + +golden-ratio helps on this issue by resizing automatically the windows you are +working on to the size specified in the \"Golden Ratio\". The window that has +the main focus will have the perfect size for editing, while the ones that are +not being actively edited will be re-sized to a smaller size that doesn't get in +the way, but at the same time will be readable enough to know it's content.") + (license license:expat)))) -- cgit v1.2.3-54-g00ecf