about summary refs log tree commit diff
path: root/modules/common/emacs
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-23 04:20:34 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-23 04:20:34 +0300
commit67b82386d8ad8ae3eea5083bd22809f6192d92a8 (patch)
tree41829a0b3e05a9dbb4b0189e34a7b53e401f489e /modules/common/emacs
parent2023-11-19 (diff)
2023-11-23
Diffstat (limited to 'modules/common/emacs')
-rw-r--r--modules/common/emacs/default.nix48
1 files changed, 31 insertions, 17 deletions
diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix
index fe2618d..3db4393 100644
--- a/modules/common/emacs/default.nix
+++ b/modules/common/emacs/default.nix
@@ -222,23 +222,37 @@ in {
         };
       };
 
-      programs.emacs = {
-        enable = true;
-        package =
-          (pkgs.emacs29.override (finalAttrs: {
-            stdenv = with pkgs;
-              useMoldLinker
-              (withCFlags ["-O3"]
-                (impureUseNativeOptimizations finalAttrs.stdenv));
-          }))
-          .overrideAttrs (_: final: {
-            configureFlags =
-              final.configureFlags
-              ++ [
-                "--without-mailutils"
-                "--without-pop"
-              ];
-          });
+      programs = {
+        emacs = {
+          enable = true;
+          package =
+            (pkgs.emacs29.override (finalAttrs: {
+              stdenv = pkgs.useMoldLinker finalAttrs.stdenv;
+            }))
+            .overrideAttrs (_: final: {
+              configureFlags =
+                (final.configureFlags or [])
+                ++ [
+                  "--without-mailutils"
+                  "--without-pop"
+                ];
+            });
+        };
+
+        bash.initExtra = mkAfter ''
+          # https://github.com/akermu/emacs-libvterm
+          if [[ "$INSIDE_EMACS" = vterm ]] && [[ -n "$EMACS_VTERM_PATH" ]] && [[ -f "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh" ]]; then
+              source "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh"
+
+              message() {
+                  vterm_cmd message "%s" "$*"
+              }
+
+              find-file() {
+                  vterm_cmd find-file "$(realpath "''${@:-.}")"
+              }
+          fi
+        '';
       };
     };
   };

Consider giving Nix/NixOS a try! <3