From d4f779d7d43bef2c655c1b3c44e5d92644989dca Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Mon, 6 Apr 2026 07:34:05 -0400 Subject: Update emacs config to use project.el --- .emacs.d/modules/et-appearance.el | 56 --------------------- .emacs.d/modules/et-completion.el | 83 ------------------------------ .emacs.d/modules/et-format.el | 12 ----- .emacs.d/modules/et-keys.el | 12 ----- .emacs.d/modules/et-lsp.el | 13 ----- .emacs.d/modules/et-navigation.el | 39 --------------- .emacs.d/modules/et-package.el | 38 -------------- .emacs.d/modules/et-utils.el | 35 ------------- .emacs.d/modules/et-vc.el | 103 -------------------------------------- 9 files changed, 391 deletions(-) delete mode 100644 .emacs.d/modules/et-appearance.el delete mode 100644 .emacs.d/modules/et-completion.el delete mode 100644 .emacs.d/modules/et-format.el delete mode 100644 .emacs.d/modules/et-keys.el delete mode 100644 .emacs.d/modules/et-lsp.el delete mode 100644 .emacs.d/modules/et-navigation.el delete mode 100644 .emacs.d/modules/et-package.el delete mode 100644 .emacs.d/modules/et-utils.el delete mode 100644 .emacs.d/modules/et-vc.el (limited to '.emacs.d/modules') diff --git a/.emacs.d/modules/et-appearance.el b/.emacs.d/modules/et-appearance.el deleted file mode 100644 index 7034d9a..0000000 --- a/.emacs.d/modules/et-appearance.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; et-appearance --- Configuration for the "Look" of Emacs -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;;; Code: -(require 'et-utils) - -(defvar et-monospace-font "Hack Nerd Font Mono" - "The font used by default and for any monospaced font usage.") -(defvar et-monospace-font-size (if (et-is-desktop-p) 192 160)) -(set-face-attribute 'default nil - :font (symbol-value 'et-monospace-font) - :height (symbol-value 'et-monospace-font-size)) - -;; Start emacs in full screen -;; -;; The t parameter appends to the hook, instead of prepending. -;; This means it'll be run after other hooks that might fiddle -;; with the frame size. -(add-hook 'window-setup-hook 'toggle-frame-maximized t) - -; Remove the menu bar (File Edit Options...) -(menu-bar-mode -1) - -; Remove the tool bar (if using the GUI) -(tool-bar-mode -1) - -; Skip the welcome screen -(setq inhibit-startup-screen t) - -;; Rather than an auditory noise, use a visual -;; flash instead. -(setq visible-bell t) - -;; Default to using line numbers in all modes -;; and turn them off one by one in the particular -;; modes where they don't make as much sense. -(global-display-line-numbers-mode 1) -(dolist (mode '(text-mode-hook - org-mode-hook - term-mode-hook - eshell-mode-hook - shell-mode-hook - special-mode-hook)) - (add-hook mode (lambda () (display-line-numbers-mode 0)))) - -(use-package nord-theme - :config - (load-theme 'nord t)) - -(use-package nerd-icons) -(use-package doom-modeline - :init (doom-modeline-mode 1)) - -(provide 'et-appearance) -;;; et-appearance.el ends here diff --git a/.emacs.d/modules/et-completion.el b/.emacs.d/modules/et-completion.el deleted file mode 100644 index e0fc230..0000000 --- a/.emacs.d/modules/et-completion.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; et-completion.el --- Enhance the Emacs completion behavior -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;;; Code: - -;; Add a vertical completion UI -(use-package vertico - :custom - (vertico-cycle t) - :init - (vertico-mode)) - -;; Adjust completion search behavior -(use-package orderless - :ensure t - :custom - (completion-styles '(orderless basic)) - (completion-category-overrides '((file (styles partial-completion)))) - (completion-pcm-leading-wildcard t)) - -;; Persist history over emacs restarts. -;; This allows vertico to sort by history position. -(use-package savehist - :init - (savehist-mode)) - -;; Add documentation alongside the completion items -(use-package marginalia - :init - (marginalia-mode)) - -(use-package corfu - :custom - (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' - ;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary - ;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match - ;; (corfu-preview-current nil) ;; Disable current candidate preview - ;; (corfu-preselect 'prompt) ;; Preselect the prompt - ;; (corfu-on-exact-match 'insert) ;; Configure handling of exact matches - (corfu-popupinfo-delay '(0.5 . 0.2)) ;; (first-show . subsequent) - (corfu-popupinfo-max-height 15) - (corfu-auto t) - (corfu-auto-delay 0.2) - (corfu-auto-trigger ".") - (corfu-quit-no-match 'separator) - - :init - (global-corfu-mode) - (corfu-history-mode) - (corfu-popupinfo-mode)) - -(use-package dabbrev - ;; Swap M-/ and C-M-/ - :bind (("M-/" . dabbrev-completion) - ("C-M-/" . dabbrev-expand)) - :config - (add-to-list 'dabbrev-ignored-buffer-regexps "\\` ") - (add-to-list 'dabbrev-ignored-buffer-modes 'authinfo-mode) - (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode) - (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode) - (add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode)) - -(use-package emacs - :custom - ;; TAB cycle if there are only few candidates - ;; (completion-cycle-threshold 3) - - ;; Enable indentation+completion using the TAB key. - ;; `completion-at-point' is often bound to M-TAB. - (tab-always-indent 'complete) - - ;; Emacs 30 and newer: Disable Ispell completion function. - ;; Try `cape-dict' as an alternative. - (text-mode-ispell-word-completion nil) - - ;; Hide commands in M-x which do not apply to the current mode. Corfu - ;; commands are hidden, since they are not used via M-x. This setting is - ;; useful beyond Corfu. - (read-extended-command-predicate #'command-completion-default-include-p)) - -(provide 'et-completion) -;;; et-completion.el ends here diff --git a/.emacs.d/modules/et-format.el b/.emacs.d/modules/et-format.el deleted file mode 100644 index be4b9ac..0000000 --- a/.emacs.d/modules/et-format.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; et-format.el --- Code formatting configuration ;; -*- lexical-binding: t; -*- -;;; Commentary: -;; -;;; Code: - -(use-package flycheck - :init (global-flycheck-mode)) - -(setq-default flycheck-emacs-lisp-load-path 'inherit) - -(provide 'et-format) -;;; et-format.el ends here diff --git a/.emacs.d/modules/et-keys.el b/.emacs.d/modules/et-keys.el deleted file mode 100644 index 2b5a640..0000000 --- a/.emacs.d/modules/et-keys.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; et-keys.el --- Set misc. custom keybindings -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;;; Code: - -;; Make ESC quit prompts. C-g will also do this, but it's -;; a convienence for my vim-pilled brain. -(global-set-key (kbd "") 'keyboard-escape-quit) - -(provide 'et-keys) -;;; et-keys.el ends here diff --git a/.emacs.d/modules/et-lsp.el b/.emacs.d/modules/et-lsp.el deleted file mode 100644 index 8560c46..0000000 --- a/.emacs.d/modules/et-lsp.el +++ /dev/null @@ -1,13 +0,0 @@ -;;; et-lsp.el --- Setup LSP servers for necessary languages -*- lexical-binding: t; -*- -;;; Commentary: -;;; Code: - -(use-package eglot - :defer t - :hook ((python-mode . eglot-ensure) - (go-mode . eglot-ensure)) - :config - (add-to-list 'eglot-server-programs '(python-mode . ("ty" "server")))) - -(provide 'et-lsp) -;;; et-lsp.el ends here diff --git a/.emacs.d/modules/et-navigation.el b/.emacs.d/modules/et-navigation.el deleted file mode 100644 index e434ade..0000000 --- a/.emacs.d/modules/et-navigation.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; et-navigation.el --- Emacs navigation utiltiies -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;; This module overrides the "scroll up page" and "scroll down page" -;; default Emacs key mappings to only scroll up and down half a page. -;; -;;; Code: - -(global-set-key (kbd "C-v") - 'et-scroll-down-half-page) - -(global-set-key (kbd "M-v") - 'et-scroll-up-half-page) - -(defun et-scroll-down-half-page () - "Scroll down half a page while keeping the cursor centered." - (interactive) - (let ((ln (line-number-at-pos)) - (lmax (line-number-at-pos (point-max)))) - (cond ((= ln 1) (move-to-window-line nil)) - ((= ln lmax) (recenter (window-end))) - (t (progn - (move-to-window-line -1) - (recenter)))))) - -(defun et-scroll-up-half-page () - "Scroll up half a page while keeping the cursor centered." - (interactive) - (let ((ln (line-number-at-pos)) - (lmax (line-number-at-pos (point-max)))) - (cond ((= ln 1) nil) - ((= ln lmax) (move-to-window-line nil)) - (t (progn - (move-to-window-line 0) - (recenter)))))) - -(provide 'et-navigation) -;;; et-navigation.el ends here diff --git a/.emacs.d/modules/et-package.el b/.emacs.d/modules/et-package.el deleted file mode 100644 index 1a99b12..0000000 --- a/.emacs.d/modules/et-package.el +++ /dev/null @@ -1,38 +0,0 @@ -;;; et-package.el --- Bootstrap Emacs package management and use-package -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;;; Code: - -;; First, we want to setup package.el for installing packages. -;; This is emac's built-in package manager, and we'll use it -;; to install use-package itself. -;; -;; To list the packages and see what is avaiable, we can use -;; M-x list-packages. -(require 'package) - -;; Package archives are where we want to install packages from. -;; It is expected that we setup this variable before we call -;; package-initialize. -(setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) -(package-initialize) - -;; If use package isn't installed on the current system, -;; we want to build the package contents and install use-package. -;; -;; Do note that the package contents can get out of date, and there -;; is no automatic process here for refreshing them. Instead, we'll -;; need to do M-x package-refresh-contents occasionally. -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - -(require 'use-package) -;; Always ensure anything used via use-package is installed. -(setq use-package-always-ensure t) - -(provide 'et-package) -;;; et-package.el ends here diff --git a/.emacs.d/modules/et-utils.el b/.emacs.d/modules/et-utils.el deleted file mode 100644 index d14bc17..0000000 --- a/.emacs.d/modules/et-utils.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; et-utils.el --- Utilities for my Emacs configuration -*- lexical-binding: t; -*- -;; -;;; Commentary: -;; -;;; Code: - -(defun et-is-desktop-p () - "Check if the current system is my desktop system." - (string-match-p "desktop" (system-name))) - -(defun et-insert-elisp-template (summary) - "Insert a elisp template into the buffer. - -SUMMARY will be inserted into the header docstring -as the file summary." - (interactive (list (read-string "summary: "))) - (let ((move-to-center-of-code-section (lambda () (forward-line -3))) - (get-current-file-name (lambda () (file-name-sans-extension (file-name-nondirectory buffer-file-name)))) - (get-module-template (lambda (module-name summary) - (format ";;; %s.el --- %s -*- lexical-binding: t; -*- -;;; Commentary: -;;; Code: - - - -(provide '%s) -;;; %s.el ends here" module-name summary module-name module-name)))) - (if (not (buffer-file-name)) - (message "No file visited.") - (progn - (insert (funcall get-module-template (funcall get-current-file-name) summary)) - (funcall move-to-center-of-code-section))))) - -(provide 'et-utils) -;;; et-utils.el ends here diff --git a/.emacs.d/modules/et-vc.el b/.emacs.d/modules/et-vc.el deleted file mode 100644 index fc78138..0000000 --- a/.emacs.d/modules/et-vc.el +++ /dev/null @@ -1,103 +0,0 @@ -;;; et-vc.el --- Version control configuration -*- lexical-binding:t -*- -;; -;;; Commentary: -;; -;;; Code: -(require 'vc-git) - -(use-package magit) - -(global-set-key (kbd "C-c gu") - 'et-generate-remote-git-url) - -(defun et-generate-remote-git-url () - "Generate a remote URL for the current buffer file and line number. - -* The remote URL can be HTTPS or SSH. -* The git hosting provider is determined via the git remote `origin` url. -* Only Github and SourceHut are supported as a hosting provider. - -For example, if the point is on line 12 of example.el on head SHA -abc123, and the git remote origin url is set to a github URL, then a -URL such https://github.com/myuser/myrepo/blob/abc123/example.el#L12 -would be added to the kill ring." - (interactive) - - (if (not buffer-file-name) - (message "Not visiting a file.") - (let* ((remote-url (vc-git-repository-url buffer-file-name "origin")) - (head-sha (vc-git-working-revision buffer-file-name)) - (relative-file-path (file-relative-name buffer-file-name - (vc-git-root buffer-file-name))) - (line-num (line-number-at-pos))) - - (if (et--is-supported-provider-p remote-url) - (progn - (kill-new (et--generate-remote-git-url remote-url head-sha relative-file-path line-num)) - (message "Copied remote git URL")) - (message (format "%s is not a supported git hosting provider." remote-url)))))) - -(defun et--is-supported-provider-p (url) - "Check whether URL is a supported git hosting provider for URL generation." - (not (null (et--get-git-hosting-provider url)))) - -(defun et--get-git-hosting-provider (url) - "Get the git hosting provider for the given URL. - -The supported providers are github and sourcehut. If the URL -corresponds to an unsupported provider, null is returned." - (cond - ((string-match-p "github\\.com" url) 'github) - ((string-match-p "git\\.sr\\.ht" url) 'sourcehut))) - -(defun et--generate-remote-git-url (remote-url head-sha relative-file-path line-num) - (let ((provider (et--get-git-hosting-provider remote-url))) - (cond - ((eq 'github provider) - (et--gh-generate-remote-git-url remote-url head-sha relative-file-path line-num)) - ((eq 'sourcehut provider) - (et--sh-generate-remote-git-url remote-url head-sha relative-file-path line-num))))) - -(defun et--gh-generate-remote-git-url (remote-url head-sha relative-file-path line-num) - (format "https://github.com/%s/blob/%s/%s#L%d" - (et--extract-repo-path "https://github.com" remote-url) - head-sha - relative-file-path - line-num)) - -(defun et--sh-generate-remote-git-url (remote-url head-sha relative-file-path line-num) - (format "https://git.sr.ht/%s/tree/%s/item/%s#L%d" - (et--extract-repo-path "https://git.sr.ht" remote-url) - head-sha - relative-file-path - line-num)) - -(defun et--extract-repo-path (base-url remote-url) - "Extract the repository path from the REMOTE-URL. - -BASE-URL is used to determine where the repository part of the -REMOTE-URL starts if the REMOTE-URL is a http URL. - -Example: - (et--extract-repo-path - \"https://github.com\" - \"https://github.com/user/repo\") - => \"user/repo\" - - (et--extract-repo-path - \"https://git.sr.ht\" - \"git@git.sr.ht:~eugenetriguba/repo\") - => \"~eugenetriguba/repo\"" - (if (et--git-ssh-url-p remote-url) - (substring remote-url (+ 1 (string-match ":" remote-url))) - (replace-regexp-in-string - (format "%s/\\(.*?\\)\\(.git\\)?$" base-url) - "\\1" - remote-url))) - -(defun et--git-ssh-url-p (url) - "Check whether URL is a SSH-based Git origin URL." - (string-prefix-p "git@" url)) - -(provide 'et-vc) -;;; et-vc.el ends here -- cgit v1.2.3