From 91ff02afe16abc040f614562386cffecbd727fc2 Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:47:27 +0200 Subject: [PATCH 1/6] config: Fix indention by emacs auto indent Use the indention that emacs applies when auto indenting. --- .emacs.d/config/dev.el | 60 ++++++++++++++++++++-------------------- .emacs.d/config/gpg.el | 4 +-- .emacs.d/config/org.el | 4 +-- .emacs.d/config/pass.el | 8 +++--- .emacs.d/config/rust.el | 16 +++++------ .emacs.d/config/tramp.el | 16 +++++------ 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/.emacs.d/config/dev.el b/.emacs.d/config/dev.el index f48f857..e3655af 100644 --- a/.emacs.d/config/dev.el +++ b/.emacs.d/config/dev.el @@ -1,38 +1,38 @@ ;; magit (use-package magit - :ensure t - :init - ;; (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) - (defun vcsh (repo) - "Invoke magit on a vcsh repo. This requires an appropriate entry in `tramp-methods'." - (interactive (let ((repos (delq nil - (mapcar #'(lambda (name) - (if (string-match ".git$" name) - (substring name 0 -4) - nil)) - (directory-files "~/.config/vcsh/repo.d"))))) - (list (completing-read "Repository: " repos nil t)))) - (magit-status-internal (format "/vcsh:%s:" repo))) - :config - ;; Turn on flyspell when writing commit messages - (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)) + :ensure t + :init + ;; (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) + (defun vcsh (repo) + "Invoke magit on a vcsh repo. This requires an appropriate entry in `tramp-methods'." + (interactive (let ((repos (delq nil + (mapcar #'(lambda (name) + (if (string-match ".git$" name) + (substring name 0 -4) + nil)) + (directory-files "~/.config/vcsh/repo.d"))))) + (list (completing-read "Repository: " repos nil t)))) + (magit-status-internal (format "/vcsh:%s:" repo))) + :config + ;; Turn on flyspell when writing commit messages + (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)) ;; use ripgrep in emacs (use-package deadgrep - :ensure t - :bind ("M-s d" . deadgrep)) + :ensure t + :bind ("M-s d" . deadgrep)) ;; paredit (use-package paredit - :ensure t - :config - (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) - (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) - (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode) - (add-hook 'ielm-mode-hook #'enable-paredit-mode) - (add-hook 'lisp-mode-hook #'enable-paredit-mode) - (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) - (add-hook 'scheme-mode-hook #'enable-paredit-mode)) + :ensure t + :config + (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) + (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) + (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode) + (add-hook 'ielm-mode-hook #'enable-paredit-mode) + (add-hook 'lisp-mode-hook #'enable-paredit-mode) + (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) + (add-hook 'scheme-mode-hook #'enable-paredit-mode)) ;; Hack to show only files known to git inside dired; needs the ;; `git-find' shell script shim (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) @@ -53,6 +53,6 @@ ;; language server (use-package lsp-mode - :ensure t - :config - (add-hook 'rust-mode-hook 'lsp-deferred)) + :ensure t + :config + (add-hook 'rust-mode-hook 'lsp-deferred)) diff --git a/.emacs.d/config/gpg.el b/.emacs.d/config/gpg.el index 78544cb..bb7bb57 100644 --- a/.emacs.d/config/gpg.el +++ b/.emacs.d/config/gpg.el @@ -1,3 +1,3 @@ (use-package pinentry - :init - (setq epa-pinentry-mode 'loopback)) + :init + (setq epa-pinentry-mode 'loopback)) diff --git a/.emacs.d/config/org.el b/.emacs.d/config/org.el index 5b92c32..85a0624 100644 --- a/.emacs.d/config/org.el +++ b/.emacs.d/config/org.el @@ -1,5 +1,5 @@ (use-package org - :ensure t - :init (setq org-export-backends '(ascii html icalendar latex odt beamer))) + :ensure t + :init (setq org-export-backends '(ascii html icalendar latex odt beamer))) (setq org-directory "~/org") diff --git a/.emacs.d/config/pass.el b/.emacs.d/config/pass.el index bd03e05..ebbc24f 100644 --- a/.emacs.d/config/pass.el +++ b/.emacs.d/config/pass.el @@ -1,8 +1,8 @@ (use-package ivy-pass - :ensure t - :init - ;; from https://github.com/ecraven/ivy-pass/blob/master/ivy-pass.el - (setq password-store-password-length 32)) + :ensure t + :init + ;; from https://github.com/ecraven/ivy-pass/blob/master/ivy-pass.el + (setq password-store-password-length 32)) ;; configure ivy-pass key binding (global-set-key [?\C-x ?p] 'ivy-pass) diff --git a/.emacs.d/config/rust.el b/.emacs.d/config/rust.el index bf43397..58f6c4b 100644 --- a/.emacs.d/config/rust.el +++ b/.emacs.d/config/rust.el @@ -1,13 +1,13 @@ (use-package cargo - :ensure t - :config - ;; enable cargo keybindings - (add-hook 'rust-mode-hook 'cargo-minor-mode)) + :ensure t + :config + ;; enable cargo keybindings + (add-hook 'rust-mode-hook 'cargo-minor-mode)) (use-package rust-mode - :ensure t - :config - ;; format code when saving - (setq rust-format-on-save t)) + :ensure t + :config + ;; format code when saving + (setq rust-format-on-save t)) (use-package flycheck-rust :ensure t) diff --git a/.emacs.d/config/tramp.el b/.emacs.d/config/tramp.el index 60bb211..1b92e5f 100644 --- a/.emacs.d/config/tramp.el +++ b/.emacs.d/config/tramp.el @@ -1,9 +1,9 @@ (use-package tramp - :config - (setq tramp-default-method "ssh") - (add-to-list 'tramp-methods '("vcsh" - (tramp-login-program "vcsh") - (tramp-login-args (("enter") - ("%h"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c"))))) + :config + (setq tramp-default-method "ssh") + (add-to-list 'tramp-methods '("vcsh" + (tramp-login-program "vcsh") + (tramp-login-args (("enter") + ("%h"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c"))))) From 31ea69ffceb1ccd9885c135e0f7db85a8494509d Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:49:07 +0200 Subject: [PATCH 2/6] backups: Do not backup files in `/dev/shm` Prevent backups to happen from files in `/dev/shm`. --- .emacs.d/config/backups.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.emacs.d/config/backups.el b/.emacs.d/config/backups.el index 387270f..0b3e48b 100644 --- a/.emacs.d/config/backups.el +++ b/.emacs.d/config/backups.el @@ -1,5 +1,6 @@ ;; configure backups -(setq backup-directory-alist '(("." . "~/.emacs.d/backups/")) +(setq backup-directory-alist '(("." . "~/.emacs.d/backups/") + ("/dev/shm" . "/dev/null")) backup-by-copying t delete-old-versions t kept-new-versions 16 From 4e68d2b48b54de93e65a19e3e2c7ca90e1db2105 Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:50:18 +0200 Subject: [PATCH 3/6] authinfo: Configure the default authinfo file Configure `auth-source` to be per default `~/.authinfo.gpg`. --- .emacs.d/config/base.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs.d/config/base.el b/.emacs.d/config/base.el index 143bdd3..ab9148d 100644 --- a/.emacs.d/config/base.el +++ b/.emacs.d/config/base.el @@ -82,3 +82,7 @@ ;; configure theme (custom-set-variables '(custom-enabled-themes (quote (tango-dark)))) + +;; configur authinfo file +(setq auth-sources + '((:source "~/.authinfo.gpg"))) From 0e7dd9da5f09ee3a9184b50b24a3d0afbbb33c15 Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:55:23 +0200 Subject: [PATCH 4/6] ripgrep: Move ripgrep config to its own file The config for ripgrep now resides in its own file. --- .emacs.d/config/dev.el | 5 ----- .emacs.d/config/ripgrep.el | 4 ++++ .emacs.d/init.el | 2 +- .gitignore.d/emacs | 1 + 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 .emacs.d/config/ripgrep.el diff --git a/.emacs.d/config/dev.el b/.emacs.d/config/dev.el index e3655af..2ed9bb4 100644 --- a/.emacs.d/config/dev.el +++ b/.emacs.d/config/dev.el @@ -17,11 +17,6 @@ ;; Turn on flyspell when writing commit messages (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)) -;; use ripgrep in emacs -(use-package deadgrep - :ensure t - :bind ("M-s d" . deadgrep)) - ;; paredit (use-package paredit :ensure t diff --git a/.emacs.d/config/ripgrep.el b/.emacs.d/config/ripgrep.el new file mode 100644 index 0000000..0bbd8a9 --- /dev/null +++ b/.emacs.d/config/ripgrep.el @@ -0,0 +1,4 @@ +;; use ripgrep in emacs +(use-package deadgrep + :ensure t + :bind ("M-s d" . deadgrep)) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 24e144f..f78ba6e 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -57,7 +57,7 @@ symbols, which are converted to strings, and suffixed with \".el\"." :group 'config-snippets :type '(repeat directory)) -(setq config-snippets '(base backups c calendar dev functions gpg org pass rust wl yaml)) +(setq config-snippets '(base backups c calendar dev functions gpg org pass ripgrep rust wl yaml)) (message "Loading\nconfig-snippets: %s\nconfig-snippets-path: %s" config-snippets config-snippet-path) (dolist (snippet config-snippets) diff --git a/.gitignore.d/emacs b/.gitignore.d/emacs index 8e8ef0d..f156449 100644 --- a/.gitignore.d/emacs +++ b/.gitignore.d/emacs @@ -8,6 +8,7 @@ !/.emacs.d/config/gpg.el !/.emacs.d/config/org.el !/.emacs.d/config/pass.el +!/.emacs.d/config/ripgrep.el !/.emacs.d/config/rust.el !/.emacs.d/config/tramp.el !/.emacs.d/config/yaml.el From 8bb1b0759064eadb6b246192414c111868a1d5aa Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:57:32 +0200 Subject: [PATCH 5/6] git: Move to own configuration for (ma)git Magit is now configured together with all git related config that may possibily come in the future. --- .emacs.d/config/dev.el | 19 ------------------- .emacs.d/config/git.el | 18 ++++++++++++++++++ .emacs.d/init.el | 2 +- .gitignore.d/emacs | 1 + 4 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 .emacs.d/config/git.el diff --git a/.emacs.d/config/dev.el b/.emacs.d/config/dev.el index 2ed9bb4..7b18b62 100644 --- a/.emacs.d/config/dev.el +++ b/.emacs.d/config/dev.el @@ -1,22 +1,3 @@ -;; magit -(use-package magit - :ensure t - :init - ;; (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) - (defun vcsh (repo) - "Invoke magit on a vcsh repo. This requires an appropriate entry in `tramp-methods'." - (interactive (let ((repos (delq nil - (mapcar #'(lambda (name) - (if (string-match ".git$" name) - (substring name 0 -4) - nil)) - (directory-files "~/.config/vcsh/repo.d"))))) - (list (completing-read "Repository: " repos nil t)))) - (magit-status-internal (format "/vcsh:%s:" repo))) - :config - ;; Turn on flyspell when writing commit messages - (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)) - ;; paredit (use-package paredit :ensure t diff --git a/.emacs.d/config/git.el b/.emacs.d/config/git.el new file mode 100644 index 0000000..045c313 --- /dev/null +++ b/.emacs.d/config/git.el @@ -0,0 +1,18 @@ +;; magit +(use-package magit + :ensure t + :init + ;; (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) + (defun vcsh (repo) + "Invoke magit on a vcsh repo. This requires an appropriate entry in `tramp-methods'." + (interactive (let ((repos (delq nil + (mapcar #'(lambda (name) + (if (string-match ".git$" name) + (substring name 0 -4) + nil)) + (directory-files "~/.config/vcsh/repo.d"))))) + (list (completing-read "Repository: " repos nil t)))) + (magit-status-internal (format "/vcsh:%s:" repo))) + :config + ;; Turn on flyspell when writing commit messages + (add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index f78ba6e..1703c22 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -57,7 +57,7 @@ symbols, which are converted to strings, and suffixed with \".el\"." :group 'config-snippets :type '(repeat directory)) -(setq config-snippets '(base backups c calendar dev functions gpg org pass ripgrep rust wl yaml)) +(setq config-snippets '(base backups c calendar dev functions git gpg org pass ripgrep rust wl yaml)) (message "Loading\nconfig-snippets: %s\nconfig-snippets-path: %s" config-snippets config-snippet-path) (dolist (snippet config-snippets) diff --git a/.gitignore.d/emacs b/.gitignore.d/emacs index f156449..5468ecf 100644 --- a/.gitignore.d/emacs +++ b/.gitignore.d/emacs @@ -5,6 +5,7 @@ !/.emacs.d/config/c.el !/.emacs.d/config/dev.el !/.emacs.d/config/functions.el +!/.emacs.d/config/git.el !/.emacs.d/config/gpg.el !/.emacs.d/config/org.el !/.emacs.d/config/pass.el From c69e7e43d8e36148f85892727d96cdfb3f18c024 Mon Sep 17 00:00:00 2001 From: finga Date: Mon, 27 May 2024 13:59:09 +0200 Subject: [PATCH 6/6] dev: Improve displaying parenthesis Add two modes `highlight-parentheses` and `rainbow-delimiters` to improve the readability when several level of parenthesis are involved. --- .emacs.d/config/dev.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.emacs.d/config/dev.el b/.emacs.d/config/dev.el index 7b18b62..a93a3c2 100644 --- a/.emacs.d/config/dev.el +++ b/.emacs.d/config/dev.el @@ -10,6 +10,16 @@ (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) (add-hook 'scheme-mode-hook #'enable-paredit-mode)) +(use-package highlight-parentheses + :ensure t + :config + (global-highlight-parentheses-mode t)) + +(use-package rainbow-delimiters + :ensure t + :config + (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) + ;; Hack to show only files known to git inside dired; needs the ;; `git-find' shell script shim (taken from :open https://r0tty.org/git/dotfiles/emacs/tree/.emacs.d/config/development.el) (defun git-dired (dir)