Updated emacs settings for emacs 30

This commit is contained in:
Ezri Brimhall 2025-03-13 09:37:20 -06:00
parent bbc5492534
commit 6a603a5c9b
Signed by: ezri
GPG Key ID: 058A78E5680C6F24
2 changed files with 192 additions and 65 deletions

View File

@ -1,4 +1,5 @@
;; Install straight.el
(defvar native-comp-deferred-compilation-deny-list '[])
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
@ -6,7 +7,7 @@
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
@ -19,7 +20,8 @@
(use-package straight
:custom (straight-use-package-by-default t))
(straight-use-package 'org)
(use-package org
:ensure t)
(require 'org)
(org-babel-load-file
(expand-file-name "settings.org"

View File

@ -5,6 +5,7 @@
Shamelessly stole this from Simponic, made some limited modifications myself.
Namely to indent style, theme, and line numbers. Also added Github Copilot.
* Packages
** Melpa
#+BEGIN_SRC emacs-lisp
@ -12,15 +13,29 @@ Namely to indent style, theme, and line numbers. Also added Github Copilot.
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
#+END_SRC
** Project
#+BEGIN_SRC emacs-lisp
(use-package project
:ensure t)
#+END_SRC
** Configure some packages for internal only
#+BEGIN_SRC emacs-lisp
(use-package eldoc :straight (:type built-in))
(use-package flymake :straight (:type built-in))
#+END_SRC
* General emacs
** Indentation
Indent using tabs, render with tab-width of 2.
#+BEGIN_SRC emacs-lisp
(use-package smart-tabs-mode
:ensure t
:init
(smart-tabs-insinuate 'c 'c++ 'java 'javascript 'python)
)
(setq default-tab-width 2)
(setq-default tab-width 2)
(setq-default indent-tabs-mode t)
(setq sh-indentation 2)
(smart-tabs-insinuate 'c 'c++ 'java 'javascript 'python)
(add-hook 'conf-mode-hook
(lambda ()
@ -365,20 +380,22 @@ Indent using tabs, render with tab-width of 2.
* Custom Mode Bindings
** SystemD unit files
#+BEGIN_SRC emacs-lisp
;; Base systemd unit files
(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.timer\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.mount\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.automount\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.path\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.slice\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.device\\'" . conf-unix-mode))
;; systemd-networkd
(add-to-list 'auto-mode-alist '("\\.network\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.link\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.netdev\\'" . conf-unix-mode))
;; ;; Base systemd unit files
;; (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.timer\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.mount\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.automount\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.path\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.slice\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.device\\'" . conf-unix-mode))
;; ;; systemd-networkd
;; (add-to-list 'auto-mode-alist '("\\.network\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.link\\'" . conf-unix-mode))
;; (add-to-list 'auto-mode-alist '("\\.netdev\\'" . conf-unix-mode))
(use-package systemd
:ensure t)
#+END_SRC
** elkowar's wacky widgets
@ -389,8 +406,9 @@ Indent using tabs, render with tab-width of 2.
#+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
#+END_SRC
* Markdown mode
** Auto Text Wrap
* Config & Markup
** Markdown
*** Auto Text Wrap
#+BEGIN_SRC emacs-lisp
(add-hook 'markdown-mode-hook (lambda ()
(setq fill-column 85)
@ -398,17 +416,94 @@ Indent using tabs, render with tab-width of 2.
(visual-line-mode)
(display-fill-column-indicator-mode)))
#+END_SRC
** YAML
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
:ensure t
:mode (("\\.yml\\'" . yaml-mode)
("\\.yaml\\'" . yaml-mode)))
#+END_SRC
* Org mode
** General
#+BEGIN_SRC emacs-lisp
(setq org-startup-indented t)
(setq org-hide-emphasis-markers t)
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
#+END_SRC
#+RESULTS:
** Fonts
#+BEGIN_SRC emacs-lisp
(custom-theme-set-faces
'user
'(org-block ((t (:inherit fixed-pitch))))
'(org-code ((t (:inherit (shadow fixed-pitch)))))
'(org-document-info ((t (:foreground "dark orange"))))
'(org-document-info-keyword ((t (:inherit (shadow fixed-pitch)))))
'(org-indent ((t (:inherit (org-hide fixed-pitch)))))
'(org-link ((t (:foreground "royal blue" :underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-property-value ((t (:inherit fixed-pitch))) t)
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
'(org-table ((t (:inherit fixed-pitch :foreground "#83a598"))))
'(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8))))
'(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
(defun my-org-font-config (&optional frame)
(let* ((variable-tuple
(cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
((x-list-fonts "Verdana") '(:font "Verdana"))
((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
(nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro."))))
(headline `(:weight bold)))
(custom-theme-set-faces
'user
`(org-level-8 ((t (,@headline ,@variable-tuple))))
`(org-level-7 ((t (,@headline ,@variable-tuple))))
`(org-level-6 ((t (,@headline ,@variable-tuple))))
`(org-level-5 ((t (,@headline ,@variable-tuple))))
`(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))
`(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25))))
`(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5))))
`(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))
`(org-document-title ((t (,@headline ,@variable-tuple :height 2.0 :underline nil))))))
)
(add-hook 'after-make-frame-functions 'my-org-font-config)
(add-hook 'org-mode-hook
(lambda ()
(variable-pitch-mode)
(visual-line-mode)
(setq cursor-type '(bar . 2))
))
#+END_SRC
** RPG Stuff
#+BEGIN_SRC emacs-lisp
(use-package ox-dnd
:straight (ox-dnd :type git :host github :repo "xeals/emacs-org-dnd" :files ("*.el"))
:ensure t
:init
(require 'ox-dnd)
)
#+END_SRC
** Auto Text Wrap
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook (lambda ()
(setq fill-column 85)
(visual-fill-column-mode)
(visual-line-mode)))
;; (add-hook 'org-mode-hook (lambda ()
;; (setq fill-column 85)
;; (visual-fill-column-mode)
;; (visual-line-mode)))
#+END_SRC
** Babel
*** Elixir
@ -450,15 +545,44 @@ Indent using tabs, render with tab-width of 2.
:repo "rlister/org-present"))
#+END_SRC
** Links & Backlinks
#+BEGIN_SRC emacs-lisp
(use-package org-super-links
:straight (org-super-links :type git :host github :repo "toshism/org-super-links" :branch "develop")
:bind (("C-c s s" . org-super-links-link)
("C-c s l" . org-super-links-store-link)
("C-c s C-l" . org-super-links-insert-link))
:config ((require 'org-id)
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)))
#+END_SRC
** Emoji Input
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook '(lambda () (set-input-method "emoji")))
#+END_SRC
* Development
** Copilot
#+BEGIN_SRC emacs-lisp
;; Ensure dependencies are installed
(use-package editorconfig
:ensure t)
(use-package jsonrpc
:ensure t)
;; Load copilot
(add-to-list 'load-path "/home/ezri/.emacs.d/copilot.el")
(require 'copilot)
;; Enable completion
(add-hook 'prog-mode-hook 'copilot-mode)
(use-package copilot
:straight (copilot :type git :host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
:ensure t
:init
(add-hook 'prog-mode-hook 'copilot-mode)
:bind
(:map copilot-completion-map
("M-<return>" . copilot-accept-completion)
("M-RET" . copilot-accept-completion))
)
#+END_SRC
** Tree-Sitter
#+BEGIN_SRC emacs-lisp
@ -479,10 +603,6 @@ Indent using tabs, render with tab-width of 2.
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
#+END_SRC
** Git
#+BEGIN_SRC emacs-lisp
(use-package magit :ensure t)
#+END_SRC
** Autocomplete
#+BEGIN_SRC emacs-lisp
(use-package auto-complete :ensure t)
@ -497,22 +617,22 @@ Indent using tabs, render with tab-width of 2.
(setq ac-disable-inline t)
; show menu if have only one candidate
(setq ac-candidate-menu-min 0))
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
#+END_SRC
** Company mode
#+BEGIN_SRC emacs-lisp
(use-package company
:ensure t
:init
(global-company-mode t)
:init (global-company-mode t)
:bind (:map company-active-map
("C-n" . company-select-next)
("C-p" . company-select-previous))
:config
(setq company-idle-delay 0.3))
#+END_SRC
#+RESULTS:
: company-select-previous
** LSP
#+BEGIN_SRC emacs-lisp
(use-package eglot
@ -520,25 +640,41 @@ Indent using tabs, render with tab-width of 2.
:defer t
:bind (:map eglot-mode-map
("C-c C-e" . eglot-rename)
("C-." . eglot-code-actions))
("C-." . eglot-code-actions)
("<f2>" . eglot-find-declaration))
:hook ((python-mode . eglot-ensure)
(python-mode . flyspell-prog-mode)
(python-mode . superword-mode)
(python-mode . hs-minor-mode))
(python-mode . hs-minor-mode)
(typescript-ts-mode . eglot-ensure)
(typescript-ts-mode . flyspell-prog-mode)
(typescript-ts-mode . superword-mode)
(typescript-ts-mode . hs-minor-mode)
(tsx-ts-mode . eglot-ensure)
(tsx-ts-mode . flyspell-prog-mode)
(tsx-ts-mode . superword-mode)
(tsx-ts-mode . hs-minor-mode)
(typescript-mode . eglot-ensure)
(typescript-mode . flyspell-prog-mode)
(typescript-mode . superword-mode)
(typescript-mode . hs-minor-mode))
:config
(setq-default eglot-workspace-configuration
'((:pylsp . (:configurationSources ["flake8"]
:plugins (
:mccabe (:enabled :json-false)
:pyflakes (:enabled :json-false)
:flake8 (:enabled :json-false
:maxLineLength 88)
:ruff (:enabled t :lineLength 88)
:pydocstyle (:enabled t :convention "numpy")
:yapf (:enabled :json-false)
:autopep8 (:enabled :json-false)
:black (:enabled t :line_length 88 :cache_config t)))))))
:mccabe (:enabled :json-false)
:pyflakes (:enabled :json-false)
:flake8 (:enabled :json-false
:maxLineLength 88)
:ruff (:enabled t :lineLength 88)
:pydocstyle (:enabled t :convention "numpy")
:yapf (:enabled :json-false)
:autopep8 (:enabled :json-false)
:black (:enabled t :line_length 88 :cache_config t)))))))
#+END_SRC
** Git
#+BEGIN_SRC emacs-lisp
(use-package magit :ensure t)
#+END_SRC
** Languages
*** Elixir
@ -566,20 +702,13 @@ After installing the ~rust-analyzer~ program, the following can be used:
*** Web Stuff
**** Typescript
#+BEGIN_SRC emacs-lisp
;; TODO: Update to tree-sitter in Emacs 29
(setq major-mode-remap-alist
'((typescript-mode . typescript-ts-mode)
(python-mode . python-ts-mode)
(js2-mode . js-ts-mode)
(json-mode . json-ts-mode)))
(use-package typescript-mode
:ensure t
:mode "\\.ts\\'"
:config
(setq typescript-indent-level 2))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
;; (add-hook 'tsx-ts-mode-hook #'eglot)
;; (add-hook 'tsx-ts-mode-hook #'setup-tide-mode)
;; (add-hook 'typescript-ts-mode-hook #'eglot)
;; (add-hook 'typescript-ts-mode-hook #'setup-tide-mode)
#+END_SRC
**** TIDE
#+BEGIN_SRC emacs-lisp
@ -703,7 +832,3 @@ After installing the ~rust-analyzer~ program, the following can be used:
;; ("C-c C-l" . obsidian-insert-wikilink)))
#+END_SRC
* TRAMP Customization
#+BEGIN_SRC emacs-lisp
(add-hook 'after-init-hook 'tramp-nspawn-setup)
#+END_SRC