From 1c82c0ccf491a2fafe22dbbef29b8073fcda8a5a Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Fri, 6 Jun 2025 16:20:37 -0700 Subject: [PATCH] merge from voltus-work branch --- custom-lisp/nebkor-personal.el | 7 +++ init.el | 4 +- nebkor-emacs.org | 93 +++++++++++++++++++++++++++-- nebkor-modules/nebkor-essentials.el | 7 ++- nebkor-modules/nebkor-functions.el | 14 +++++ nebkor-modules/nebkor-langs.el | 27 +++++++++ 6 files changed, 142 insertions(+), 10 deletions(-) diff --git a/custom-lisp/nebkor-personal.el b/custom-lisp/nebkor-personal.el index ff0c6c7..732d181 100644 --- a/custom-lisp/nebkor-personal.el +++ b/custom-lisp/nebkor-personal.el @@ -15,4 +15,11 @@ // //-************************************************************************") +(use-package restclient + :ensure t) +(use-package restclient-jq + :ensure t) +(elpaca (1password :host github :repo "kamushadenes/1password.el") + (use-package 1password)) + (provide 'nebkor-personal) diff --git a/init.el b/init.el index 272e183..3c2287b 100644 --- a/init.el +++ b/init.el @@ -28,7 +28,8 @@ '("nebkor-modules" "custom-lisp")) ;;; Install Elpaca -(defvar elpaca-installer-version 0.9) + +(defvar elpaca-installer-version 0.10) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) @@ -43,7 +44,6 @@ (add-to-list 'load-path (if (file-exists-p build) build repo)) (unless (file-exists-p repo) (make-directory repo t) - (when (< emacs-major-version 28) (require 'subr-x)) (condition-case-unless-debug err (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) ((zerop (apply #'call-process `("git" nil ,buffer t "clone" diff --git a/nebkor-emacs.org b/nebkor-emacs.org index 4cea492..5908360 100644 --- a/nebkor-emacs.org +++ b/nebkor-emacs.org @@ -61,6 +61,7 @@ - [[#the-nebkor-essentialsel-section-about-using-tree-sitter-for-marking-expreg][The =nebkor-essentials.el= section about using tree-sitter for marking (~expreg~)]] - [[#the-nebkor-essentialsel-section-for-osx-changes][The =nebkor-essentials.el= section for OSX changes]] - [[#the-nebkor-essentialsel-section-for-simpleel-changes][The =nebkor-essentials.el= section for ~simple.el~ changes]] + - [[#the-nebkor-essentialsel-section-for-better-help-helpful][The =nebkor-essentials.el= section for better help (~helpful~)]] - [[#the-nebkor-essentials-section-for-indent-tools][The =nebkor-essentials= section for ~indent-tools~]] - [[#the-nebkor-essentials-section-for-undo-tree][The =nebkor-essentials= section for ~undo-tree~]] - [[#the-nebkor-essentials-section-for-fancy-keyboard-shortcuts-key-chord][The =nebkor-essentials= section for fancy keyboard shortcuts (~key-chord~)]] @@ -156,6 +157,8 @@ - [[#the-nebkor-langsel-section-for-ziglang-zig-mode][The =nebkor-langs.el= section for Ziglang (~zig-mode~)]] - [[#the-nebkor-langsel-section-for-clojure-programming][The =nebkor-langs.el= section for Clojure programming]] - [[#the-nebkor-langsel-section-for-scheme][The =nebkor-langs.el= section for Scheme]] + - [[#the-nebkor-langsel-section-for-go][The =nebkor-langs.el= section for Go]] + - [[#the-nebkor-langsel-section-for-terrform][The =nebkor-langs.el= section for Terrform]] - [[#the-nebkor-langsel-section-for-emacs-lisp][The =nebkor-langs.el= section for Emacs Lisp]] - [[#finally-we-provide-the-nebkor-langsel-module][Finally, we provide the =nebkor-langs.el= module]] - [[#the-nebkor-studyel-module][The =nebkor-study.el= module]] @@ -495,8 +498,9 @@ When using ~elpaca~, here are some gotchas you should be aware of assumptions about order of execution. #+begin_src emacs-lisp :tangle "init.el" - ;;; Install Elpaca - (defvar elpaca-installer-version 0.9) + ;;; Install Elpaca + + (defvar elpaca-installer-version 0.10) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) @@ -511,7 +515,6 @@ When using ~elpaca~, here are some gotchas you should be aware of (add-to-list 'load-path (if (file-exists-p build) build repo)) (unless (file-exists-p repo) (make-directory repo t) - (when (< emacs-major-version 28) (require 'subr-x)) (condition-case-unless-debug err (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) ((zerop (apply #'call-process `("git" nil ,buffer t "clone" @@ -1347,8 +1350,8 @@ These are modifications to basic configuration I use on my Mac OSX machine. (process-send-string proc text) (process-send-eof proc)))) - (setq mac-command-modifier 'meta) - (setq mac-option-modifier 'alt) + ;;(setq mac-command-modifier 'meta) + ;;(setq mac-option-modifier 'alt) (setq interprogram-cut-function #'paste-to-osx) (setq interprogram-paste-function #'copy-from-osx) ;; Work around a bug on OS X where system-name is a fully qualified @@ -1392,6 +1395,22 @@ These are modifications to basic configuration I use on my Mac OSX machine. (setq column-number-mode t)) #+end_src +** The =nebkor-essentials.el= section for better help (~helpful~) +:PROPERTIES: +:CUSTOM_ID: h:ECAF81D8-4111-4C71-AB77-3C3D322B235F +:CREATED: [2024-12-02 Mon 09:50] +:ID: 01JGD333ED000CFWD9GWED35XD +:END: + +Helpful is a package that improves the default Emacs *Help* buffer. I don't want to replace what +Emacs provides with default, and I find myself using Helpful only as an Avy action ([[#h:4E8593F7-C065-4DFA-B513-98602EC2BA1A][The +=nebkor-search.el= settings for ~avy~ (jumping)]]). However, it's really useful in that context. + +#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-essentials.el" + (use-package helpful + :ensure t) +#+end_src + ** The =nebkor-essentials= section for ~indent-tools~ :PROPERTIES: :ID: 01JGD1ASTX0008J83XRB4TZW77 @@ -2290,6 +2309,20 @@ My old custom functions file. (set-window-buffer-start-and-point w1 b2 s2 p2) (set-window-buffer-start-and-point w2 b1 s1 p1))))))) + (defun my-update-env (fn) + (let ((str + (with-temp-buffer + (insert-file-contents fn) + (buffer-string))) lst) + (setq lst (split-string str "\000")) + (while lst + (setq cur (car lst)) + (when (string-match "^\\(.*?\\)=\\(.*\\)" cur) + (setq var (match-string 1 cur)) + (setq value (match-string 2 cur)) + (setenv var value)) + (setq lst (cdr lst))))) + (provide 'nebkor-functions) #+end_src @@ -4882,12 +4915,14 @@ colors (you can use tree-sitter to do *syntactic* highlighting, but that's diffe lsp-eldoc-render-all t lsp-idle-delay 0.2 lsp-enable-snippet t + lsp-file-watch-threshold 3000 read-process-output-max (* 1024 1024)) :hook ( (lsp-mode . lsp-enable-which-key-integration) (lsp-mode . subword-mode) (lsp-completion-mode . my/lsp-mode-setup-completion) + (go-ts-mode . lsp-mode) ;;(before-save . lsp-format-buffer) )) #+end_src @@ -5214,6 +5249,45 @@ for this to continue. :config (add-hook 'geiser-repl-mode-hook #'macrostep-geiser-setup)) #+end_src +** The =nebkor-langs.el= section for Go +:PROPERTIES: +:ID: 3EE09964-FF3B-43BC-A09D-7CA94A245D25 +:END: + +#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-langs.el" + (use-package go-ts-mode + :ensure nil + :hook + (go-ts-mode . go-format-on-save-mode) + (go-ts-mode . (lambda () (set (make-local-variable 'tab-width) 2))) + :custom + (go-mode-indent-offset 2) + :init + (add-to-list 'treesit-language-source-alist '(go "https://github.com/tree-sitter/tree-sitter-go")) + (add-to-list 'treesit-language-source-alist '(gomod "https://github.com/camdencheek/tree-sitter-go-mod")) + (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode)) + (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)) + :config + (reformatter-define go-format + :program "goimports" + :args '("/dev/stdin"))) + + (use-package flycheck-golangci-lint + :ensure t + :hook + (go-ts-mode . flycheck-golangci-lint-setup)) +#+end_src + + +** The =nebkor-langs.el= section for Terrform +:PROPERTIES: +:ID: 43DB91FB-9B4E-4D6A-AF89-CDCD22469C3A +:END: + +#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-langs.el" + (use-package terraform-mode + :ensure t) +#+end_src ** The =nebkor-langs.el= section for Emacs Lisp :PROPERTIES: @@ -5249,7 +5323,6 @@ for this to continue. This file contains configuration for everything I use to make Emacs my go-to place for studying anything. - ** The =nebkor-study.el= section for reading and annotation of PDFs (~pdf-tools~) :PROPERTIES: :CUSTOM_ID: h:B662EABD-DC46-468A-BF59-E67AC48D2DDA @@ -6261,6 +6334,14 @@ figure it out. "//-************************************************************************ // //-************************************************************************") + + (use-package restclient + :ensure t) + (use-package restclient-jq + :ensure t) + (elpaca (1password :host github :repo "kamushadenes/1password.el") + (use-package 1password)) + #+end_src *** Finally, we provide the =nebkor-personal.el= module diff --git a/nebkor-modules/nebkor-essentials.el b/nebkor-modules/nebkor-essentials.el index a96d347..a210ecb 100644 --- a/nebkor-modules/nebkor-essentials.el +++ b/nebkor-modules/nebkor-essentials.el @@ -166,8 +166,8 @@ word. Fall back to regular `expreg-expand'." (process-send-string proc text) (process-send-eof proc)))) - (setq mac-command-modifier 'meta) - (setq mac-option-modifier 'alt) + ;;(setq mac-command-modifier 'meta) + ;;(setq mac-option-modifier 'alt) (setq interprogram-cut-function #'paste-to-osx) (setq interprogram-paste-function #'copy-from-osx) ;; Work around a bug on OS X where system-name is a fully qualified @@ -202,6 +202,9 @@ If the region is selected, retain the original behaviour, otherwise call :config (setq column-number-mode t)) +(use-package helpful + :ensure t) + (use-package indent-tools :ensure t) diff --git a/nebkor-modules/nebkor-functions.el b/nebkor-modules/nebkor-functions.el index 8a78921..75de8a0 100644 --- a/nebkor-modules/nebkor-functions.el +++ b/nebkor-modules/nebkor-functions.el @@ -71,4 +71,18 @@ (set-window-buffer-start-and-point w1 b2 s2 p2) (set-window-buffer-start-and-point w2 b1 s1 p1))))))) +(defun my-update-env (fn) + (let ((str + (with-temp-buffer + (insert-file-contents fn) + (buffer-string))) lst) + (setq lst (split-string str "\000")) + (while lst + (setq cur (car lst)) + (when (string-match "^\\(.*?\\)=\\(.*\\)" cur) + (setq var (match-string 1 cur)) + (setq value (match-string 2 cur)) + (setenv var value)) + (setq lst (cdr lst))))) + (provide 'nebkor-functions) diff --git a/nebkor-modules/nebkor-langs.el b/nebkor-modules/nebkor-langs.el index 76cfe2a..6e0eb54 100644 --- a/nebkor-modules/nebkor-langs.el +++ b/nebkor-modules/nebkor-langs.el @@ -192,12 +192,14 @@ lsp-eldoc-render-all t lsp-idle-delay 0.2 lsp-enable-snippet t + lsp-file-watch-threshold 3000 read-process-output-max (* 1024 1024)) :hook ( (lsp-mode . lsp-enable-which-key-integration) (lsp-mode . subword-mode) (lsp-completion-mode . my/lsp-mode-setup-completion) + (go-ts-mode . lsp-mode) ;;(before-save . lsp-format-buffer) )) @@ -363,6 +365,31 @@ NS is the namespace information passed into the function by cider." :after geiser-repl :config (add-hook 'geiser-repl-mode-hook #'macrostep-geiser-setup)) +(use-package go-ts-mode + :ensure nil + :hook + (go-ts-mode . go-format-on-save-mode) + (go-ts-mode . (lambda () (set (make-local-variable 'tab-width) 2))) + :custom + (go-mode-indent-offset 2) + :init + (add-to-list 'treesit-language-source-alist '(go "https://github.com/tree-sitter/tree-sitter-go")) + (add-to-list 'treesit-language-source-alist '(gomod "https://github.com/camdencheek/tree-sitter-go-mod")) + (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode)) + (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)) + :config + (reformatter-define go-format + :program "goimports" + :args '("/dev/stdin"))) + +(use-package flycheck-golangci-lint + :ensure t + :hook + (go-ts-mode . flycheck-golangci-lint-setup)) + +(use-package terraform-mode + :ensure t) + ;;; Settings for Interaction mode for Emacs-Lisp (use-package ielm :ensure nil