From 1fd9b5aa809d2163752ec57663ce8715a4bd7520 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 5 Feb 2024 23:41:14 -0800 Subject: [PATCH] Add my yaml-mode configuration for Emacs --- oni/home/config/rincewind.scm | 4 +- oni/home/services/emacs/init.el | 1 + oni/packages/emacs-config.scm | 21 +++- oni/packages/emacs.scm | 165 ++++++++++++++++++++++++++++---- 4 files changed, 170 insertions(+), 21 deletions(-) diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index 9d9e83a..8bde8ff 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -189,7 +189,8 @@ emacs-oni-sh emacs-oni-shr emacs-oni-tramp - emacs-oni-embrace)) + emacs-oni-embrace + emacs-oni-yaml)) #:use-module ((oni packages hlwm-run-or-raise) #:select (hlwm-run-or-raise)) #:use-module ((oni packages inbox-size) @@ -316,6 +317,7 @@ emacs-oni-sh emacs-oni-shr emacs-oni-tramp + emacs-oni-yaml tree-sitter-bash tree-sitter-scheme diff --git a/oni/home/services/emacs/init.el b/oni/home/services/emacs/init.el index b628c81..3cf23d2 100644 --- a/oni/home/services/emacs/init.el +++ b/oni/home/services/emacs/init.el @@ -50,3 +50,4 @@ (with-eval-after-load 'electric (add-hook 'electric-quote-inhibit-functions #'oni-in-word-p)) +(with-eval-after-load 'yaml-mode (require 'oni-yaml)) diff --git a/oni/packages/emacs-config.scm b/oni/packages/emacs-config.scm index 74af445..16faa3e 100644 --- a/oni/packages/emacs-config.scm +++ b/oni/packages/emacs-config.scm @@ -12,7 +12,7 @@ #:use-module (oni packages emacs)) (define-public emacs-oni-config - (let ((commit "3b26004f8bffea707487b0a332381b59362143d4") + (let ((commit "68d911f08d5e6559f20c89eadcc8741bf6d3f5e1") (revision "0")) (package (name "emacs-oni-config") @@ -25,7 +25,7 @@ (commit commit))) (file-name (git-file-name name version)) (sha256 - (base32 "105rflg55wi8ms8qhxqjycpj81chqq6cswannvyjjfqjl54rffyp")))) + (base32 "190jzwq00c1pw15jri4qfp2ad44ykl1ax1jnq8k1fyki7p8z82b7")))) (build-system emacs-build-system) (home-page "https://code.ryuslash.org/ryuslash/emacs-config") (synopsis "My Emacs configuration") @@ -875,3 +875,20 @@ Emacs"))) emacs-magit)) (synopsis "My configuration for git-commit-mode") (description "This package provides my configuration for git-commit-mode."))) + +(define-public emacs-oni-yaml + (package + (inherit emacs-oni-config) + (name "emacs-oni-yaml") + (arguments + '(#:include '("oni-yaml\\.el$"))) + (propagated-inputs + (list + emacs-yaml-mode + emacs-oni-flycheck + emacs-oni-highlight-indent-guides + emacs-indent-tools + emacs-yaml-imenu + emacs-yaml-pro)) + (synopsis "My configuration for yaml-mode.") + (description "This package provides my configuration for editing Yaml files."))) diff --git a/oni/packages/emacs.scm b/oni/packages/emacs.scm index d051226..a982bf6 100644 --- a/oni/packages/emacs.scm +++ b/oni/packages/emacs.scm @@ -9,7 +9,9 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages emacs-xyz) #:use-module ((gnu packages mail) - #:select (notmuch))) + #:select (notmuch)) + #:use-module (gnu packages ruby) + #:use-module (rosenthal packages tree-sitter)) (define-public emacs-ace-link-notmuch (let ((commit "fb09673881ef0f7b7ad744c576a19f578df7c51d") @@ -324,27 +326,80 @@ 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)))) +(define-public emacs-indent-bars + (package + (name "emacs-indent-bars") + (version "0.2.3") + (source + (origin + (uri (git-reference + (url "https://github.com/jdtsmith/indent-bars") + (commit (string-append "v" version)))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "0mis93rh01i1zk8bix79l3q46zrfwlkpq1c1l6msng22ydxs1mw1")))) + (build-system emacs-build-system) + (propagated-inputs + (list emacs-compat)) + (home-page "https://github.com/jdtsmith/indent-bars") + (synopsis "Fast, configurable indentation guide-bars for Emacs.") + (description "This package provides vertical indentation guide bars") + (license license:gpl3+))) + +(define-public emacs-indent-tools + (let ((commit "c731f05fa3950e2e8580ec61b88abbc705639830") + (revision "0")) + (package + (name "emacs-indent-tools") + (version (git-version "0.0.0" revision commit)) + (source + (origin + (uri (git-reference + (url "https://gitlab.com/emacs-stuff/indent-tools.git") + (commit commit))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "0jri2vxd5a4sx93xq6kjcc5zx9yrhv789x3lyq6r2p2422diw2jr")))) + (build-system emacs-build-system) + (propagated-inputs + (list emacs-s + emacs-hydra + emacs-yafolding)) + (home-page "https://gitlab.com/emacs-stuff/indent-tools/") + (synopsis "Indent, navigate around and act on indentation units: perfect for yaml, python +and the like.") + (description "Indent, move around and act on code based on indentation (yaml, + python, jade, etc). + +Meant for indentation-based languages, but can be used any time with indented +text.") + ;; I'm not sure this license is correct, there doesn't seem to be a wtfpl + ;; v1 in the licenses file. + (license license:wtfpl2)))) + (define-public emacs-inkplate (let ((commit "0897721a7b3d84aa3f200ae85fddd5fdd370fc42") (revision "0")) (package - (name "emacs-inkplate") - (version (git-version "0.0.1" revision commit)) - (source - (origin - (uri (git-reference - (url "https://git.sr.ht/~ryuslash/inkplatel") - (commit commit))) - (method git-fetch) - (sha256 - (base32 "0mqnpf4vrzn3013pcwcr9150k4jy4klrdg0pd3amhg2y25054w4s")) - (file-name (git-file-name name version)))) - (build-system emacs-build-system) - (synopsis "Interface for my Inkplate") - (description - "This package provides a way to communicate with Inkplate in peripheral mode.") - (license license:gpl3+) - (home-page "https://sr.ht/~ryuslash/inkplate/")))) + (name "emacs-inkplate") + (version (git-version "0.0.1" revision commit)) + (source + (origin + (uri (git-reference + (url "https://git.sr.ht/~ryuslash/inkplatel") + (commit commit))) + (method git-fetch) + (sha256 + (base32 "0mqnpf4vrzn3013pcwcr9150k4jy4klrdg0pd3amhg2y25054w4s")) + (file-name (git-file-name name version)))) + (build-system emacs-build-system) + (synopsis "Interface for my Inkplate") + (description + "This package provides a way to communicate with Inkplate in peripheral mode.") + (license license:gpl3+) + (home-page "https://sr.ht/~ryuslash/inkplate/")))) (define-public emacs-insert-char-preview (let ((commit "0e4a62b5407fb1bed8920a4c13cf9a91065e15ad") @@ -447,6 +502,80 @@ Syncthing REST API and request package to get this data and display it in an Emacs buffer.") (license license:expat)))) +(define-public emacs-yafolding + (package + (name "emacs-yafolding") + (version "0.4.1") + (source + (origin + (uri (git-reference + (url "https://github.com/emacsorphanage/yafolding") + (commit (string-append "v" version)))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "1bb763lx5cs5z06irjllip8z9c61brjsamfcjajibi24wcajkprx")))) + (build-system emacs-build-system) + (home-page "https://github.com/emacsorphanage/yafolding") + (synopsis "Yet another folding extension for Emacs") + (description "Folding code blocks based on indentation.") + (license license:gpl3+))) + +(define-public emacs-yaml-imenu + (let ((commit "c1fbba8b03a7bef4fc2b87404914fa9c6eb67b55") + (revision "0")) + (package + (name "emacs-yaml-imenu") + (version (git-version "1.0.3" revision commit)) + (source + (origin + (uri (git-reference + (url "https://github.com/knu/yaml-imenu.el") + (commit commit))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "1p5zyjj9hvqjfhyp68c04w6cxj5qh4psd4y8kafyrz3n05wimzl5")))) + (build-system emacs-build-system) + (inputs + (list ruby + emacs-yaml-mode)) + (home-page "https://github.com/knu/yaml-imenu.el") + (synopsis "Enhancement for the imenu support in yaml-mode") + (description "This package enhances the imenu support in yaml-mode. It generates an index +containing a full list of keys that contain any child, with key names in the +dot-separated path form like @code{jobs.build.docker} and +@code{ja.activerecord.attributes.user.nickname}. It shines best with +@code{which-function-mode} enabled.") + (license license:bsd-2)))) + +(define-public emacs-yaml-pro + (package + (name "emacs-yaml-pro") + (version "0.3.4") + (source + (origin + (uri (git-reference + (url "https://github.com/zkry/yaml-pro") + (commit (string-append "v" version)))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "0zz8cl400grdip8c2jl27sf4prysyg0rcp91kah6qghmns87f3z9")))) + (build-system emacs-build-system) + (propagated-inputs + (list emacs-yaml + tree-sitter-yaml)) + (home-page "https://github.com/zkry/yaml-pro") + (synopsis "Edit YAML in Emacs like a pro") + (description "yaml-pro is a package that provides conveniences for editing yaml. + +This package has been written to leverage tree-sitter parsing facilities, +allowing all of these actions to be performed fast and accurate, even in the +absence of parsing errors. The tree-sitter version is orders of magnitudes +faster and I highly recommend its usage if your Emacs version permits.") + (license license:gpl3+))) + (define-public emacs-yasnippet-capf (let ((commit "40654214db7a44db3a99321447632b43a10fae57") (revision "0"))