diff options
Diffstat (limited to '.emacs.d')
| -rw-r--r-- | .emacs.d/.gitignore | 13 | ||||
| -rw-r--r-- | .emacs.d/custom.el | 39 | ||||
| -rw-r--r-- | .emacs.d/early-init.el | 9 | ||||
| -rw-r--r-- | .emacs.d/init.el | 915 | ||||
| -rw-r--r-- | .emacs.d/lang/clojure.el | 26 | ||||
| -rw-r--r-- | .emacs.d/lang/java.el | 38 | ||||
| -rw-r--r-- | .emacs.d/lang/lisp.el | 9 | ||||
| -rw-r--r-- | .emacs.d/lang/lua.el | 11 | ||||
| -rw-r--r-- | .emacs.d/pkg/consult-jdt.el | 105 | ||||
| -rw-r--r-- | .emacs.d/pkg/flymake-cppcheck.el | 84 |
10 files changed, 0 insertions, 1249 deletions
diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore deleted file mode 100644 index 44ac41e..0000000 --- a/.emacs.d/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -#* -.cache -auto-save-list -autosaves -backups -eln-cache -elpa -eshell -history -lock -places -projects -recentf \ No newline at end of file diff --git a/.emacs.d/custom.el b/.emacs.d/custom.el deleted file mode 100644 index 1bca6e5..0000000 --- a/.emacs.d/custom.el +++ /dev/null @@ -1,39 +0,0 @@ - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-safe-themes - '("a59d0dbcbdfc57a14bc3fa28cb5a8367bc7ede82d848f517b4979b4a03c09da9" - "3538194fff1b928df280dc08f041518a8d51ac3ff704c5e46d1517f5c4d8a0e0" - default)) - '(package-selected-packages nil) - '(package-vc-selected-packages - '((eglot-booster :url "https://github.com/jdtsmith/eglot-booster.git"))) - '(safe-local-variable-directories '("/Users/venomade/Projects/Learning/C/GeneticsProject/"))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(org-block ((t (:inherit fixed-pitch)))) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) - '(org-document-title ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans" :height 2.0 :underline nil)))) - '(org-indent ((t (:inherit (org-hide fixed-pitch))))) - '(org-level-1 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans" :height 1.75)))) - '(org-level-2 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans" :height 1.5)))) - '(org-level-3 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans" :height 1.25)))) - '(org-level-4 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans" :height 1.1)))) - '(org-level-5 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans")))) - '(org-level-6 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans")))) - '(org-level-7 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans")))) - '(org-level-8 ((t (:inherit default :weight bold :foreground "#cdd6f4" :font "Google Sans")))) - '(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)))) - '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-table ((t (:inherit fixed-pitch)))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el deleted file mode 100644 index 8ba547e..0000000 --- a/.emacs.d/early-init.el +++ /dev/null @@ -1,9 +0,0 @@ -;; GC Perfomance Tweaks from DOOM Emacs -(setq gc-cons-threshold most-positive-fixnum - gc-cons-percentage 1.0) -(add-hook 'emacs-startup-hook - (lambda () - (setq gc-cons-threshold (* 128 1024 1024) ;; 128MB - gc-cons-percentage 1.0))) - -(setenv "LSP_USE_PLISTS" "true") diff --git a/.emacs.d/init.el b/.emacs.d/init.el deleted file mode 100644 index 25db606..0000000 --- a/.emacs.d/init.el +++ /dev/null @@ -1,915 +0,0 @@ -;;; init.el --- Venomade's Emacs Config -*- lexical-binding: t; -*- - -;;; Commentary: -;;; -;;; This is my Emacs config which I rewrote from the ground up in October 2025. -;;; It is built around these rules: -;;; - Performance as a Focus -;;; - Don't do with a package what should be done without -;;; - Don't replicate functionality of built-in packages -;;; - When using a package, take advantage of most of it's features - -;;; Code: - -;; Package Setup -(require 'package) -(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) -(package-initialize) - -(if (native-comp-available-p) - (setq package-native-compile t)) - -;; Core Functionality -(setq mac-command-modifier nil) ; disable super on mac - -; (add-to-list 'default-frame-alist '(undecorated . t)) ; disable titlebar - -(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) -(when (file-exists-p custom-file) - (load custom-file)) - -(use-package gcmh ; Improved Garbage Collection - :ensure t - :hook (after-init . gcmh-mode) - :config - (setq gcmh-high-cons-threshold (* 128 1024 1024) ; 128MB - gcmh-idle-delay 10 - gcmh-verbose nil)) - -(use-package exec-path-from-shell ; FIXME: Doesn't work with Daemonex - :ensure t - :config - (setq exec-path-from-shell-shell-name "/bin/zsh" - exec-path-from-shell-arguments nil) - (when (memq window-system '(mac ns x)) - (exec-path-from-shell-initialize))) - -(let* ((backup-dir (expand-file-name "backups/" user-emacs-directory)) - (autosave-dir (expand-file-name "autosaves/" user-emacs-directory)) - (lock-dir (expand-file-name "lock/" user-emacs-directory))) - (make-directory backup-dir t) - (make-directory autosave-dir t) - (make-directory lock-dir t) - - (setq backup-directory-alist `((".*" . ,(directory-file-name backup-dir))) - auto-save-file-name-transforms `((".*" ,(directory-file-name autosave-dir) t)) - lock-file-name-transforms `((".*" ,(directory-file-name lock-dir) t)))) - -(add-to-list 'display-buffer-alist - '("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'" - (display-buffer-no-window) - (allow-no-window . t))) - -(progn - (setq trash-directory "~/.Trash") - (defun system-move-file-to-trash (file) - "Use \"trash\" to move FILE to the system trash." - (cl-assert (executable-find "trash") nil "'trash' must be installed. Needs \"brew install trash\"") - (call-process "trash" nil 0 nil "-F" file))) - -;; User Interface -(setq frame-resize-pixelwise t - display-line-numbers-width-start t - display-line-numbers-width 4 - display-line-numbers-grow-only t - ring-bell-function 'ignore - ns-confirm-quit t) - -(setq-default truncate-lines t) - -; Replace the $ signs for truncation with spaces -(set-display-table-slot standard-display-table 'truncation 32) - -(tool-bar-mode -1) -(scroll-bar-mode -1) -(menu-bar-mode -1) - -(add-hook 'emacs-startup-hook #'global-display-line-numbers-mode) - -(add-hook 'after-make-frame-functions - (lambda (f) - (select-frame-set-input-focus f))) - -; (use-package kaolin-themes -; :ensure t -; :config -; ; (add-hook 'emacs-startup-hook -; ; (lambda () -; ; (load-theme 'kaolin-dark t))) -; (load-theme 'kaolin-dark t) - -; (defun theme-toggle () -; "Toggle between two Emacs themes." -; (interactive) -; (let ((theme-a 'kaolin-dark) -; (theme-b 'kaolin-light)) -; (cond -; ((member theme-a custom-enabled-themes) -; (disable-theme theme-a) -; (load-theme theme-b t)) -; ((member theme-b custom-enabled-themes) -; (disable-theme theme-b) -; (load-theme theme-a t)) -; (t -; (load-theme theme-a t)))))) - -; TODO: Redo to be less hacky -; (defun set-mode-line-box () -; (set-face-attribute -; 'mode-line-active nil -; :box '(:line-width 1 :color "#B4BEFE" :style nil))) - -; (with-eval-after-load 'spacious-padding -; (add-hook 'spacious-padding-mode-hook #'set-mode-line-box)) - -(use-package catppuccin-theme - :ensure t - :config - (setq catppuccin-flavor 'mocha) - ; (add-hook 'emacs-startup-hook - ; (lambda () - ; (load-theme 'kaolin-dark t))) - (load-theme 'catppuccin t) - ; (set-mode-line-box) - - (defun theme-toggle () - "Toggle between two Emacs themes." - (interactive) - (let ((theme-a 'kaolin-dark) - (theme-b 'kaolin-light)) - (cond - ((eq catppuccin-flavor 'latte) - (disable-theme 'catppuccin) - (setq catppuccin-flavor 'mocha) - (load-theme 'catppuccin t)) - ; (set-mode-line-box)) - ((eq catppuccin-flavor 'mocha) - (disable-theme 'catppuccin) - (setq catppuccin-flavor 'latte) - (load-theme 'catppuccin t)) - ; (set-mode-line-box)) - (t - (load-theme theme-a t)))))) - -(use-package ns-auto-titlebar - :ensure t - :config - (when (eq system-type 'darwin) (ns-auto-titlebar-mode))) - -(use-package hide-mode-line - :ensure t) - -; TEMPORARILY DISABLED WHILE FIGURING OUT STIPPLES -; ------------------------ -;(use-package indent-bars -; :ensure t -; :hook (prog-mode . indent-bars-mode) -; :config -; (setq indent-bars-width-frac 0.15 -; indent-bars-starting-column 0 -; indent-bars-prefer-character t -; indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.425) -; indent-bars-color-by-depth nil)) -; -;(face-attribute 'default :stipple nil t) - -(use-package olivetti - :ensure t - :after hide-mode-line - :config - (keymap-global-set "C-c z" 'olivetti-mode) - (which-key-add-key-based-replacements "C-c z" "zen-mode") - (setq olivetti-minimum-body-width 100) - - (defun zen-toggle-minor-modes () - "Toggle minor modes with `olivetti-mode`." - (if olivetti-mode - (progn - (hide-mode-line-mode 1) - (display-line-numbers-mode 0)) - (progn - (setq olivetti-body-width 100) ; HACK: Fixes default being set below minimum - (hide-mode-line-mode 0) - (unless (eq major-mode 'fundamental-mode) - (display-line-numbers-mode 1))))) - - (add-hook 'olivetti-mode-hook #'zen-toggle-minor-modes)) - -(let ((no-numbers-modes '(fundamental-mode-hook))) - (dolist (hk no-numbers-modes) - (add-hook hk (lambda () (display-line-numbers-mode 0))))) - -(use-package doom-modeline - :ensure t - :hook (after-init . doom-modeline-mode) - :config - (setq doom-modeline-height 0 ; minimum - doom-modeline-bar-width 0 ; disabled - doom-modeline-project-detection 'project ; use project.el - doom-modeline-buffer-state-icon nil - doom-modeline-highlight-modified-buffer-name nil - doom-modeline-percent-position nil - line-number-mode nil - doom-modeline-buffer-encoding nil - doom-modeline-time-live-icon nil - doom-modeline-time-icon nil - display-time-default-load-average nil - display-time-format "%a %d %b | %R" - helm-ag-show-status-function nil)) ;HACK: Doom Modeline asks for this but I don't use helm - ;(display-battery-mode 1) - ;(display-time-mode 1)) - -(use-package spacious-padding - :ensure t - :hook (after-init . spacious-padding-mode) - :config - (setq spacious-padding-widths - '( :internal-border-width 8 - :header-line-width 4 - :mode-line-width 6 - :custom-button-width 3 - :tab-width 4 - :right-divider-width 30 - :scroll-bar-width 8 - :fringe-width 0)) - (setq spacious-padding-subtle-frame-lines - '( :mode-line-active spacious-padding-line-active - :mode-line-inactive spacious-padding-line-inactive - :header-line-active spacious-padding-line-active - :header-line-inactive spacious-padding-line-inactive))) - -(use-package nerd-icons - :ensure t - :if (display-graphic-p)) - -(use-package nerd-icons-dired - :ensure t - :after nerd-icons - :hook - (dired-mode . nerd-icons-dired-mode)) - -(use-package nerd-icons-ibuffer - :ensure t - :after nerd-icons - :hook (ibuffer-mode . nerd-icons-ibuffer-mode)) - -(use-package rainbow-delimiters - :ensure t - :hook (prog-mode . rainbow-delimiters-mode)) - -(use-package hl-todo - :ensure t - :hook ((org-mode . hl-todo-mode) - (prog-mode . hl-todo-mode)) - :config - (add-to-list 'hl-todo-keyword-faces '("ERROR" . "#8c5353"))) - -(let* ((quit-messages - `(; from Doom 1 - ,(format "I wouldn't leave if I were you. %s is much worse." - (if (featurep 'windows-nt) "DOS" "UNIX")) - "Ya know, next time you come in here I'm gonna toast ya." - "Go ahead and leave. See if I care." - "Are you sure you want to quit this great editor?" - ; from Doom Emacs - "(setq nothing t everything 'permitted)" - "Emacs will remember that." - "Emacs, Emacs never changes." - "Hey! Hey, M-x listen!" - "Wake up, Mr. Stallman. Wake up and smell the ashes." - "You are *not* prepared!" - "Please don't go. The drones need you. They look up to you."))) - (progn - (defun random-quit-message () - "Return a randomly chosen quit message from `quit-messages'." - (nth (random (length quit-messages)) quit-messages)) - - (defun message-confirm-kill-emacs (&rest _) - "Prompt the user with a random message before quitting. -Returns t to allow kill if the user answers yes; nil otherwise." - (let* ((msg (random-quit-message)) - (prompt (format "%s Really quit Emacs? " msg))) - (yes-or-no-p (propertize prompt 'face '(italic default))))) - - (setq confirm-kill-emacs #'message-confirm-kill-emacs))) - -(use-package goggles - :ensure t - :hook ((prog-mode text-mode) . goggles-mode) - :config - (setq-default goggles-pulse t)) - -(add-hook 'emacs-startup-hook #'which-key-mode) - -;; Text Editing -(setq-default indent-tabs-mode nil - tab-width 2 - tab-stop-list (number-sequence 2 100 2) - c-basic-offset 2) - -(keymap-global-set "C-c r" 'replace-regexp) - -(cl-labels - ((vi-open-line-above () - "Open line above the current line." - (interactive) - (unless (bolp) (beginning-of-line)) - (newline) - (forward-line -1) - (indent-according-to-mode)) - (vi-open-line-below () - "Open line below the current line." - (interactive) - (unless (eolp) (end-of-line)) - (newline-and-indent))) - (define-key (current-global-map) (kbd "C-c o") #'vi-open-line-above) - (define-key (current-global-map) (kbd "C-c O") #'vi-open-line-below) - (which-key-add-key-based-replacements "C-c o" "open-line-above") - (which-key-add-key-based-replacements "C-c O" "open-line-below")) - -(use-package move-text - :ensure t - :config - (keymap-global-set "M-p" 'move-text-up) - (keymap-global-set "M-n" 'move-text-down) - (defun indent-region-advice (&rest ignored) - (let ((deactivate deactivate-mark)) - (if (region-active-p) - (indent-region (region-beginning) (region-end)) - (indent-region (line-beginning-position) (line-end-position))) - (setq deactivate-mark deactivate))) - - (advice-add 'move-text-up :after 'indent-region-advice) - (advice-add 'move-text-down :after 'indent-region-advice)) - -(progn - (defun smart-beginning-of-line () - "Move the cursor to the beginning of text on the line." - (interactive) - (let ((initial-point (point))) - (back-to-indentation) - (when (eq initial-point (point)) - (move-beginning-of-line 1)))) - (defun setup-prog-mode-c-a () - (local-set-key (kbd "C-a") 'smart-beginning-of-line)) - (add-hook 'prog-mode-hook 'setup-prog-mode-c-a) - (add-hook 'conf-mode-hook 'setup-prog-mode-c-a)) - -(progn - (defun prog-nuke-trailing-whitespace () - "Removes trailing whitespace at the end of the line." - (when (or (derived-mode-p 'prog-mode) (derived-mode-p 'conf-mode)) - (delete-trailing-whitespace))) - (add-hook 'before-save-hook 'prog-nuke-trailing-whitespace)) - -(use-package smartparens - :ensure t - :hook (prog-mode text-mode markdown-mode) - :config - (require 'smartparens-config) - (sp-use-paredit-bindings)) - -(use-package undo-tree - :ensure t - :init - (global-undo-tree-mode 1) - :config - (setq undo-tree-auto-save-history t - undo-tree-history-directory-alist '(("." . "~/.emacs.d/.cache")))) - -(use-package gptel - :ensure t - :config - (setq - gptel-model 'qwen2.5-coder:7b-instruct-q4_K_M - gptel-backend (gptel-make-ollama "Ollama" - :host "localhost:11434" - :stream t - :models '(qwen2.5-coder:7b-instruct-q4_K_M))) - (keymap-global-set "C-c g" 'gptel-menu) - (which-key-add-key-based-replacements "C-c g" "gptel")) - -(use-package delsel - :hook (after-init . delete-selection-mode)) - -(use-package accent - :ensure t - :bind* (("C-'" . accent-menu)) - :config - (setq accent-diacritics '((a (á ã â à)) ; só para Português - (e (é ê)) - (i (í)) - (o (ó õ ô)) - (u (ú)) - (c (ç)) - (A (Á Ã Â À)) - (E (É Ê)) - (I (Í)) - (O (Ó Õ Ô)) - (U (Ú))))) - -;; Emacsing -(setq scroll-margin 10 ; Doesn't work with smooth-scrolling - scroll-conservatively 100 - scroll-step 1) - -(setopt use-short-answers t) - -(use-package dired - :commands (dired) - :hook - ((dired-mode . dired-hide-details-mode) - (dired-mode . hl-line-mode)) - :config - (setq dired-recursive-copies 'always - dired-recursive-deletes 'always - ; delete-by-moving-to-trash t ; FIXME: Currently Broken, need to find why - dired-dwim-target t - dired-listing-switches "-lah")) - -(use-package dired-subtree - :ensure t - :after dired - :bind - (:map dired-mode-map - ("TAB" . dired-subtree-toggle) - ("<backtab>" . dired-subtree-remove)) - :config - (setq dired-subtree-use-backgrounds nil)) - -(add-hook 'emacs-startup-hook #'save-place-mode) - -(progn - (dolist (spec - '((eshell-prompt-user-face font-lock-keyword-face "Face for the username in the eshell prompt.") - (eshell-prompt-venv-face font-lock-string-face "Face for the virtualenv name in the eshell prompt.") - (eshell-prompt-dir-face dired-directory "Face for the directory path in the eshell prompt.") - (eshell-prompt-git-face magit-tag "Face for the git branch in the eshell prompt.") - (eshell-prompt-git-dirty-face eshell-prompt-git-face "Face for the git dirty status in the eshell prompt.") - (eshell-prompt-symbol-face font-lock-builtin-face "Face for the prompt symbol in the eshell prompt."))) - (cl-destructuring-bind (name inherit doc) spec - (defface name - `((t (:inherit ,inherit))) - doc - :group 'eshell-prompt))) - - (defun eshell-abbreviate-dir (dir) - "Abbreviate directory to show only the first and the last two components." - (let* ((abbrev (abbreviate-file-name dir)) - (components (split-string abbrev "/" t)) - (num-components (length components))) - (if (>= num-components 4) - (concat (car components) "/.../" - (mapconcat #'identity (last components 2) "/")) - abbrev))) - - (defun eshell-prompt-git-branch () - "Return the current git branch or short commit hash, if available." - (when (and (executable-find "git") - (locate-dominating-file default-directory ".git")) - (with-temp-buffer - (let ((ret (call-process "git" nil t nil "symbolic-ref" "--short" "HEAD"))) - (if (zerop ret) - (string-trim (buffer-string)) - (when (zerop (call-process "git" nil t nil "rev-parse" "--short" "HEAD")) - (string-trim (buffer-string)))))))) - - (defun eshell-prompt-git-dirty () - "Return a dirty flag (✗ if dirty, ✓ if clean) for the git repository." - (when (eshell-prompt-git-branch) - (with-temp-buffer - (call-process "git" nil t nil "status" "--porcelain") - (if (> (buffer-size) 0) "✗" "✓")))) - - (defun eshell-prompt () - "Custom eshell prompt." - (let* ((user (propertize (user-login-name) 'face 'eshell-prompt-user-face)) - (venv (when-let ((venv (getenv "VIRTUAL_ENV"))) - (concat (propertize "(" 'face 'eshell-prompt-venv-face) - (propertize (file-name-nondirectory venv) 'face 'eshell-prompt-venv-face) - (propertize ")" 'face 'eshell-prompt-venv-face)))) - (path (propertize (eshell-abbreviate-dir (eshell/pwd)) 'face 'eshell-prompt-dir-face)) - (git-branch (eshell-prompt-git-branch)) - (git-info (when git-branch - (concat " " (propertize "on" 'face 'font-lock-number-face) " " - (propertize git-branch 'face 'eshell-prompt-git-face) - (propertize (eshell-prompt-git-dirty) 'face 'eshell-prompt-git-dirty-face)))) - (prompt (concat user " " (propertize "in" 'face 'font-lock-number-face) " " - (if venv (concat venv " ") "") - path git-info "\n" - (propertize "λ" 'face 'eshell-prompt-symbol-face) " "))) - prompt)) - - (setq eshell-prompt-function 'eshell-prompt - eshell-prompt-regexp "^[^λ\n]*λ ")) - -(use-package disproject - :ensure t - :after project - :bind (:map ctl-x-map - ("p" . disproject-dispatch))) - -(use-package ibuffer-project - :ensure t - :after project - :config - (add-hook - 'ibuffer-hook - (lambda () - (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)) - (unless (eq ibuffer-sorting-mode 'project-file-relative) - (ibuffer-do-sort-by-project-file-relative)))) - (keymap-global-set "C-x C-b" 'ibuffer)) - -(progn - (add-hook 'emacs-startup-hook #'recentf-mode) - (keymap-global-set "C-x C-r" 'recentf-open) - (which-key-add-key-based-replacements "C-x C-r" "Recent Files") - (put 'compile-command 'safe-local-variable #'stringp)) - -(use-package savehist - :hook (after-init . savehist-mode)) - -(add-to-list 'Info-directory-list "/Users/venomade/Documents/Info/") - -;; Org Mode -(setq org-src-window-setup 'current-window - org-confirm-babel-evaluate nil - org-hide-emphasis-markers t) - -(font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) - -; (use-package org-bullets -; :ensure t -; :config -; (setq org-bullets-bullet-list -; '("◉" "○" "◎" "◈" "◆" "▶")) -; (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) - -(use-package org-superstar - :ensure t - :hook (org-mode . org-superstar-mode) - :custom - (org-superstar-remove-leading-stars nil) - (org-superstar-headline-bullets-list - '("◉" "○" "◎" "◈" "◆" "▶"))) - -(let* ((variable-tuple - (cond ((x-list-fonts "Google Sans") '(:font "Google Sans")) - ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) - (nil (warn "Cannot find a Sans Serif Font. Install Google Sans.")))) - (base-font-color (face-foreground 'default nil 'default)) - (headline `(:inherit default :weight bold :foreground ,base-font-color))) - - (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.2)))) - `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.3)))) - `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.4)))) - `(org-document-title ((t (,@headline ,@variable-tuple :height 1.6 :underline nil)))))) - -(add-hook 'org-mode-hook 'variable-pitch-mode) -(add-hook 'org-mode-hook 'visual-line-mode) -(add-hook 'org-mode-hook (lambda () (display-line-numbers-mode -1))) - -(custom-theme-set-faces - 'user - '(org-block ((t (:inherit fixed-pitch)))) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(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)))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) - -(require 'org-tempo) - -(use-package pdf-tools - :ensure t - :config - (pdf-tools-install) - (add-hook 'pdf-view-mode-hook (lambda () (display-line-numbers-mode -1)))) - -; Open Org Mode links in current window -(setq org-link-frame-setup - '((file . find-file) - (wl . wl-other-frame) - (vm . vm-visit-folder-other-frame) - (gnus . gnus))) - -(use-package denote - :ensure t - :hook (dired-mode . denote-dired-mode) - :bind - (("C-c n n" . denote) - ("C-c n r" . denote-rename-file) - ("C-c n l f" . denote-link) - ("C-c n b" . denote-backlinks) - ("C-c n g" . denote-grep)) - :config - (setq denote-directory (expand-file-name "~/Documents/Denotes/") - denote-known-keywords '("politics" "history" "united kingdom")) - (denote-rename-buffer-mode 1)) - -(use-package consult-denote - :ensure t - :bind - (("C-c n f" . consult-denote-find) - ("C-c n g" . consult-denote-grep)) - :config - (consult-denote-mode 1)) - -; TODO: Denote Explore https://lucidmanager.org/productivity/denote-explore/ - -(use-package denote-menu - :ensure t - :bind - (("C-c n d" . list-denotes)) - :config - (add-hook 'denote-menu-mode-hook (lambda () (display-line-numbers-mode -1)))) - -(use-package denote-org - :ensure t - :bind - (("C-c n l h" . denote-org-link-to-heading))) - -;; Completion -(use-package orderless - :ensure t - :config - (setq completion-styles '(orderless basic) - completion-category-defaults nil - completion-category-overrides '((file (styles . (partial-completion)))))) - -(use-package yasnippet - :ensure t - :hook (prog-mode . yas-minor-mode) - :bind - (("C-c y n" . yas-new-snippet) - ("C-c y v" . yas-visit-snippet-file) - ("C-c y i" . yas-insert-snippet)) - :config - (yas-reload-all)) - -(use-package yasnippet-snippets - :after yasnippet - :ensure t) - -(use-package cape - :ensure t) - -(defun eglot-capf-with-yasnippet () - (setq-local completion-at-point-functions - (list - (cape-capf-super - #'eglot-completion-at-point - #'yasnippet-capf)))) -(with-eval-after-load 'eglot - (add-hook 'eglot-managed-mode-hook #'eglot-capf-with-yasnippet)) - -(use-package corfu - :ensure t - :hook (after-init . global-corfu-mode) - :bind (:map corfu-map ("<tab>" . corfu-complete) - ("RET" . nil)) - :config - (setq corfu-cycle t - corfu-auto t - corfu-auto-delay 0.2 - corfu-preview-current nil - corfu-quit-at-boundary t - corfu-quit-no-match t - corfu-scroll-margin 5 - corfu-tab-always-indent 'complete - corfu-preview-current nil - corfu-min-width 20 - corfu-popupinfo-delay '(1.25 . 0.5)) - (corfu-popupinfo-mode 1) - (with-eval-after-load 'savehist - (corfu-history-mode 1) - (add-to-list 'savehist-additional-variables 'corfu-history))) - -(use-package nerd-icons-corfu - :ensure t - :after nerd-icons corfu - :config - (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) - -(use-package vertico - :ensure t - :hook (after-init . vertico-mode) - :bind (:map vertico-map - ("DEL" . vertico-directory-delete-char))) - -(use-package consult - :ensure t - :bind (("M-g g" . consult-goto-line) - ("M-g M-g" . consult-goto-line) - ("C-c s" . consult-line)) - - :config - (which-key-add-key-based-replacements "C-c s" "search-lines")) - -(use-package affe - :ensure t - :after consult - :bind (("C-c f f" . affe-find) - ("C-c f g" . affe-grep)) - :init - (which-key-add-key-based-replacements "C-c f" "find-file") - (which-key-add-key-based-replacements "C-c f f" "find-fuzzy") - (which-key-add-key-based-replacements "C-c f g" "find-greppy")) - -(use-package marginalia - :ensure t - :after vertico - :config (marginalia-mode 1)) - -(use-package nerd-icons-completion - :ensure t - :after vertico marginalia - :hook - (marginalia-mode . nerd-icons-completion-marginalia-setup) - (after-init . nerd-icons-completion-mode)) - -;; Version Control -(setq vc-follow-symlinks t) - -(use-package magit - :ensure t - :after nerd-icons - :custom - (magit-format-file-function #'magit-format-file-nerd-icons)) - -(use-package magit-todos - :ensure t - :after magit hl-todo - :config - (add-hook 'magit-log-wash-summary-hook - #'hl-todo-search-and-highlight t) - (add-hook 'magit-revision-wash-message-hook - #'hl-todo-search-and-highlight t) - (magit-todos-mode 1)) - -;; Programming -(use-package eglot - :ensure t - :after cape - :config - (setq eglot-report-progress nil) - (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) - (add-hook 'c-mode-hook #'eglot-ensure)) - -(use-package eglot-booster - :vc (:url "https://github.com/jdtsmith/eglot-booster.git") - :ensure t - :after eglot - :config - (setq eglot-booster-io-only t) - (eglot-booster-mode)) - -(use-package consult-eglot - :ensure t - :after eglot) - -(progn - (use-package eldoc-box - :ensure t) - - (defun markdown-follow-help-or-link-at-point-advice (orig-fun &rest args) - "Prefer to use the help-echo property as `browse-url' target." - (let* ((event-win (posn-window (event-start last-input-event))) - (help-echo (with-selected-frame (window-frame event-win) - (with-current-buffer (window-buffer event-win) - (get-text-property (point) 'help-echo)))) - (help-is-url (url-type (url-generic-parse-url help-echo)))) - (message "if %s (browse-url %S)" help-is-url help-echo) - (if help-is-url - (browse-url help-echo) - (apply orig-fun args)))) - - (advice-add 'markdown-follow-link-at-point :around #'markdown-follow-help-or-link-at-point-advice)) - -(transient-define-prefix eglot-transient () - "Transient menu for Eglot." - [["Server" - ("c" "Reconnect" eglot-reconnect) - ("q" "Shutdown" eglot-shutdown) - ("I" "Server Info" eglot-show-workspace-configuration)] - ["Navigation" - ("g" "Go to Definition" xref-find-definitions) - ("d" "Describe Thing at Point" eldoc-box-help-at-point) - ("D" "Go to Declaration" eglot-find-declaration) - ("i" "Go to Implementation" eglot-find-implementation) - ("f" "Find References" xref-find-references) - ("t" "Type Definition" eglot-find-typeDefinition) - ("s" "Search Symbols" - (lambda () - (interactive) - (if (eq major-mode 'java-mode) - (call-interactively 'consult-eglot-jdt-symbols) - (call-interactively 'consult-eglot-symbols))))] - ["Code Actions" - ("a" "Code Actions" eglot-code-actions) - ("q" "Quick Fix" eglot-code-action-quickfix) - ("=" "Format Buffer" eglot-format-buffer) - ("o" "Organize Imports" eglot-code-action-organize-imports) - ("r" "Rename Symbol" eglot-rename)] - ["Diagnostics" - ("l" "List Diagnostics" flycheck-list-errors) - ("L" "Project Diagnostics" flymake-show-project-diagnostics)]] - (interactive) - (transient-setup 'eglot-transient)) - -(define-key eglot-mode-map (kbd "C-c l") #'eglot-transient) - -(use-package flycheck - :ensure t - :config - (global-flycheck-mode 1)) - -(use-package flycheck-eglot - :ensure t - :after (flycheck eglot) - :custom (flycheck-eglot-exclusive nil) - :config - (global-flycheck-eglot-mode 1)) - -(setq-default flycheck-disabled-checkers '(c/c++-clang)) - -(progn - (setq compilation-scroll-output t) - (keymap-global-set "C-c m c" 'compile) - (keymap-global-set "C-c m r" 'recompile) - (which-key-add-key-based-replacements "C-c m" "make")) - -(require 'ansi-color) -(defun colorize-compilation-buffer () - (ansi-color-apply-on-region compilation-filter-start (point))) -(add-hook 'compilation-filter-hook 'colorize-compilation-buffer) - -(global-prettify-symbols-mode 1) - -;; Languages - -; (load-file -; (expand-file-name -; "lang/java.el" -; user-emacs-directory)) - -(load-file - (expand-file-name - "lang/lua.el" - user-emacs-directory)) - -; (load-file -; (expand-file-name -; "lang/lisp.el" -; user-emacs-directory)) - -; (load-file -; (expand-file-name -; "lang/clojure.el" -; user-emacs-directory)) - -;; Font -; Putting at the end to test if it fixes this: -; https://github.com/d12frosted/homebrew-emacs-plus/issues/898 - -(let* ((fontconf '((fixed-font . "Google Sans Code") - (variable-font . "Google Sans") - (size . 12))) - (fixed-font (cdr (assoc 'fixed-font fontconf))) - (variable-font (cdr (assoc 'variable-font fontconf))) - (pt-size (cdr (assoc 'size fontconf))) - (height (* pt-size 10)) - (frame-font (concat fixed-font "-" (number-to-string pt-size)))) - ; Fixed-width faces - (dolist (face '(default fixed-pitch)) - (set-face-attribute face nil - :font fixed-font - :height height - :weight 'regular)) - ; Variable-pitch face - (set-face-attribute 'variable-pitch nil - :font variable-font - :height height - :weight 'regular) - - ; Syntax styling - (set-face-attribute 'font-lock-comment-face nil :slant 'italic) - (set-face-attribute 'font-lock-keyword-face nil :slant 'italic) - - ; Frame font - (add-to-list 'default-frame-alist `(font . ,frame-font))) diff --git a/.emacs.d/lang/clojure.el b/.emacs.d/lang/clojure.el deleted file mode 100644 index 804fcc7..0000000 --- a/.emacs.d/lang/clojure.el +++ /dev/null @@ -1,26 +0,0 @@ -(use-package cider - :ensure t) - -(add-hook 'cider-repl-mode-hook (lambda () (display-line-numbers-mode -1))) -(add-hook 'cider-repl-mode-hook #'smartparens-mode) -(add-hook 'clojure-mode #'eglot-ensure t) - -(setq-default cider-eldoc-display-for-symbol-at-point nil) - -(defun mu-cider-disable-eldoc () - "Let LSP handle ElDoc instead of CIDER." - (remove-hook 'eldoc-documentation-functions #'cider-eldoc t)) - -(add-hook 'cider-mode-hook #'mu-cider-disable-eldoc) - -(defun mu-cider-disable-eldoc () - "Let LSP handle ElDoc instead of CIDER." - (remove-hook 'eldoc-documentation-functions #'cider-eldoc t)) - -(add-hook 'cider-mode-hook #'mu-cider-disable-eldoc) - -(defun mu-cider-disable-completion () - "Let LSP handle completion instead of CIDER." - (remove-hook 'completion-at-point-functions #'cider-complete-at-point t)) - -(add-hook 'cider-mode-hook #'mu-cider-disable-completion) diff --git a/.emacs.d/lang/java.el b/.emacs.d/lang/java.el deleted file mode 100644 index 5d41a0c..0000000 --- a/.emacs.d/lang/java.el +++ /dev/null @@ -1,38 +0,0 @@ -;; Emacs Configuration for Java - -; JDT URI fix for JDTLS from https://www.reddit.com/r/emacs/comments/1ibkh2h/comment/m9slw00/ -(with-eval-after-load 'eglot - (add-to-list 'eglot-server-programs - `((java-mode java-ts-mode) . - ("jdtls" - :initializationOptions - (:extendedClientCapabilities (:classFileContentsSupport t)))))) - -(defun jdt-file-name-handler (operation &rest args) - "Support Eclipse jdtls `jdt://' uri scheme." - (let* ((uri (car args)) - (cache-dir "/tmp/.eglot") - (source-file - (expand-file-name - (file-name-concat - cache-dir - (save-match-data - (when (string-match "jdt://contents/\\(.*?\\)/\\(.*\\)\.class\\?" uri) - (format "%s.java" (replace-regexp-in-string "/" "." (match-string 2 uri) t t)))))))) - (unless (file-readable-p source-file) - (let ((content (jsonrpc-request (eglot-current-server) :java/classFileContents (list :uri uri))) - (metadata-file (format "%s.%s.metadata" - (file-name-directory source-file) - (file-name-base source-file)))) - (unless (file-directory-p cache-dir) (make-directory cache-dir t)) - (with-temp-file source-file (insert content)) - (with-temp-file metadata-file (insert uri)))) - source-file)) -(add-to-list 'file-name-handler-alist '("\\`jdt://" . jdt-file-name-handler)) - -(add-hook 'java-mode-hook #'eglot-ensure t) - -(load-file - (expand-file-name - "pkg/consult-jdt.el" - user-emacs-directory)) diff --git a/.emacs.d/lang/lisp.el b/.emacs.d/lang/lisp.el deleted file mode 100644 index b0aebd3..0000000 --- a/.emacs.d/lang/lisp.el +++ /dev/null @@ -1,9 +0,0 @@ -(use-package sly - :ensure t - :config - (setq inferior-lisp-program "ros -L sbcl -Q run" - browse-url-browser-function '(("hyperspec" . eww-browse-url) ("." . browse-url-default-browser))) - (add-hook 'sly-mrepl-mode-hook 'smartparens-mode) - (add-hook 'lisp-mode-hook - (lambda () - (define-key lisp-mode-map (kbd "C-c d") 'sly-documentation)))) diff --git a/.emacs.d/lang/lua.el b/.emacs.d/lang/lua.el deleted file mode 100644 index dfc1b19..0000000 --- a/.emacs.d/lang/lua.el +++ /dev/null @@ -1,11 +0,0 @@ -;; Emacs Configuration for Lua - -(use-package lua-mode - :ensure t - :config - (add-hook 'lua-mode-hook #'eglot-ensure t) - (setq lua-indent-level 2 - lua-documentation-url "https://www.lua.org/manual/5.4/manual.html")) - -; TODO Try fix this only for lua-mode as that is where the bug is -(setq eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider)) diff --git a/.emacs.d/pkg/consult-jdt.el b/.emacs.d/pkg/consult-jdt.el deleted file mode 100644 index 6959f72..0000000 --- a/.emacs.d/pkg/consult-jdt.el +++ /dev/null @@ -1,105 +0,0 @@ -(require 'consult) -(require 'eglot) -(require 'jsonrpc) -(require 'subr-x) - -(defvar eglot-jdt--symbolkind-map - '((1 . "File") (2 . "Module") (3 . "Namespace") (4 . "Package") - (5 . "Class") (6 . "Method") (7 . "Property") (8 . "Field") - (9 . "Constructor") (10 . "Enum") (11 . "Interface") (12 . "Function") - (13 . "Variable") (14 . "Constant") (15 . "String") (16 . "Number") - (17 . "Boolean") (18 . "Array") (19 . "Object") (20 . "Key") - (21 . "Null") (22 . "EnumMember") (23 . "Struct") (24 . "Event") - (25 . "Operator") (26 . "TypeParameter")) - "Mapping of LSP SymbolKind integers to human-readable names.") - -(defun eglot-jdt--get (obj key) - "Robustly retrieve KEY from LSP OBJ (plist/alist)." - (let* ((kname (substring (symbol-name key) 1)) - (sym-key (intern kname))) - (or (plist-get obj key) - (alist-get key obj) - (alist-get sym-key obj) - (alist-get kname obj)))) - -(defun eglot-jdt--fetch-symbols (&optional query) - "Synchronously fetch workspace symbols for QUERY from Eglot/JDTLS." - (unless (eglot-managed-p) - (user-error "Eglot is not managing this buffer")) - (let* ((server (eglot-current-server)) - (symbols (jsonrpc-request server :workspace/symbol `(:query ,(or query ""))))) - (when (vectorp symbols) - (setq symbols (append symbols nil))) - symbols)) - -;; Helper to pad strings -(defun eglot-jdt--pad-right (str width) - "Pad STR on the right with spaces to WIDTH." - (let ((len (length str))) - (if (< len width) - (concat str (make-string (- width len) ?\s)) - str))) - -;; Main formatting function with faces -(defun eglot-jdt--format-symbols-table (symbols) - "Format SYMBOLS into a table with faces for Consult, showing Kind first." - (let* ((rows (mapcar (lambda (sym) - (let ((kind-num (eglot-jdt--get sym :kind))) - (list (or (alist-get kind-num eglot-jdt--symbolkind-map) - (format "Kind %s" kind-num)) - (eglot-jdt--get sym :name) - (or (eglot-jdt--get sym :containerName) "<no-package>") - (let ((location (eglot-jdt--get sym :location))) - (eglot-jdt--get location :uri))))) - symbols)) - ;; compute max width for each column - (max-kind (apply #'max (mapcar (lambda (r) (length (nth 0 r))) rows))) - (max-name (apply #'max (mapcar (lambda (r) (length (nth 1 r))) rows))) - (max-package (apply #'max (mapcar (lambda (r) (length (nth 2 r))) rows))) - ;; faces - (divider-face 'shadow) ;; low opacity / dim for dividers - (kind-face 'font-lock-function-name-face) - (name-face 'font-lock-variable-name-face) - (package-face 'font-lock-keyword-face)) - ;; create table rows with faces - (mapcar (lambda (r) - (let* ((kind (propertize (eglot-jdt--pad-right (nth 0 r) max-kind) 'face kind-face)) - (name (propertize (eglot-jdt--pad-right (nth 1 r) max-name) 'face name-face)) - (package (propertize (eglot-jdt--pad-right (nth 2 r) max-package) 'face package-face)) - (divider (propertize "|" 'face divider-face))) - (cons (format "%s %s %s %s %s" - kind divider name divider package) - (nth 3 r)))) - rows))) - -(defun eglot-jdt--open-uri (uri) - "Open a URI returned by the language server, handling jdt:// URIs." - (if (and uri (string-prefix-p "jdt://" uri)) - (find-file (expand-file-name uri)) ; your jdt-file-name-handler takes care of this - (find-file (eglot-uri-to-path uri)))) - -(defun eglot-jdt--sort-by-query (symbols query) - "Sort SYMBOLS by how closely their names match QUERY." - (let ((query (or query ""))) - (sort symbols - (lambda (a b) - (< (string-distance (eglot-jdt--get a :name) query) - (string-distance (eglot-jdt--get b :name) query)))))) - -(defun consult-eglot-jdt-symbols (&optional query) - "Consult interface for Java workspace symbols via Eglot/JDTLS. -Sorts results based on closeness to QUERY." - (interactive "sSymbol query (blank for all): ") - (let* ((symbols (eglot-jdt--fetch-symbols query)) - (sorted-symbols (eglot-jdt--sort-by-query symbols query)) - (candidates (eglot-jdt--format-symbols-table sorted-symbols)) - (selection (consult--read - (mapcar #'car candidates) - :prompt "Symbol: " - :sort nil - :require-match t - :category 'symbol))) - (when selection - (let ((uri (cdr (assoc selection candidates)))) - (when uri - (eglot-jdt--open-uri uri)))))) diff --git a/.emacs.d/pkg/flymake-cppcheck.el b/.emacs.d/pkg/flymake-cppcheck.el deleted file mode 100644 index 92a78de..0000000 --- a/.emacs.d/pkg/flymake-cppcheck.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; flymake-cppcheck.el --- Flymake work with Cppcheck for C/C++ - -;; Copyright 2014 Akiha Senda - -;; Author: Akiha Senda <senda.akiha@gmail.com> -;; URL: https://github.com/senda-akiha/flymake-cppcheck/ -;; Created: 13 January 2014 -;; Version: 1.0.0 -;; Keywords: flymake, cppcheck, C, C++ -;; Package-Requires: ((flymake-easy "0.9")) - -;; This file is not part of GNU Emacs. -;; However, it is distributed under the same license. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; Please check the GitHub -;; (https://github.com/senda-akiha/flymake-cppcheck/) -;; for more information. - -;;; Code: - -(require 'flymake-easy) - -(defconst flymake-cppcheck-err-line-patterns - '(("\\(.*\\)::\\([[:digit:]]+\\)::\\(.*\\)\r?\n" - 1 2 nil 3))) - -(defconst flymake-cppcheck-template "{file}::{line}::{message}" - "Output format template.") - -(defcustom flymake-cppcheck-enable "error" - "By default only error messages are shown. -Through the --enable command more checks can be enabled." - :type 'string - :group 'flymake-cppcheck) - -(defcustom flymake-cppcheck-command (or (executable-find "cppcheck") "") - "The name of the cppcheck executable." - :type 'string - :group 'flymake-cppcheck) - -(defcustom flymake-cppcheck-location 'inplace - "Where to create the temporary copy: one of 'tempdir or 'inplace (default)." - :type `(choice - (const :tag "In place" inplace) - (const :tag "Temporary location" tempdir)) - :group 'flymake-cppcheck) - -(defun flymake-cppcheck-build-command-line (filename) - "Construct a command that flymake can use to check C/C++ source." - (list flymake-cppcheck-command "--quiet" - (concat "--template=" flymake-cppcheck-template) - (if (string-match "error" flymake-cppcheck-enable) - "" (concat "--enable=" flymake-cppcheck-enable)) - filename)) - -;;;###autoload -(defun flymake-cppcheck-load () - "Configure flymake mode to check the current buffer's C/C++ source." - (interactive) - (flymake-easy-load 'flymake-cppcheck-build-command-line - flymake-cppcheck-err-line-patterns - flymake-cppcheck-location - "cpp")) - -(provide 'flymake-cppcheck) - -;;; flymake-cppcheck.el ends here |
