Add golden-ratio to Emacs configuration

This commit is contained in:
Tom Willemse 2023-10-12 17:03:21 -07:00
parent cb16d6af61
commit 3712c888b7
3 changed files with 74 additions and 3 deletions

View file

@ -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)

View file

@ -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.")))

View file

@ -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))))