From 68c02950eadf2bc8a301c7d27fb689d68858dcef Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 31 Mar 2023 14:41:09 +0200 Subject: [PATCH 1/2] Use built-in tree-sitter on emacs >=29, minor cleanup --- home-manager/modules/emacs/config.org | 14 ++++++++------ home-manager/modules/emacs/default.nix | 13 +++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/home-manager/modules/emacs/config.org b/home-manager/modules/emacs/config.org index 1fe7424..f324f1b 100644 --- a/home-manager/modules/emacs/config.org +++ b/home-manager/modules/emacs/config.org @@ -866,14 +866,15 @@ Visualise git changes in the gutter, next to the line numbers *** Tree-sitter -[[https://tree-sitter.github.io/][tree-sitter]] is a new development in parsing and syntax highlighting. There is [[https://www.reddit.com/r/emacs/comments/pxpq8d/rfc_emacs_treesitter_integration/][an effort underway]] to get it into Emacs core, but for now we're using the [[https://emacs-tree-sitter.github.io/][emacs-tree-sitter]] package. +[[https://tree-sitter.github.io/][tree-sitter]] is a new development in parsing and syntax highlighting. It has been merged into Emacs 29, but until that's released we're using the [[https://emacs-tree-sitter.github.io/][emacs-tree-sitter]] package while on Emacs 28. #+begin_src emacs-lisp - (use-package tree-sitter + (when (< emacs-major-version 29) + (use-package tree-sitter :config (global-tree-sitter-mode) :ghook - ('tree-sitter-after-on-hook #'tree-sitter-hl-mode)) + ('tree-sitter-after-on-hook #'tree-sitter-hl-mode))) #+end_src [[https://github.com/emacs-tree-sitter/tree-sitter-langs][tree-sitter-langs]] provides =tree-sitter= support for a bunch of languages. @@ -976,12 +977,14 @@ Visualise git changes in the gutter, next to the line numbers (find-file-existing filename)))) #+end_src -*** Snippets +** Snippets Snippets are predefined pieces of code that can be inserted and filled in. [[https://github.com/joaotavora/yasnippet][YASnippet]] uses syntax inspired by TextMate is the most popular, for good reason. #+begin_src emacs-lisp (use-package yasnippet + :init + (load "yasnippet.el") :diminish t :general (:keymaps 'yas-minor-mode-map @@ -990,8 +993,7 @@ Snippets are predefined pieces of code that can be inserted and filled in. [[htt "" 'yas-expand) :config (add-to-list 'yas-snippet-dirs my/snippets-dir) - (yas-global-mode) - :diminish yas-minor-mode) + (yas-global-mode)) (use-package yasnippet-snippets) #+end_src diff --git a/home-manager/modules/emacs/default.nix b/home-manager/modules/emacs/default.nix index 20a97ba..2f9a6a3 100644 --- a/home-manager/modules/emacs/default.nix +++ b/home-manager/modules/emacs/default.nix @@ -7,7 +7,6 @@ with lib; let cfg = config.eboskma.programs.emacs; emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage { - # config = ./config.org; config = let tangledOrgConfig = pkgs.runCommand "tangled-emacs-config" { } '' @@ -35,7 +34,6 @@ with lib; let categories = [ "Development" "TextEditor" ]; keywords = [ "org-protocol" ]; type = "Application"; - # exec = "${cfg.package}/bin/emacsclient -- %u"; exec = "${emacsWithPackages}/bin/emacsclient -- %u"; terminal = false; mimeTypes = [ "x-scheme-handler/org-protocol" ]; @@ -46,11 +44,7 @@ in options.eboskma.programs.emacs = { enable = mkEnableOption "activate emacs"; - package = mkOption { - description = "The emacs package to install"; - type = types.package; - default = pkgs.emacs; - }; + package = mkPackageOption pkgs "emacs" { }; daemon = mkOption { description = "Whether to enable emacs daemon"; @@ -63,13 +57,11 @@ in config = mkIf cfg.enable { programs.emacs = { enable = true; - # package = cfg.package; package = emacsWithPackages; }; services.emacs = mkIf cfg.daemon { enable = true; - # package = cfg.package; package = emacsWithPackages; client.enable = true; socketActivation.enable = true; @@ -86,7 +78,8 @@ in python3 lldb ] ++ - (with aspellDicts; [ en en-computers en-science fy nl ]); + (with aspellDicts; [ en en-computers en-science fy nl ]) ++ + (lib.optional (versionOlder cfg.package.version "29") (tree-sitter.withPlugins builtins.attrValues)); }; } From 5b732ff85adbae40745f0a49272ae8079f28b2d9 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Fri, 31 Mar 2023 15:53:33 +0200 Subject: [PATCH 2/2] Update flake.lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated input 'disko': 'github:nix-community/disko/eb5def310c7331545e72090b4cda6cb0255b870d' (2023-03-24) → 'github:nix-community/disko/4d9c89abde7ccedf743a01119d41fb880793bcba' (2023-03-30) • Updated input 'emacs-overlay': 'github:nix-community/emacs-overlay/f03b172233e1bf1fb2ffbc543b86aae00fbad444' (2023-03-24) → 'github:nix-community/emacs-overlay/cfec7f9501cc0e001f49d725a7cd733af7deb2ed' (2023-03-31) • Updated input 'home-manager': 'github:nix-community/home-manager/363c46b2480f1b73ec37cf68caac61f5daa82a2e' (2023-03-22) → 'github:nix-community/home-manager/67b97020b6970d39b4126a7870063d11337ecb80' (2023-03-31) • Updated input 'nil': 'github:oxalica/nil/73fda843416741f870a97c23867f27efb9fd9f20' (2023-03-24) → 'github:oxalica/nil/0718fca59b82e53aef07699db7e1bbd86ba8dacf' (2023-03-30) • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/648021dcb2b65498eed3ea3a7339cdfc3bea4d82' (2023-03-23) → 'github:NixOS/nixos-hardware/a6aa8174fa61e55bd7e62d35464d3092aefe0421' (2023-03-29) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e' (2023-03-21) → 'github:nixos/nixpkgs/9a6aabc4740790ef3bbb246b86d029ccf6759658' (2023-03-29) • Updated input 'nomachine': 'github:rytec-nl/nixpkgs/a312461214aa64253b74bd31f0d4a32cd029a932' (2022-08-04) → 'github:rytec-nl/nixpkgs/1378a89625f1f98e77920dc3e6f899a16f20f9be' (2023-03-26) • Updated input 'pre-commit-hooks': 'github:cachix/pre-commit-hooks.nix/32b1dbedfd77892a6e375737ef04d8efba634e9e' (2023-03-16) → 'github:cachix/pre-commit-hooks.nix/29dbe1efaa91c3a415d8b45d62d48325a4748816' (2023-03-30) • Updated input 'rust-overlay': 'github:oxalica/rust-overlay/afbdcf305fd6f05f708fe76d52f24d37d066c251' (2023-03-24) → 'github:oxalica/rust-overlay/aa480d799023141e1b9e5d6108700de63d9ad002' (2023-03-31) • Updated input 'sops': 'github:Mic92/sops-nix/d8827a8368c307fbc6ed594c9a31d619e7360bed' (2023-03-21) → 'github:Mic92/sops-nix/5b26523e28989a7f56953b695184070c06335814' (2023-03-28) • Updated input 'sops/nixpkgs-stable': 'github:NixOS/nixpkgs/c3912035d00ef755ab19394488b41feab95d2e40' (2023-03-18) → 'github:NixOS/nixpkgs/da26ae9f6ce2c9ab380c0f394488892616fc5a6a' (2023-03-25) --- flake.lock | 66 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/flake.lock b/flake.lock index b60ca71..3e59dcb 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1679643957, - "narHash": "sha256-umr+j/0b3DXQO4VnhRwAJYS0Y2fW64I+ydHnZqpN/Pc=", + "lastModified": 1680146283, + "narHash": "sha256-YZSw3O6uv6NqOJP+dol/njmzblRFIsrmqqb0HsL4mcQ=", "owner": "nix-community", "repo": "disko", - "rev": "eb5def310c7331545e72090b4cda6cb0255b870d", + "rev": "4d9c89abde7ccedf743a01119d41fb880793bcba", "type": "github" }, "original": { @@ -30,11 +30,11 @@ ] }, "locked": { - "lastModified": 1679649158, - "narHash": "sha256-RWsxTBWQwdoCihH0NOZjIFbv56Pe4whXt4zxSAfTlPo=", + "lastModified": 1680257010, + "narHash": "sha256-pNMB9sdoZOXEsszLD5TS0WG5Ysj2rVRmf92uxsxH/9A=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "f03b172233e1bf1fb2ffbc543b86aae00fbad444", + "rev": "cfec7f9501cc0e001f49d725a7cd733af7deb2ed", "type": "github" }, "original": { @@ -158,11 +158,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1679480702, - "narHash": "sha256-npuRD61YmxUPitI1TqKwlxLrU6iGl5E+BPT196LgUDo=", + "lastModified": 1680249941, + "narHash": "sha256-7Ylr0NAr8msd3YVaYBw6uyJIRbtOq5l6aLrmrYA5qTw=", "owner": "nix-community", "repo": "home-manager", - "rev": "363c46b2480f1b73ec37cf68caac61f5daa82a2e", + "rev": "67b97020b6970d39b4126a7870063d11337ecb80", "type": "github" }, "original": { @@ -228,11 +228,11 @@ ] }, "locked": { - "lastModified": 1679638715, - "narHash": "sha256-xo6aA+VZ+ssMqAi3w0EEWqpY/a/enkkC0Bc041qBC0Y=", + "lastModified": 1680185050, + "narHash": "sha256-MtyaP3j1yxwrqPFUsLD0qFyyH7d/h0D/whfErxS2UFM=", "owner": "oxalica", "repo": "nil", - "rev": "73fda843416741f870a97c23867f27efb9fd9f20", + "rev": "0718fca59b82e53aef07699db7e1bbd86ba8dacf", "type": "github" }, "original": { @@ -263,11 +263,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1679598117, - "narHash": "sha256-Vs1f/7imI77OkMOQhO3xgx4jalN2Gx3D3C2wmnlpWJM=", + "lastModified": 1680070330, + "narHash": "sha256-aoT2YZCd9LEtiEULFLIF0ykKydgE72X8gw/k9/pRS5I=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "648021dcb2b65498eed3ea3a7339cdfc3bea4d82", + "rev": "a6aa8174fa61e55bd7e62d35464d3092aefe0421", "type": "github" }, "original": { @@ -278,11 +278,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1679437018, - "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "lastModified": 1680125544, + "narHash": "sha256-mlqo1r+TZUOuypWdrZHluxWL+E5WzXlUXNZ9Y0WLDFU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "rev": "9a6aabc4740790ef3bbb246b86d029ccf6759658", "type": "github" }, "original": { @@ -310,11 +310,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1679163677, - "narHash": "sha256-VC0tc3EjJZFPXgucFQAYMIHce5nJWYR0kVCk4TVg6gg=", + "lastModified": 1679748960, + "narHash": "sha256-BP8XcYHyj1NxQi04RpyNW8e7KiXSoI+Fy1tXIK2GfdA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c3912035d00ef755ab19394488b41feab95d2e40", + "rev": "da26ae9f6ce2c9ab380c0f394488892616fc5a6a", "type": "github" }, "original": { @@ -326,11 +326,11 @@ }, "nomachine": { "locked": { - "lastModified": 1659604761, - "narHash": "sha256-7ng6alhIrbJsdnmmMzUeO1YrrorRH7WN6RFyfW/z2Bo=", + "lastModified": 1679842052, + "narHash": "sha256-3yihebiVQc8CGrP4BtDd4WGfcfigG5Fz0Mqkdbb6I8A=", "owner": "rytec-nl", "repo": "nixpkgs", - "rev": "a312461214aa64253b74bd31f0d4a32cd029a932", + "rev": "1378a89625f1f98e77920dc3e6f899a16f20f9be", "type": "github" }, "original": { @@ -380,11 +380,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1678976941, - "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", + "lastModified": 1680170909, + "narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", + "rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816", "type": "github" }, "original": { @@ -441,11 +441,11 @@ ] }, "locked": { - "lastModified": 1679624450, - "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "lastModified": 1680229280, + "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "rev": "aa480d799023141e1b9e5d6108700de63d9ad002", "type": "github" }, "original": { @@ -462,11 +462,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1679377997, - "narHash": "sha256-O8rmc/b/qgNgoHj2tL5+3Ovkj7A+Sok7gazRoWbpnqg=", + "lastModified": 1679993313, + "narHash": "sha256-pfZ/BxJDTifnQBMXg60OhwpJvg96LHvEXGtpHeGcWLM=", "owner": "Mic92", "repo": "sops-nix", - "rev": "d8827a8368c307fbc6ed594c9a31d619e7360bed", + "rev": "5b26523e28989a7f56953b695184070c06335814", "type": "github" }, "original": {