From 2971dd2dc7622b79cd0620de7edcecc4937313d4 Mon Sep 17 00:00:00 2001 From: materus Date: Wed, 30 Oct 2024 22:06:16 +0100 Subject: [PATCH] configurations: emacs changes 2 --- .../host/materusPC/home/materus/default.nix | 2 +- configurations/profile/home/shell/zsh.nix | 2 ++ .../config/emacs/etc/materus/internals.el | 6 ++---- extraFiles/config/emacs/etc/materus/lsp/cpp.el | 5 +++++ .../etc/materus/{lsp.el => lsp/default.el} | 18 ++++-------------- .../config/emacs/etc/materus/lsp/java.el | 1 + .../config/emacs/etc/materus/lsp/lisp.el | 2 ++ extraFiles/config/emacs/etc/materus/lsp/nix.el | 2 ++ extraFiles/config/emacs/etc/materus/start.el | 9 +++++++-- extraFiles/config/emacs/init.el | 2 +- 10 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 extraFiles/config/emacs/etc/materus/lsp/cpp.el rename extraFiles/config/emacs/etc/materus/{lsp.el => lsp/default.el} (78%) create mode 100644 extraFiles/config/emacs/etc/materus/lsp/java.el create mode 100644 extraFiles/config/emacs/etc/materus/lsp/lisp.el create mode 100644 extraFiles/config/emacs/etc/materus/lsp/nix.el diff --git a/configurations/host/materusPC/home/materus/default.nix b/configurations/host/materusPC/home/materus/default.nix index 1331d49..17318da 100644 --- a/configurations/host/materusPC/home/materus/default.nix +++ b/configurations/host/materusPC/home/materus/default.nix @@ -17,7 +17,7 @@ enableTerminal = lib.mkDefault true; enableTerminalExtra = lib.mkDefault true; enableNixDevel = lib.mkDefault true; - editor.emacs.enable = true; + editor.emacs.enable = false; editor.code.fhs.enable = true; editor.code.fhs.packages = (ps: with ps; let llvmpkgs = llvmPackages_18; in [ llvmpkgs.clang diff --git a/configurations/profile/home/shell/zsh.nix b/configurations/profile/home/shell/zsh.nix index 5c9b389..064d60f 100644 --- a/configurations/profile/home/shell/zsh.nix +++ b/configurations/profile/home/shell/zsh.nix @@ -163,6 +163,8 @@ in speedtest() { ${lib.getExe pkgs.curl} -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | ${lib.getExe pkgs.python3} } + ${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "e"="emacsclient -nw -c --alternate-editor= "''} + '' + diff --git a/extraFiles/config/emacs/etc/materus/internals.el b/extraFiles/config/emacs/etc/materus/internals.el index d30d1fd..e2b551c 100644 --- a/extraFiles/config/emacs/etc/materus/internals.el +++ b/extraFiles/config/emacs/etc/materus/internals.el @@ -52,11 +52,9 @@ ) - +(xterm-mouse-mode 1) (setq read-process-output-max (* 1024 1024 3)) -(when (or (not (display-graphic-p)) (daemonp)) - (xterm-mouse-mode 1) - ) + (setq ring-bell-function 'ignore) diff --git a/extraFiles/config/emacs/etc/materus/lsp/cpp.el b/extraFiles/config/emacs/etc/materus/lsp/cpp.el new file mode 100644 index 0000000..d9d1c1e --- /dev/null +++ b/extraFiles/config/emacs/etc/materus/lsp/cpp.el @@ -0,0 +1,5 @@ +(add-hook 'c-mode-hook 'lsp-deferred) +(add-hook 'c-mode-hook 'display-line-numbers-mode) + +(add-hook 'c++-mode-hook 'lsp-deferred) +(add-hook 'c++-mode-hook 'display-line-numbers-mode) diff --git a/extraFiles/config/emacs/etc/materus/lsp.el b/extraFiles/config/emacs/etc/materus/lsp/default.el similarity index 78% rename from extraFiles/config/emacs/etc/materus/lsp.el rename to extraFiles/config/emacs/etc/materus/lsp/default.el index 1707ec8..0057816 100644 --- a/extraFiles/config/emacs/etc/materus/lsp.el +++ b/extraFiles/config/emacs/etc/materus/lsp/default.el @@ -42,21 +42,11 @@ :priority 0 :server-id 'nixd))) - -;; Hooks -(add-hook 'c-mode-hook 'lsp-deferred) -(add-hook 'c-mode-hook 'display-line-numbers-mode) - -(add-hook 'c++-mode-hook 'lsp-deferred) -(add-hook 'c++-mode-hook 'display-line-numbers-mode) +(load (concat materus/cfg "/lsp/cpp")) +(load (concat materus/cfg "/lsp/java")) +(load (concat materus/cfg "/lsp/nix")) +(load (concat materus/cfg "/lsp/lisp")) -(add-hook 'nix-mode-hook 'lsp-deferred) -(add-hook 'nix-mode-hook 'display-line-numbers-mode) -(add-hook 'java-mode-hook 'lsp-deferred) -(add-hook 'nix-mode-hook 'display-line-numbers-mode) - -(add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode) -(add-hook 'emacs-lisp-mode-hook 'company-mode) diff --git a/extraFiles/config/emacs/etc/materus/lsp/java.el b/extraFiles/config/emacs/etc/materus/lsp/java.el new file mode 100644 index 0000000..3a7bf03 --- /dev/null +++ b/extraFiles/config/emacs/etc/materus/lsp/java.el @@ -0,0 +1 @@ +(add-hook 'java-mode-hook 'lsp-deferred) diff --git a/extraFiles/config/emacs/etc/materus/lsp/lisp.el b/extraFiles/config/emacs/etc/materus/lsp/lisp.el new file mode 100644 index 0000000..d6effe6 --- /dev/null +++ b/extraFiles/config/emacs/etc/materus/lsp/lisp.el @@ -0,0 +1,2 @@ +(add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode) +(add-hook 'emacs-lisp-mode-hook 'company-mode) diff --git a/extraFiles/config/emacs/etc/materus/lsp/nix.el b/extraFiles/config/emacs/etc/materus/lsp/nix.el new file mode 100644 index 0000000..560dbc0 --- /dev/null +++ b/extraFiles/config/emacs/etc/materus/lsp/nix.el @@ -0,0 +1,2 @@ +(add-hook 'nix-mode-hook 'lsp-deferred) +(add-hook 'nix-mode-hook 'display-line-numbers-mode) diff --git a/extraFiles/config/emacs/etc/materus/start.el b/extraFiles/config/emacs/etc/materus/start.el index 78e3041..2f900f8 100644 --- a/extraFiles/config/emacs/etc/materus/start.el +++ b/extraFiles/config/emacs/etc/materus/start.el @@ -25,7 +25,12 @@ (tool-bar-mode -1) -(load-theme 'doom-horizon t) +(if (daemonp) + (add-hook 'after-make-frame-functions + (lambda (frame) + (with-selected-frame frame (load-theme 'doom-horizon t)))) + (load-theme 'doom-horizon t)) + (setq-default cursor-type '(bar . 1)) (pixel-scroll-precision-mode 1) @@ -93,4 +98,4 @@ ;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207))) -(load (concat materus/cfg "/lsp")) +(load (concat materus/cfg "/lsp/default")) diff --git a/extraFiles/config/emacs/init.el b/extraFiles/config/emacs/init.el index b9fd27f..a565857 100644 --- a/extraFiles/config/emacs/init.el +++ b/extraFiles/config/emacs/init.el @@ -1,4 +1,4 @@ -(setq-default materus/nix-packages (require 'doom-themes nil 'noerror)) +(setq-default materus/nix-packages (require 'evil nil 'noerror)) (unless materus/nix-packages (load (concat user-emacs-directory "etc/materus/packages"))) (load (concat user-emacs-directory "etc/materus/internals")) (load (concat user-emacs-directory "etc/materus/start"))