diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-04-02 21:37:38 -0400 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-04-02 21:37:38 -0400 |
| commit | 0b2d5401961415300f643ca7fd443f523bada244 (patch) | |
| tree | a712f6533f61af23d2cfcba8160ae7c58f53da4f | |
| parent | Remove outdated sentence in init.el docstring (diff) | |
| download | dotfiles-0b2d5401961415300f643ca7fd443f523bada244.zip | |
Use et- namespace consistently everywhere in emacs config
| -rw-r--r-- | .emacs.d/init.el | 6 | ||||
| -rw-r--r-- | .emacs.d/modules/et-appearance.el | 2 | ||||
| -rw-r--r-- | .emacs.d/modules/et-utils.el | 2 | ||||
| -rw-r--r-- | .emacs.d/modules/et-vc.el | 42 |
4 files changed, 25 insertions, 27 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 494cb5e..0a5469c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -5,10 +5,8 @@ ;; ;; The majority of the configuration lives within the modules/ ;; directory. Each module is intended to be a self-contained unit for -;; some aspect of my usage of Emacs. Each module name is prefixed -;; with et- to namespace them. Furthermore, all public definitions -;; *within* a module are prefixed by the module name -;; e.g. et-vc-generate-remote-git-url. +;; some aspect of my usage of Emacs. Each module name and definitions +;; within a module is prefixed with et- to namespace them. ;; ;; Because the configuration is generally in these module files, the ;; primary role of init.el is to bootstrap the loading of these diff --git a/.emacs.d/modules/et-appearance.el b/.emacs.d/modules/et-appearance.el index b11ceea..7034d9a 100644 --- a/.emacs.d/modules/et-appearance.el +++ b/.emacs.d/modules/et-appearance.el @@ -7,7 +7,7 @@ (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-utils-is-desktop-p) 192 160)) +(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)) diff --git a/.emacs.d/modules/et-utils.el b/.emacs.d/modules/et-utils.el index c75091f..a924389 100644 --- a/.emacs.d/modules/et-utils.el +++ b/.emacs.d/modules/et-utils.el @@ -4,7 +4,7 @@ ;; ;;; Code: -(defun et-utils-is-desktop-p () +(defun et-is-desktop-p () "Check if the current system is my desktop system." (string-match-p "desktop" (system-name))) diff --git a/.emacs.d/modules/et-vc.el b/.emacs.d/modules/et-vc.el index 559e14e..fc78138 100644 --- a/.emacs.d/modules/et-vc.el +++ b/.emacs.d/modules/et-vc.el @@ -1,4 +1,4 @@ -;;; et-vc --- Version control configuration -*- lexical-binding:t -*- +;;; et-vc.el --- Version control configuration -*- lexical-binding:t -*- ;; ;;; Commentary: ;; @@ -8,9 +8,9 @@ (use-package magit) (global-set-key (kbd "C-c gu") - 'et-vc-generate-remote-git-url) + 'et-generate-remote-git-url) -(defun et-vc-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. @@ -31,17 +31,17 @@ would be added to the kill ring." (vc-git-root buffer-file-name))) (line-num (line-number-at-pos))) - (if (et-vc--is-supported-provider-p remote-url) + (if (et--is-supported-provider-p remote-url) (progn - (kill-new (et-vc--generate-remote-git-url remote-url head-sha relative-file-path line-num)) + (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-vc--is-supported-provider-p (url) +(defun et--is-supported-provider-p (url) "Check whether URL is a supported git hosting provider for URL generation." - (not (null (et-vc--get-git-hosting-provider url)))) + (not (null (et--get-git-hosting-provider url)))) -(defun et-vc--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 @@ -50,52 +50,52 @@ corresponds to an unsupported provider, null is returned." ((string-match-p "github\\.com" url) 'github) ((string-match-p "git\\.sr\\.ht" url) 'sourcehut))) -(defun et-vc--generate-remote-git-url (remote-url head-sha relative-file-path line-num) - (let ((provider (et-vc--get-git-hosting-provider remote-url))) +(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-vc--gh-generate-remote-git-url remote-url head-sha relative-file-path line-num)) + (et--gh-generate-remote-git-url remote-url head-sha relative-file-path line-num)) ((eq 'sourcehut provider) - (et-vc--sh-generate-remote-git-url remote-url head-sha relative-file-path line-num))))) + (et--sh-generate-remote-git-url remote-url head-sha relative-file-path line-num))))) -(defun et-vc--gh-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-vc--extract-repo-path "https://github.com" remote-url) + (et--extract-repo-path "https://github.com" remote-url) head-sha relative-file-path line-num)) -(defun et-vc--sh-generate-remote-git-url (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-vc--extract-repo-path "https://git.sr.ht" remote-url) + (et--extract-repo-path "https://git.sr.ht" remote-url) head-sha relative-file-path line-num)) -(defun et-vc--extract-repo-path (base-url remote-url) +(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-vc--extract-repo-path + (et--extract-repo-path \"https://github.com\" \"https://github.com/user/repo\") => \"user/repo\" - (et-vc--extract-repo-path + (et--extract-repo-path \"https://git.sr.ht\" \"git@git.sr.ht:~eugenetriguba/repo\") => \"~eugenetriguba/repo\"" - (if (et-vc--git-ssh-url-p remote-url) + (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-vc--git-ssh-url-p (url) +(defun et--git-ssh-url-p (url) "Check whether URL is a SSH-based Git origin URL." (string-prefix-p "git@" url)) |