From e39ae494361a15d02351acecf7fddce585747b12 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Fri, 24 Apr 2026 18:26:32 +0900 Subject: [PATCH 01/33] refactor(emacs): move line-number-mode and transient-mark-mode into *editing-basics These global minor modes are display and selection baselines that fit *editing-basics better than the catch-all simple leaf. No behavior was changed. --- home/takeru/features/emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 2ab321fd..48ce7252 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -294,8 +294,10 @@ (kill-ring-max . 8192)) :config (keyboard-translate ?\C-h ?\C-?) + (line-number-mode) (put 'list-timers 'disabled nil) - (put 'scroll-left 'disabled nil)) + (put 'scroll-left 'disabled nil) + (transient-mark-mode)) ;;; System integration @@ -446,7 +448,6 @@ ("C-x |" . split-window-right) ("C-x -" . split-window-below)) :config - :global-minor-mode line-number-mode transient-mark-mode :hook (before-save-hook . elim:auto-delete-trailing-whitespace))) (leaf *interfaces From 730ff4e66877feab615d22c8869cc21ed0238690 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 13:33:01 +0900 Subject: [PATCH 02/33] refactor(emacs): move before-save-hook logic from simple into *editing-basics The trailing-whitespace deletion variable, helper functions, and hook belong with the editing baseline settings. simple now holds only keybindings and an empty :config. No behavior was changed. --- home/takeru/features/emacs/init.el | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 48ce7252..51483f9e 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -290,6 +290,14 @@ ;;; Editor enhancements (leaf *editing-basics + :preface + (defvar elim:auto-delete-trailing-whitespace-enable-p t) + (defun elim:editorconfig-mode-enabled-p () + (assoc 'editorconfig-mode minor-mode-alist)) + (defun elim:auto-delete-trailing-whitespace () + (and elim:auto-delete-trailing-whitespace-enable-p + (not (elim:editorconfig-mode-enabled-p)) + (delete-trailing-whitespace))) :custom ((delete-by-moving-to-trash . t) (kill-ring-max . 8192)) :config @@ -297,7 +305,8 @@ (line-number-mode) (put 'list-timers 'disabled nil) (put 'scroll-left 'disabled nil) - (transient-mark-mode)) + (transient-mark-mode) + :hook (before-save-hook . elim:auto-delete-trailing-whitespace)) ;;; System integration @@ -433,22 +442,12 @@ :doc "Just prevent appending to this file (not load at startup)." :custom `((custom-file . ,(locate-user-emacs-file ".custom.el")))) (leaf simple - :defun elim:editorconfig-mode-enabled-p - :preface - (defvar elim:auto-delete-trailing-whitespace-enable-p t) - (defun elim:editorconfig-mode-enabled-p () - (assoc 'editorconfig-mode minor-mode-alist)) - (defun elim:auto-delete-trailing-whitespace () - (and elim:auto-delete-trailing-whitespace-enable-p - (not (elim:editorconfig-mode-enabled-p)) - (delete-trailing-whitespace))) :bind (("" . delete-char) ("C-h" . delete-char) ("C-m" . newline-and-indent) ("C-x |" . split-window-right) ("C-x -" . split-window-below)) - :config - :hook (before-save-hook . elim:auto-delete-trailing-whitespace))) + :config)) (leaf *interfaces :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) From 6fde2a77b91022e1b671dabbdef577d8f5c8de31 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 13:33:27 +0900 Subject: [PATCH 03/33] refactor(emacs): move 3 editing keybindings from simple into *editing-basics , C-h, and C-m are character-level editing keys that belong with the editing baseline. simple now holds only the window-split bindings C-x | and C-x -. No behavior was changed. --- home/takeru/features/emacs/init.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 51483f9e..fa5ff419 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -298,6 +298,9 @@ (and elim:auto-delete-trailing-whitespace-enable-p (not (elim:editorconfig-mode-enabled-p)) (delete-trailing-whitespace))) + :bind (("" . delete-char) + ("C-h" . delete-char) + ("C-m" . newline-and-indent)) :custom ((delete-by-moving-to-trash . t) (kill-ring-max . 8192)) :config @@ -442,10 +445,7 @@ :doc "Just prevent appending to this file (not load at startup)." :custom `((custom-file . ,(locate-user-emacs-file ".custom.el")))) (leaf simple - :bind (("" . delete-char) - ("C-h" . delete-char) - ("C-m" . newline-and-indent) - ("C-x |" . split-window-right) + :bind (("C-x |" . split-window-right) ("C-x -" . split-window-below)) :config)) From 815894d36f70624ad210ae632e5c952b61b86fac Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 14:58:25 +0900 Subject: [PATCH 04/33] refactor(emacs): dissolve simple by moving window-split keys to *window-commands The last two keybindings in simple (C-x | and C-x -) move into a new *window-commands leaf inside *interfaces. simple is now gone entirely. No behavior was changed. --- home/takeru/features/emacs/init.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index fa5ff419..95304f15 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -443,11 +443,7 @@ (defalias 'yes-or-no-p 'y-or-n-p) (leaf cus-edit :doc "Just prevent appending to this file (not load at startup)." - :custom `((custom-file . ,(locate-user-emacs-file ".custom.el")))) - (leaf simple - :bind (("C-x |" . split-window-right) - ("C-x -" . split-window-below)) - :config)) + :custom `((custom-file . ,(locate-user-emacs-file ".custom.el"))))) (leaf *interfaces :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) @@ -517,6 +513,9 @@ :custom ((select-enable-primary . nil) (select-enable-clipboard . t) (selection-coding-system . 'utf-8))) + (leaf *window-commands + :bind (("C-x |" . split-window-right) + ("C-x -" . split-window-below))) (leaf tab-bar :doc "frame-local tabs with named persistent window configurations" :tag "builtin" From 08c25d63e1f5d8b61b3c77fa39e9d3ba92f372a9 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:06:57 +0900 Subject: [PATCH 05/33] refactor(emacs): move editing defaults into *editing-basics require-final-newline and indent-tabs-mode belong with the editing baseline settings rather than in *interfaces. No behavior was changed. --- home/takeru/features/emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 95304f15..43ab5ee8 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -302,12 +302,14 @@ ("C-h" . delete-char) ("C-m" . newline-and-indent)) :custom ((delete-by-moving-to-trash . t) - (kill-ring-max . 8192)) + (kill-ring-max . 8192) + (require-final-newline . t)) :config (keyboard-translate ?\C-h ?\C-?) (line-number-mode) (put 'list-timers 'disabled nil) (put 'scroll-left 'disabled nil) + (set-default 'indent-tabs-mode nil) (transient-mark-mode) :hook (before-save-hook . elim:auto-delete-trailing-whitespace)) @@ -451,7 +453,6 @@ (mouse-drag-copy-region . t) (read-buffer-completion-ignore-case . t) (read-file-name-completion-ignore-case . t) - (require-final-newline . t) (ring-bell-function . 'ignore) (scroll-conservatively . 1) (select-active-regions . nil) @@ -462,7 +463,6 @@ (put 'dired-find-alternate-file 'disabled nil) (put 'narrow-to-region 'disabled nil) (put 'set-goal-column 'disabled nil) - (set-default 'indent-tabs-mode nil) (set-default 'cursor-in-non-selected-windows nil) (leaf buffer-move :bind (("M-g h" . buf-move-left) From 7d60389e8ddd5f104ff38208a1f2a1cc77bcb108 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:29:54 +0900 Subject: [PATCH 06/33] refactor(emacs): move completion defaults into *completion read-buffer-completion-ignore-case and read-file-name-completion-ignore-case belong in the completion block rather than in *environments. No behavior was changed. --- home/takeru/features/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 43ab5ee8..f0edc333 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -20,6 +20,8 @@ ;;; Navigation / Completion (leaf *completion + :custom ((read-buffer-completion-ignore-case . t) + (read-file-name-completion-ignore-case . t)) :url https://blog.tomoya.dev/posts/a-new-wave-has-arrived-at-emacs :url https://emacs-jp.slack.com/archives/C1B5WTJLQ/p1623851956426000 :url https://github.com/uwabami/emacs @@ -451,8 +453,6 @@ :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) (inhibit-startup-screen . t) (mouse-drag-copy-region . t) - (read-buffer-completion-ignore-case . t) - (read-file-name-completion-ignore-case . t) (ring-bell-function . 'ignore) (scroll-conservatively . 1) (select-active-regions . nil) From b7fbad92ab7237cb48be2300b6e887b90a9a7cbf Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:30:49 +0900 Subject: [PATCH 07/33] refactor(emacs): move recursive minibuffer setting into *completion enable-recursive-minibuffers controls completion behavior and belongs in *completion rather than *environments. No behavior was changed. --- home/takeru/features/emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index f0edc333..d4b35e26 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -20,7 +20,8 @@ ;;; Navigation / Completion (leaf *completion - :custom ((read-buffer-completion-ignore-case . t) + :custom ((enable-recursive-minibuffers . t) + (read-buffer-completion-ignore-case . t) (read-file-name-completion-ignore-case . t)) :url https://blog.tomoya.dev/posts/a-new-wave-has-arrived-at-emacs :url https://emacs-jp.slack.com/archives/C1B5WTJLQ/p1623851956426000 @@ -438,8 +439,7 @@ (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) (leaf *environments - :custom `((enable-recursive-minibuffers . t) - (gc-cons-threshold . ,(* 128 1024 1024)) + :custom `((gc-cons-threshold . ,(* 128 1024 1024)) (use-dialog-box . nil) (user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito")) From 20caa784bde071f1c08e15317dd44a6aa3d99f49 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:31:22 +0900 Subject: [PATCH 08/33] refactor(emacs): move dialog box setting into *interfaces use-dialog-box controls UI interaction and belongs in *interfaces rather than *environments. No behavior was changed. --- home/takeru/features/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index d4b35e26..fca478e9 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -440,7 +440,6 @@ (leaf *environments :custom `((gc-cons-threshold . ,(* 128 1024 1024)) - (use-dialog-box . nil) (user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito")) :config @@ -458,6 +457,7 @@ (select-active-regions . nil) (show-trailing-whitespace . nil) (truncate-lines . nil) + (use-dialog-box . nil) (visible-bell . t)) :config (put 'dired-find-alternate-file 'disabled nil) From 8d537b940deac6bb85b80a6f06854c7d180f15bf Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:32:14 +0900 Subject: [PATCH 09/33] refactor(emacs): move runtime defaults into early-init.el gc-cons-threshold and custom-file take effect before init.el loads, so early-init.el is the right home. The leaf cus-edit wrapper is replaced with a direct set-variable call. No behavior was changed. --- home/takeru/features/emacs/early-init.el | 2 ++ home/takeru/features/emacs/init.el | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/home/takeru/features/emacs/early-init.el b/home/takeru/features/emacs/early-init.el index b6dd238e..9c11fb41 100644 --- a/home/takeru/features/emacs/early-init.el +++ b/home/takeru/features/emacs/early-init.el @@ -5,7 +5,9 @@ (set-variable 'ns-use-native-fullscreen nil) (set-variable 'x-super-keysym 'meta) +(set-variable 'gc-cons-threshold (* 128 1024 1024)) (set-variable 'load-prefer-newer t) +(set-variable 'custom-file (locate-user-emacs-file ".custom.el")) ;; Keep native-comp warnings quiet during startup and async compilation. (set-variable 'native-comp-async-report-warnings-errors 'silent) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index fca478e9..72487474 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -439,14 +439,10 @@ (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) (leaf *environments - :custom `((gc-cons-threshold . ,(* 128 1024 1024)) - (user-mail-address . "takeru.naito@gmail.com") + :custom `((user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito")) :config - (defalias 'yes-or-no-p 'y-or-n-p) - (leaf cus-edit - :doc "Just prevent appending to this file (not load at startup)." - :custom `((custom-file . ,(locate-user-emacs-file ".custom.el"))))) + (defalias 'yes-or-no-p 'y-or-n-p)) (leaf *interfaces :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) From 6c13b951c81ca457339e09b349e3e79bcc2cd373 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:32:31 +0900 Subject: [PATCH 10/33] refactor(emacs): move yes-or-no prompt behavior into *interfaces The y-or-n-p alias controls interactive prompt style and fits *interfaces better than *environments. No behavior was changed. --- home/takeru/features/emacs/init.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 72487474..d6e0a7ea 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -440,9 +440,7 @@ (leaf *environments :custom `((user-mail-address . "takeru.naito@gmail.com") - (user-full-name . "Takeru Naito")) - :config - (defalias 'yes-or-no-p 'y-or-n-p)) + (user-full-name . "Takeru Naito"))) (leaf *interfaces :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) @@ -456,6 +454,7 @@ (use-dialog-box . nil) (visible-bell . t)) :config + (defalias 'yes-or-no-p 'y-or-n-p) (put 'dired-find-alternate-file 'disabled nil) (put 'narrow-to-region 'disabled nil) (put 'set-goal-column 'disabled nil) From 76d40e96b3fddc1d52b078f15267b1c28bee47ce Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:32:43 +0900 Subject: [PATCH 11/33] refactor(emacs): rename *environments to *identity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The remaining contents — user name, email address, and a few base variables — are personal identity settings rather than environmental defaults. --- home/takeru/features/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index d6e0a7ea..f602f247 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -438,7 +438,7 @@ (call-interactively 'sort-lines))) (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) -(leaf *environments +(leaf *identity :custom `((user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito"))) From 86f1a8503ae20717712a1564d03dc9ef55d4fbf9 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:33:16 +0900 Subject: [PATCH 12/33] refactor(emacs): move company and company-quickhelp to Code completion company and company-quickhelp belong under the code completion section alongside eglot rather than buried in *interfaces. No settings were changed; only the location of these leaf blocks shifted. --- home/takeru/features/emacs/init.el | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index f602f247..2f772fc9 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -107,6 +107,26 @@ :custom ((eglot-autoshutdown . t) (eglot-extend-to-xref . t))) +(leaf company + :bind (("C-M-i" . company-complete) + (:company-active-map + ("C-n" . company-select-next) + ("C-p" . company-select-previous) + ("C-s" . company-filter-candidates) + ("C-i" . company-complete-selection))) + :custom-face ((company-preview-common . '((nil (:foreground "lightgrey" :underline t)))) + (company-scrollbar-bg . '((nil (:background "gray40")))) + (company-scrollbar-fg . '((nil (:background "orange")))) + (company-tooltip . '((nil (:foreground "black" :background "lightgrey")))) + (company-tooltip-common . '((nil (:foreground "black" :background "lightgrey")))) + (company-tooltip-common-selection . '((nil (:foreground "white" :background "steelblue")))) + (company-tooltip-selection . '((nil (:foreground "black" :background "steelblue"))))) + :blackout company-mode + :hook (after-init-hook . global-company-mode)) + +(leaf company-quickhelp + :global-minor-mode company-quickhelp-mode) + ;;; Version control (leaf browse-at-remote @@ -464,24 +484,6 @@ ("M-g j" . buf-move-down) ("M-g k" . buf-move-up) ("M-g l" . buf-move-right))) - (leaf company - :bind (("C-M-i" . company-complete) - (:company-active-map - ("C-n" . company-select-next) - ("C-p" . company-select-previous) - ("C-s" . company-filter-candidates) - ("C-i" . company-complete-selection))) - :custom-face ((company-preview-common . '((nil (:foreground "lightgrey" :underline t)))) - (company-scrollbar-bg . '((nil (:background "gray40")))) - (company-scrollbar-fg . '((nil (:background "orange")))) - (company-tooltip . '((nil (:foreground "black" :background "lightgrey")))) - (company-tooltip-common . '((nil (:foreground "black" :background "lightgrey")))) - (company-tooltip-common-selection . '((nil (:foreground "white" :background "steelblue")))) - (company-tooltip-selection . '((nil (:foreground "black" :background "steelblue"))))) - :blackout company-mode - :hook (after-init-hook . global-company-mode)) - (leaf company-quickhelp - :global-minor-mode company-quickhelp-mode) (leaf executable :config (defun elim:executable-make-buffer-file-executable-if-script-p () From 081b92fa98d8c6f121bf045d4e05f33df6e71a44 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 15:33:59 +0900 Subject: [PATCH 13/33] refactor(emacs): group window navigation leaves under *window-navigation buffer-move, rotate, *window-commands, tab-bar, and windmove are all window navigation concerns. Grouping them under *window-navigation inside *interfaces makes the structure clearer. No settings were changed; only the grouping changed. --- home/takeru/features/emacs/init.el | 78 +++++++++++++++--------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 2f772fc9..75ddace1 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -479,11 +479,6 @@ (put 'narrow-to-region 'disabled nil) (put 'set-goal-column 'disabled nil) (set-default 'cursor-in-non-selected-windows nil) - (leaf buffer-move - :bind (("M-g h" . buf-move-left) - ("M-g j" . buf-move-down) - ("M-g k" . buf-move-up) - ("M-g l" . buf-move-right))) (leaf executable :config (defun elim:executable-make-buffer-file-executable-if-script-p () @@ -505,37 +500,10 @@ :config (push '("*Google Translate*") popwin:special-display-config) :global-minor-mode t) - (leaf rotate) (leaf select :custom ((select-enable-primary . nil) (select-enable-clipboard . t) (selection-coding-system . 'utf-8))) - (leaf *window-commands - :bind (("C-x |" . split-window-right) - ("C-x -" . split-window-below))) - (leaf tab-bar - :doc "frame-local tabs with named persistent window configurations" - :tag "builtin" - :added "2022-02-09" - :bind-keymap ("C-z" . tab-bar-map) - :bind `(("M-{" . tab-previous) - ("M-}" . tab-next) - (:tab-bar-map - ("k" . tab-close) - ("c" . tab-new) - ("C-k" . tab-close) - ("n" . tab-next) - ("p" . tab-previous) - ("C-SPC" . tab-recent) - ,@(mapcar (lambda (i) - (cons (number-to-string i) 'tab-select)) - (number-sequence 0 9)))) - :custom ((tab-bar-new-tab-choice . "*scratch*") - (tab-bar-tab-hints . t)) - :custom-face - ((tab-bar-tab . '((nil (:foreground "#112" :background "#ccc")))) - (tab-bar-tab-inactive . '((nil (:foreground "#ccc" :background "#112"))))) - :global-minor-mode t) (leaf uniquify :custom ((uniquify-buffer-name-style . 'post-forward-angle-brackets) (uniquify-ignore-buffers-re . "*[^*]+*") @@ -544,12 +512,46 @@ :custom ((wgrep-auto-save-buffer . t))) (leaf which-key :hook (after-init-hook . which-key-mode)) - (leaf windmove - :custom ((windmove-wrap-around . t)) - :bind (("C-c C-b" . windmove-left) - ("C-c C-n" . windmove-down) - ("C-c C-p" . windmove-up) - ("C-c C-f" . windmove-right)))) + (leaf *window-navigation + :config + (leaf buffer-move + :bind (("M-g h" . buf-move-left) + ("M-g j" . buf-move-down) + ("M-g k" . buf-move-up) + ("M-g l" . buf-move-right))) + (leaf rotate) + (leaf *window-commands + :bind (("C-x |" . split-window-right) + ("C-x -" . split-window-below))) + (leaf tab-bar + :doc "frame-local tabs with named persistent window configurations" + :tag "builtin" + :added "2022-02-09" + :bind-keymap ("C-z" . tab-bar-map) + :bind `(("M-{" . tab-previous) + ("M-}" . tab-next) + (:tab-bar-map + ("k" . tab-close) + ("c" . tab-new) + ("C-k" . tab-close) + ("n" . tab-next) + ("p" . tab-previous) + ("C-SPC" . tab-recent) + ,@(mapcar (lambda (i) + (cons (number-to-string i) 'tab-select)) + (number-sequence 0 9)))) + :custom ((tab-bar-new-tab-choice . "*scratch*") + (tab-bar-tab-hints . t)) + :custom-face + ((tab-bar-tab . '((nil (:foreground "#112" :background "#ccc")))) + (tab-bar-tab-inactive . '((nil (:foreground "#ccc" :background "#112"))))) + :global-minor-mode t) + (leaf windmove + :custom ((windmove-wrap-around . t)) + :bind (("C-c C-b" . windmove-left) + ("C-c C-n" . windmove-down) + ("C-c C-p" . windmove-up) + ("C-c C-f" . windmove-right))))) (leaf *minor-modes :config From e95e905b5b88d6c431c1e3822e9c9e8a16596fa5 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:33:35 +0900 Subject: [PATCH 14/33] refactor(emacs): move font-lock setup into appearance section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 進めました。[init.el](/Users/takeru.naito/src/github.com/elim/dotfiles/.git/wt/feat/emacs-maximize-fullscreen/home/takeru/features/emacs/init.el) 今回は `font-core` を `*interfaces` から `Platform / Frame / Appearance` へ移しています。これで文字表示まわりの既定は見た目のセクションに寄り、`*interfaces` は対話と操作面に少し近づきました。`git diff --check` は通っています。 次は、`Persistence and utilities` の中で永続化と雑多な utility を分ける段階に進めます。 --- home/takeru/features/emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 75ddace1..36c70ee2 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -272,6 +272,9 @@ (leaf hl-line :global-minor-mode global-hl-line-mode) +(leaf font-core + :config (global-font-lock-mode t)) + (leaf menu-bar :if (eq system-type 'darwin) :global-minor-mode t) @@ -485,8 +488,6 @@ (unless (string-match tramp-file-name-regexp (buffer-file-name)) (executable-make-buffer-file-executable-if-script-p))) :hook (after-save-hook . elim:executable-make-buffer-file-executable-if-script-p)) - (leaf font-core - :config (global-font-lock-mode t)) (leaf mouse :bind (("C-" . nil) ("C-" . nil) From 752b64a9313eb8b3da799819913613f3b37a8509 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:33:58 +0900 Subject: [PATCH 15/33] refactor(emacs): group desktop and recentf inside *persistence desktop and recentf are the core session-persistence packages. Grouping them inside *persistence makes that structure explicit. No settings were changed; only the grouping changed. --- home/takeru/features/emacs/init.el | 44 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 36c70ee2..83e1a9e4 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -398,19 +398,6 @@ (ignore-errors (gui-get-selection 'CLIPBOARD 'UTF8_STRING))))) (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) - (leaf desktop - :defvar desktop-globals-to-save - :custom `((desktop-base-file-name . ,(locate-user-emacs-file ".desktop.el")) - (desktop-base-lock-name . ,(locate-user-emacs-file ".desktop.lock")) - (desktop-load-locked-desktop . 'check-pid) - (desktop-restore-eager . 0) - (desktop-restore-frames . nil) - (desktop-save-mode . +1)) - :config - (add-to-list 'desktop-globals-to-save 'extended-command-history) - (add-to-list 'desktop-globals-to-save 'kill-ring) - (add-to-list 'desktop-globals-to-save 'log-edit-comment-ring) - (add-to-list 'desktop-globals-to-save 'read-expression-history)) (leaf find-func :config ;; C-x F => Find Function @@ -443,13 +430,6 @@ :bind (("C-x C-z" . open-junk-file)) :custom ((open-junk-file-format . "~/.junk/%Y/%m/%d-%H%M%S.") (open-junk-file-find-file-function . 'find-file))) - (leaf recentf - :defvar recentf-auto-save-timer - :custom `((recentf-auto-save-timer - . ,(run-with-idle-timer 30 t #'recentf-save-list)) - (recentf-max-saved-items . 512) - (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) - :global-minor-mode t) (leaf sort :defun elim:sort-lines-nocase :config @@ -459,7 +439,29 @@ (defvar sort-fold-case) (let ((sort-fold-case t)) (call-interactively 'sort-lines))) - (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) + (defalias 'sort-lines-nocase #'elim:sort-lines-nocase)) + (leaf *persistence + :config + (leaf desktop + :defvar desktop-globals-to-save + :custom `((desktop-base-file-name . ,(locate-user-emacs-file ".desktop.el")) + (desktop-base-lock-name . ,(locate-user-emacs-file ".desktop.lock")) + (desktop-load-locked-desktop . 'check-pid) + (desktop-restore-eager . 0) + (desktop-restore-frames . nil) + (desktop-save-mode . +1)) + :config + (add-to-list 'desktop-globals-to-save 'extended-command-history) + (add-to-list 'desktop-globals-to-save 'kill-ring) + (add-to-list 'desktop-globals-to-save 'log-edit-comment-ring) + (add-to-list 'desktop-globals-to-save 'read-expression-history)) + (leaf recentf + :defvar recentf-auto-save-timer + :custom `((recentf-auto-save-timer + . ,(run-with-idle-timer 30 t #'recentf-save-list)) + (recentf-max-saved-items . 512) + (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) + :global-minor-mode t))) (leaf *identity :custom `((user-mail-address . "takeru.naito@gmail.com") From 183fb1a4f92812672f4dca3ac32067825dd601ed Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:34:21 +0900 Subject: [PATCH 16/33] refactor(emacs): move browse-url and dictionary into system integration browse-url and dictionary connect to external tools or services and belong in the system integration section. No settings were changed; only the location of these leaf blocks shifted. --- home/takeru/features/emacs/init.el | 40 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 83e1a9e4..0b857e50 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -356,6 +356,27 @@ (atomic-chrome-edit-done-hook . elim:save-buffer-to-kill-ring))) +(leaf browse-url + :bind ("C-x m" . browse-url-at-point)) + +(leaf dictionary + :if (eq system-type 'darwin) + :defun elim:dictionary-search + :preface + (defun elim:dictionary-search (word) + (browse-url + (concat "dict:///" (url-hexify-string word)))) + (defun elim:dictionary-word () + (interactive) + (elim:dictionary-search + (substring-no-properties (thing-at-point 'word)))) + (defun elim:dictionary-region (beg end) + (interactive "r") + (elim:dictionary-search + (buffer-substring-no-properties beg end))) + :bind (("C-x e" . elim:dictionary-word) + ("C-x y" . elim:dictionary-region))) + (leaf direnv :global-minor-mode t) (leaf server @@ -384,8 +405,6 @@ :config (leaf auth-source :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) - (leaf browse-url - :bind ("C-x m" . browse-url-at-point)) (leaf bs :bind ("C-x C-b" . bs-show)) (leaf clipmon @@ -404,23 +423,6 @@ ;; C-x V => Find Variable ;; C-x K => Find Function on Key (find-function-setup-keys)) - (leaf dictionary - :if (eq system-type 'darwin) - :defun elim:dictionary-search - :preface - (defun elim:dictionary-search (word) - (browse-url - (concat "dict:///" (url-hexify-string word)))) - (defun elim:dictionary-word () - (interactive) - (elim:dictionary-search - (substring-no-properties (thing-at-point 'word)))) - (defun elim:dictionary-region (beg end) - (interactive "r") - (elim:dictionary-search - (buffer-substring-no-properties beg end))) - :bind (("C-x e" . elim:dictionary-word) - ("C-x y" . elim:dictionary-region))) (leaf help-fns :bind (("H-b" . describe-binding) ("H-f" . describe-function) From ad1853084524fd96203651208fe43e7194c506bf Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:34:35 +0900 Subject: [PATCH 17/33] refactor(emacs): move clipmon into system integration clipmon monitors the system clipboard and belongs in the system integration section. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 0b857e50..88410b32 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -377,6 +377,15 @@ :bind (("C-x e" . elim:dictionary-word) ("C-x y" . elim:dictionary-region))) +(leaf clipmon + :hook (after-init-hook . clipmon-mode-start) + :config + (when (fboundp 'gui-get-selection) + (defun clipmon--get-selection () + "Get the clipboard contents. With a hack for Mozilla products, to set + UTF8_STRING explicitly." + (ignore-errors (gui-get-selection 'CLIPBOARD 'UTF8_STRING))))) + (leaf direnv :global-minor-mode t) (leaf server @@ -407,14 +416,6 @@ :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) (leaf bs :bind ("C-x C-b" . bs-show)) - (leaf clipmon - :hook (after-init-hook . clipmon-mode-start) - :config - (when (fboundp 'gui-get-selection) - (defun clipmon--get-selection () - "Get the clipboard contents. With a hack for Mozilla products, to set - UTF8_STRING explicitly." - (ignore-errors (gui-get-selection 'CLIPBOARD 'UTF8_STRING))))) (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) (leaf find-func From a4ee780736e40e3fc357600122a6916ffdd338ca Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:34:52 +0900 Subject: [PATCH 18/33] refactor(emacs): move buffer list command into *interfaces bs provides a buffer-list UI and belongs alongside other interface commands. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 88410b32..5ea88f7c 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -414,8 +414,6 @@ :config (leaf auth-source :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) - (leaf bs - :bind ("C-x C-b" . bs-show)) (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) (leaf find-func @@ -487,6 +485,8 @@ (put 'narrow-to-region 'disabled nil) (put 'set-goal-column 'disabled nil) (set-default 'cursor-in-non-selected-windows nil) + (leaf bs + :bind ("C-x C-b" . bs-show)) (leaf executable :config (defun elim:executable-make-buffer-file-executable-if-script-p () From f41fc0613dcba60893c35437ed90653aa91547d2 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:35:19 +0900 Subject: [PATCH 19/33] refactor(emacs): make *persistence a top-level sibling of *utilities Lifting *persistence out of *editor-tools makes it a peer section rather than a detail of editor tooling. No settings were changed; only the structural grouping changed. --- home/takeru/features/emacs/init.el | 47 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 5ea88f7c..5e3a32ce 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -410,6 +410,29 @@ ;;; Persistence and utilities +(leaf *persistence + :config + (leaf desktop + :defvar desktop-globals-to-save + :custom `((desktop-base-file-name . ,(locate-user-emacs-file ".desktop.el")) + (desktop-base-lock-name . ,(locate-user-emacs-file ".desktop.lock")) + (desktop-load-locked-desktop . 'check-pid) + (desktop-restore-eager . 0) + (desktop-restore-frames . nil) + (desktop-save-mode . +1)) + :config + (add-to-list 'desktop-globals-to-save 'extended-command-history) + (add-to-list 'desktop-globals-to-save 'kill-ring) + (add-to-list 'desktop-globals-to-save 'log-edit-comment-ring) + (add-to-list 'desktop-globals-to-save 'read-expression-history)) + (leaf recentf + :defvar recentf-auto-save-timer + :custom `((recentf-auto-save-timer + . ,(run-with-idle-timer 30 t #'recentf-save-list)) + (recentf-max-saved-items . 512) + (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) + :global-minor-mode t)) + (leaf *utilities :config (leaf auth-source @@ -440,29 +463,7 @@ (defvar sort-fold-case) (let ((sort-fold-case t)) (call-interactively 'sort-lines))) - (defalias 'sort-lines-nocase #'elim:sort-lines-nocase)) - (leaf *persistence - :config - (leaf desktop - :defvar desktop-globals-to-save - :custom `((desktop-base-file-name . ,(locate-user-emacs-file ".desktop.el")) - (desktop-base-lock-name . ,(locate-user-emacs-file ".desktop.lock")) - (desktop-load-locked-desktop . 'check-pid) - (desktop-restore-eager . 0) - (desktop-restore-frames . nil) - (desktop-save-mode . +1)) - :config - (add-to-list 'desktop-globals-to-save 'extended-command-history) - (add-to-list 'desktop-globals-to-save 'kill-ring) - (add-to-list 'desktop-globals-to-save 'log-edit-comment-ring) - (add-to-list 'desktop-globals-to-save 'read-expression-history)) - (leaf recentf - :defvar recentf-auto-save-timer - :custom `((recentf-auto-save-timer - . ,(run-with-idle-timer 30 t #'recentf-save-list)) - (recentf-max-saved-items . 512) - (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) - :global-minor-mode t))) + (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) (leaf *identity :custom `((user-mail-address . "takeru.naito@gmail.com") From 90192d92897bd911cf284b361009d30cabf21ef4 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:35:37 +0900 Subject: [PATCH 20/33] refactor(emacs): move discovery commands into *interfaces find-func and help-fns are discovery and introspection commands that fit the interface section. No settings were changed; only the location of these leaf blocks shifted. --- home/takeru/features/emacs/init.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 5e3a32ce..623e874c 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -439,17 +439,6 @@ :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) - (leaf find-func - :config - ;; C-x F => Find Function - ;; C-x V => Find Variable - ;; C-x K => Find Function on Key - (find-function-setup-keys)) - (leaf help-fns - :bind (("H-b" . describe-binding) - ("H-f" . describe-function) - ("H-k" . describe-key) - ("H-v" . describe-variable))) (leaf open-junk-file :bind (("C-x C-z" . open-junk-file)) :custom ((open-junk-file-format . "~/.junk/%Y/%m/%d-%H%M%S.") @@ -494,6 +483,17 @@ (unless (string-match tramp-file-name-regexp (buffer-file-name)) (executable-make-buffer-file-executable-if-script-p))) :hook (after-save-hook . elim:executable-make-buffer-file-executable-if-script-p)) + (leaf find-func + :config + ;; C-x F => Find Function + ;; C-x V => Find Variable + ;; C-x K => Find Function on Key + (find-function-setup-keys)) + (leaf help-fns + :bind (("H-b" . describe-binding) + ("H-f" . describe-function) + ("H-k" . describe-key) + ("H-v" . describe-variable))) (leaf mouse :bind (("C-" . nil) ("C-" . nil) From 5e8c4a56065c23417622c63827e05381a15557ab Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:36:06 +0900 Subject: [PATCH 21/33] refactor(emacs): move executable bit hook into *editing-basics Making script files executable on save is an editing workflow behavior that belongs in *editing-basics. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 623e874c..bafcc11c 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -337,6 +337,12 @@ (put 'scroll-left 'disabled nil) (set-default 'indent-tabs-mode nil) (transient-mark-mode) + (leaf executable + :config + (defun elim:executable-make-buffer-file-executable-if-script-p () + (unless (string-match tramp-file-name-regexp (buffer-file-name)) + (executable-make-buffer-file-executable-if-script-p))) + :hook (after-save-hook . elim:executable-make-buffer-file-executable-if-script-p)) :hook (before-save-hook . elim:auto-delete-trailing-whitespace)) ;;; System integration @@ -477,12 +483,6 @@ (set-default 'cursor-in-non-selected-windows nil) (leaf bs :bind ("C-x C-b" . bs-show)) - (leaf executable - :config - (defun elim:executable-make-buffer-file-executable-if-script-p () - (unless (string-match tramp-file-name-regexp (buffer-file-name)) - (executable-make-buffer-file-executable-if-script-p))) - :hook (after-save-hook . elim:executable-make-buffer-file-executable-if-script-p)) (leaf find-func :config ;; C-x F => Find Function From b397e4c22f24c7336076473dd16f4a4992c3ae45 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:36:20 +0900 Subject: [PATCH 22/33] refactor(emacs): rename *interfaces to *display-and-interaction The section covers both display configuration and interaction behavior. The new name reflects both responsibilities. --- home/takeru/features/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index bafcc11c..48ae2003 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -464,7 +464,7 @@ :custom `((user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito"))) -(leaf *interfaces +(leaf *display-and-interaction :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) (inhibit-startup-screen . t) (mouse-drag-copy-region . t) From 22c0cce6f59941192378a913fd035fa23257b58a Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:36:35 +0900 Subject: [PATCH 23/33] refactor(emacs): move auth-source into system integration auth-source manages credentials for external services and belongs in the system integration section. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 48ae2003..4e2abc4a 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -392,6 +392,9 @@ UTF8_STRING explicitly." (ignore-errors (gui-get-selection 'CLIPBOARD 'UTF8_STRING))))) +(leaf auth-source + :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) + (leaf direnv :global-minor-mode t) (leaf server @@ -441,8 +444,6 @@ (leaf *utilities :config - (leaf auth-source - :custom `(auth-sources . '(,(locate-user-emacs-file ".authinfo.plist")))) (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) (leaf open-junk-file From 0ab565bdcd250d6a2a388d30348542314acec42e Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:36:47 +0900 Subject: [PATCH 24/33] refactor(emacs): rename *utilities to *editor-tools The section primarily holds editor tooling rather than general utilities. The new name is more specific. --- home/takeru/features/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 4e2abc4a..90da1fb0 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -442,7 +442,7 @@ (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) :global-minor-mode t)) -(leaf *utilities +(leaf *editor-tools :config (leaf dabbrev :custom ((dabbrev-abbrev-skip-leading-regexp . "\\$"))) From 12cd64b7eb3addfeee2b1ddbd7ef521d0bed960c Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:36:57 +0900 Subject: [PATCH 25/33] refactor(emacs): rename persistence heading to Persistence and editor tools The heading now reflects its two subsections, *persistence and *editor-tools, which replaced the old *utilities grouping. --- home/takeru/features/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 90da1fb0..12ae867c 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -417,7 +417,7 @@ 'kill-buffer-query-functions 'server-kill-buffer-query-function)) -;;; Persistence and utilities +;;; Persistence and editor tools (leaf *persistence :config From 6cd1898b7cfcdf7197695a7000ab2f96307c1aae Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 16:37:14 +0900 Subject: [PATCH 26/33] refactor(emacs): move wgrep into *editor-tools wgrep enables writable grep results and belongs inside the *editor-tools block. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 12ae867c..853f41b9 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -459,7 +459,9 @@ (defvar sort-fold-case) (let ((sort-fold-case t)) (call-interactively 'sort-lines))) - (defalias 'sort-lines-nocase #'elim:sort-lines-nocase))) + (defalias 'sort-lines-nocase #'elim:sort-lines-nocase)) + (leaf wgrep + :custom ((wgrep-auto-save-buffer . t)))) (leaf *identity :custom `((user-mail-address . "takeru.naito@gmail.com") @@ -516,8 +518,6 @@ :custom ((uniquify-buffer-name-style . 'post-forward-angle-brackets) (uniquify-ignore-buffers-re . "*[^*]+*") (uniquify-min-dir-content . 1))) - (leaf wgrep - :custom ((wgrep-auto-save-buffer . t))) (leaf which-key :hook (after-init-hook . which-key-mode)) (leaf *window-navigation From 63241c4d7a73de0bd575e0cb5fa466eaefef5a9b Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:10:10 +0900 Subject: [PATCH 27/33] refactor(emacs): move skk configuration into input method section *skk is the Japanese input method configuration and belongs under the Input method heading rather than in *editor-modes. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 143 +++++++++++++++-------------- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 853f41b9..5e3cc936 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -313,6 +313,78 @@ ;;; Input method +(leaf *skk + :config + (let* + ((home (getenv "HOME")) + (xdg-config-home (getenv "XDG_CONFIG_HOME")) + (skk-nix-directory (expand-file-name ".nix-profile/share/skk/" home)) + (skk-user-directory (expand-file-name "ddskk" xdg-config-home)) + + ;; List of dictionary files to use + (skk-dictionary-files + '("SKK-JISYO.L.utf8" + "SKK-JISYO.itaiji.utf8" + "SKK-JISYO.jinmei.utf8" + "SKK-JISYO.fullname.utf8" + "SKK-JISYO.propernoun.utf8" + "SKK-JISYO.geo.utf8" + "SKK-JISYO.station.utf8" + "SKK-JISYO.okinawa.utf8" + "SKK-JISYO.china_taiwan.utf8" + "SKK-JISYO.office.zipcode.utf8" + "SKK-JISYO.zipcode.utf8")) + + ;; Generate dictionary file list + (skk-extra-jisyo-file-list + (mapcar (lambda (filename) + (cons (expand-file-name filename skk-nix-directory) 'utf-8)) + skk-dictionary-files))) + + ;; Main SKK configuration + (leaf skk + :defun skk-save-jisyo + :bind* (("C-x C-j" . skk-mode) + ("C-x t" . nil) + ("C-x j" . nil)) + + :custom + ;; Basic settings + ((default-input-method . "japanese-skk") + (skk-user-directory . skk-user-directory) + (skk-jisyo-code . 'utf-8) + + ;; Display and UI settings + (skk-japanese-message-and-error . t) + (skk-kutouten-type . 'jp) + (skk-show-annotation . t) + + ;; Conversion and learning settings + (skk-count-private-jisyo-candidates-exactly . t) + (skk-share-private-jisyo . t) + (skk-henkan-strict-okuri-precedence . t) + (skk-check-okurigana-on-touroku . 'auto) + (skk-search-sagyo-henkaku . t) + + ;; Search settings + (skk-isearch-start-mode . 'latin) + + ;; Dictionary file settings (from Nix) + (skk-extra-jisyo-file-list . skk-extra-jisyo-file-list)) + + :config + ;; Auto-save dictionary settings (6-second interval) + (let ((auto-save-interval 6)) + (run-with-idle-timer auto-save-interval t + #'(lambda () (skk-save-jisyo +1)))))) + + ;; SKK posframe configuration (popup display for conversion candidates) + (leaf ddskk-posframe + :doc "Show Henkan tooltip for ddskk via posframe" + :after skk + :custom ((ddskk-posframe-mode . t)) + :blackout ddskk-posframe-mode)) + ;;; Editor enhancements (leaf *editing-basics @@ -699,77 +771,6 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." :tag "builtin" :added "2024-08-24" :custom ((global-so-long-mode . t))) - (leaf *skk - :config - (let* - ((home (getenv "HOME")) - (xdg-config-home (getenv "XDG_CONFIG_HOME")) - (skk-nix-directory (expand-file-name ".nix-profile/share/skk/" home)) - (skk-user-directory (expand-file-name "ddskk" xdg-config-home)) - - ;; List of dictionary files to use - (skk-dictionary-files - '("SKK-JISYO.L.utf8" - "SKK-JISYO.itaiji.utf8" - "SKK-JISYO.jinmei.utf8" - "SKK-JISYO.fullname.utf8" - "SKK-JISYO.propernoun.utf8" - "SKK-JISYO.geo.utf8" - "SKK-JISYO.station.utf8" - "SKK-JISYO.okinawa.utf8" - "SKK-JISYO.china_taiwan.utf8" - "SKK-JISYO.office.zipcode.utf8" - "SKK-JISYO.zipcode.utf8")) - - ;; Generate dictionary file list - (skk-extra-jisyo-file-list - (mapcar (lambda (filename) - (cons (expand-file-name filename skk-nix-directory) 'utf-8)) - skk-dictionary-files))) - - ;; Main SKK configuration - (leaf skk - :defun skk-save-jisyo - :bind* (("C-x C-j" . skk-mode) - ("C-x t" . nil) - ("C-x j" . nil)) - - :custom - ;; Basic settings - ((default-input-method . "japanese-skk") - (skk-user-directory . skk-user-directory) - (skk-jisyo-code . 'utf-8) - - ;; Display and UI settings - (skk-japanese-message-and-error . t) - (skk-kutouten-type . 'jp) - (skk-show-annotation . t) - - ;; Conversion and learning settings - (skk-count-private-jisyo-candidates-exactly . t) - (skk-share-private-jisyo . t) - (skk-henkan-strict-okuri-precedence . t) - (skk-check-okurigana-on-touroku . 'auto) - (skk-search-sagyo-henkaku . t) - - ;; Search settings - (skk-isearch-start-mode . 'latin) - - ;; Dictionary file settings (from Nix) - (skk-extra-jisyo-file-list . skk-extra-jisyo-file-list)) - - :config - ;; Auto-save dictionary settings (6-second interval) - (let ((auto-save-interval 6)) - (run-with-idle-timer auto-save-interval t - #'(lambda () (skk-save-jisyo +1)))))) - - ;; SKK posframe configuration (popup display for conversion candidates) - (leaf ddskk-posframe - :doc "Show Henkan tooltip for ddskk via posframe" - :after skk - :custom ((ddskk-posframe-mode . t)) - :blackout ddskk-posframe-mode)) (leaf topsy :doc "Simple sticky header" :req "emacs-26.3" From cb92b9c874218d4444ebe528aa62d71a6667c8bc Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:10:36 +0900 Subject: [PATCH 28/33] refactor(emacs): move persistent-scratch into *persistence persistent-scratch saves and restores the scratch buffer across sessions and belongs alongside desktop and recentf in *persistence. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 5e3cc936..f5be6548 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -512,7 +512,14 @@ . ,(run-with-idle-timer 30 t #'recentf-save-list)) (recentf-max-saved-items . 512) (recentf-save-file . ,(locate-user-emacs-file ".recentf.el"))) - :global-minor-mode t)) + :global-minor-mode t) + (leaf persistent-scratch + :defun persistent-scratch-setup-default + :custom `(persistent-scratch-save-file . ,(locate-user-emacs-file ".scratch.el")) + :config + (with-current-buffer "*scratch*" + (emacs-lock-mode 'kill)) + (persistent-scratch-setup-default))) (leaf *editor-tools :config @@ -751,13 +758,6 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." ("C-c C-M-c" . hs-toggle-hiding) ("C-c h" . hs-toggle-hiding) ("C-c l" . hs-hide-level)))) - (leaf persistent-scratch - :defun persistent-scratch-setup-default - :custom `(persistent-scratch-save-file . ,(locate-user-emacs-file ".scratch.el")) - :config - (with-current-buffer "*scratch*" - (emacs-lock-mode 'kill)) - (persistent-scratch-setup-default)) (leaf projectile :bind (("M-t" . projectile-command-map)) :global-minor-mode t From 380a9428c7c3f45aba917925c211d050da613d34 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:11:05 +0900 Subject: [PATCH 29/33] refactor(emacs): move google-translate into system integration google-translate connects to an external service and belongs in the system integration section. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 85 +++++++++++++++--------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index f5be6548..d957f0aa 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -489,6 +489,49 @@ 'kill-buffer-query-functions 'server-kill-buffer-query-function)) +(leaf google-translate + :defun google-translate-translate + :bind (("C-c t" . google-translate-enja-or-jaen)) + :custom (google-translate-backend-method . 'curl) + :url http://emacs.rubikitch.com/google-translate/ + :config + (defvar google-translate-english-chars "[:ascii:]" + "If the target string consists of that pattern, it is assumed to be English.") + (defun google-translate-enja-or-jaen (&optional initial-text) + "Translate the region, sentence, or a given text between English and Japanese. + +Replaces newlines with spaces to treat the text as a single sentence. +When called with a prefix argument (C-u), prompt for input in the minibuffer." + (interactive + ;; Define the interactive behavior in a list form for clarity. + (list (cond ((use-region-p) + ;; If a region is active, use its content as the argument. + (buffer-substring-no-properties (region-beginning) (region-end))) + (current-prefix-arg + ;; If a prefix arg is supplied (C-u), prompt for the string to translate. + (read-string "Google Translate (en/ja): "))))) + + ;; Use let* to bind variables sequentially, making the data flow clear. + (let* ( + ;; 1. Determine the target text to translate. + (target-text + (or initial-text ; Use the text from the interactive call if available. + ;; Otherwise, get the sentence at the current point. + (save-excursion + (thing-at-point 'sentence)))) + + ;; 2. Pre-process the text (replace newlines with spaces). + (processed-text (replace-regexp-in-string "\n" " " target-text)) + + ;; 3. Detect the source language. + (english-p (string-match-p "\\`[[:ascii:]]+\\'" processed-text)) + (source-lang (if english-p "en" "ja")) + (target-lang (if english-p "ja" "en"))) + + ;; 4. Execute the translation. + (deactivate-mark) ; Deactivate the mark before displaying the translation. + (google-translate-translate source-lang target-lang processed-text)))) + ;;; Persistence and editor tools (leaf *persistence @@ -709,48 +752,6 @@ (leaf flyspell :custom ((ispell-dictionary . "american") (flyspell-use-meta-tab . nil))) - (leaf google-translate - :defun google-translate-translate - :bind (("C-c t" . google-translate-enja-or-jaen)) - :custom (google-translate-backend-method . 'curl) - :url http://emacs.rubikitch.com/google-translate/ - :config - (defvar google-translate-english-chars "[:ascii:]" - "If the target string consists of that pattern, it is assumed to be English.") - (defun google-translate-enja-or-jaen (&optional initial-text) - "Translate the region, sentence, or a given text between English and Japanese. - -Replaces newlines with spaces to treat the text as a single sentence. -When called with a prefix argument (C-u), prompt for input in the minibuffer." - (interactive - ;; Define the interactive behavior in a list form for clarity. - (list (cond ((use-region-p) - ;; If a region is active, use its content as the argument. - (buffer-substring-no-properties (region-beginning) (region-end))) - (current-prefix-arg - ;; If a prefix arg is supplied (C-u), prompt for the string to translate. - (read-string "Google Translate (en/ja): "))))) - - ;; Use let* to bind variables sequentially, making the data flow clear. - (let* ( - ;; 1. Determine the target text to translate. - (target-text - (or initial-text ; Use the text from the interactive call if available. - ;; Otherwise, get the sentence at the current point. - (save-excursion - (thing-at-point 'sentence)))) - - ;; 2. Pre-process the text (replace newlines with spaces). - (processed-text (replace-regexp-in-string "\n" " " target-text)) - - ;; 3. Detect the source language. - (english-p (string-match-p "\\`[[:ascii:]]+\\'" processed-text)) - (source-lang (if english-p "en" "ja")) - (target-lang (if english-p "ja" "en"))) - - ;; 4. Execute the translation. - (deactivate-mark) ; Deactivate the mark before displaying the translation. - (google-translate-translate source-lang target-lang processed-text)))) (leaf help :config (temp-buffer-resize-mode t)) (leaf hideshow From 8bc1072613c10888045e073dfcdcb3f8e1c8f40a Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:11:18 +0900 Subject: [PATCH 30/33] refactor(emacs): move help display setup into *display-and-interaction temp-buffer-resize-mode affects how help and output buffers are displayed and belongs in *display-and-interaction. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index d957f0aa..9b3d475f 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -619,6 +619,8 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." ("H-f" . describe-function) ("H-k" . describe-key) ("H-v" . describe-variable))) + (leaf help + :config (temp-buffer-resize-mode t)) (leaf mouse :bind (("C-" . nil) ("C-" . nil) @@ -752,8 +754,6 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." (leaf flyspell :custom ((ispell-dictionary . "american") (flyspell-use-meta-tab . nil))) - (leaf help - :config (temp-buffer-resize-mode t)) (leaf hideshow :bind ((:hs-minor-mode-map ("C-c C-M-c" . hs-toggle-hiding) From d532c10c5033f0764651e77f0fe329c14bdd8ce5 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:11:59 +0900 Subject: [PATCH 31/33] refactor(emacs): move magit into version control section magit is the primary VCS interface and belongs alongside browse-at-remote, git-modes, and vc in the version control section. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index 9b3d475f..d07a6ca1 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -148,6 +148,19 @@ (leaf vc :custom (vc-follow-symlinks . t)) +(leaf magit + :bind (("C-x v s" . magit-status) + ("C-x v f" . magit-diff-buffer-file)) + :custom (magit-diff-refine-hunk . 'all) + :hook (git-commit-setup-hook . elim:git-commit-setup-hook-func) + :init (add-to-list 'process-coding-system-alist '("git" utf-8 . utf-8)) + :config + (defun elim:git-commit-setup-hook-func () + (flyspell-mode +1) + (set (make-local-variable + 'elim:auto-delete-trailing-whitespace-enable-p) nil)) + :blackout auto-revert-mode) + ;;; Programming languages ;; Lua development environment @@ -821,18 +834,6 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." (leaf js :custom ((js-indent-level . 2))) (leaf json-mode) - (leaf magit - :bind (("C-x v s" . magit-status) - ("C-x v f" . magit-diff-buffer-file)) - :custom (magit-diff-refine-hunk . 'all) - :hook (git-commit-setup-hook . elim:git-commit-setup-hook-func) - :init (add-to-list 'process-coding-system-alist '("git" utf-8 . utf-8)) - :config - (defun elim:git-commit-setup-hook-func () - (flyspell-mode +1) - (set (make-local-variable - 'elim:auto-delete-trailing-whitespace-enable-p) nil)) - :blackout auto-revert-mode) (leaf markdown-mode :mode (("\\.md\\'" "\\ISSUE_EDITMSG\\'") . gfm-mode) :bind (:markdown-mode-map From 7db0a526dabd34a3f1605d830acf239b7941a9f8 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:12:19 +0900 Subject: [PATCH 32/33] refactor(emacs): move dired configuration into *display-and-interaction *dired is a file browser UI and belongs in *display-and-interaction rather than in *editor-modes. No settings were changed; only the location of the leaf block shifted. --- home/takeru/features/emacs/init.el | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index d07a6ca1..cd1053f7 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -634,6 +634,34 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." ("H-v" . describe-variable))) (leaf help :config (temp-buffer-resize-mode t)) + (leaf *dired + :config + (leaf dired + :bind (:dired-mode-map + ("SPC" . elim:dired-toggle-mark) + ("r" . dired-toggle-read-only)) + :custom ((dired-recursive-copies . 'always) + (dired-recursive-deletes . 'always)) + :defun dired-mark dired-unmark + :preface + ;; Mark with space (like the FD) + (defun elim:dired-toggle-mark (arg) + "Toggle the current (or next ARG) files." + ;; Based on S.Namba Sat Aug 10 12:20:36 1996 + ;; Modernized for current Emacs + (interactive "P") + (let ((current-mark (char-after (line-beginning-position)))) + (if (eq current-mark ?\s) ; If unmarked (space) + (dired-mark arg) ; Mark it + (dired-unmark arg))))) ; If marked, unmark it + (leaf dired-x + :custom ((dired-bind-jump . nil) + (dired-guess-shell-alist-user + . '(("\\.tar\\.gz\\'" "tar tzvf") + ("\\.taz\\'" "tar ztvf") + ("\\.tar\\.bz2\\'" "tar tjvf") + ("\\.zip\\'" "unzip -l") + ("\\.\\(g\\|\\) z\\'" "zcat")))))) (leaf mouse :bind (("C-" . nil) ("C-" . nil) @@ -714,34 +742,6 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." :leaf-defer nil :custom ((auto-save-visited-interval . 0.5)) :global-minor-mode t) - (leaf *dired - :config - (leaf dired - :bind (:dired-mode-map - ("SPC" . elim:dired-toggle-mark) - ("r" . dired-toggle-read-only)) - :custom ((dired-recursive-copies . 'always) - (dired-recursive-deletes . 'always)) - :defun dired-mark dired-unmark - :preface - ;; Mark with space (like the FD) - (defun elim:dired-toggle-mark (arg) - "Toggle the current (or next ARG) files." - ;; Based on S.Namba Sat Aug 10 12:20:36 1996 - ;; Modernized for current Emacs - (interactive "P") - (let ((current-mark (char-after (line-beginning-position)))) - (if (eq current-mark ?\s) ; If unmarked (space) - (dired-mark arg) ; Mark it - (dired-unmark arg))))) ; If marked, unmark it - (leaf dired-x - :custom ((dired-bind-jump . nil) - (dired-guess-shell-alist-user - . '(("\\.tar\\.gz\\'" "tar tzvf") - ("\\.taz\\'" "tar ztvf") - ("\\.tar\\.bz2\\'" "tar tjvf") - ("\\.zip\\'" "unzip -l") - ("\\.\\(g\\|\\) z\\'" "zcat")))))) (leaf diff-mode :custom-face ((diff-added . '((nil (:foreground "white" :background "dark green")))) From 3670103a84d9f5607b981372fd02cca885097050 Mon Sep 17 00:00:00 2001 From: Takeru Naito Date: Mon, 27 Apr 2026 17:12:49 +0900 Subject: [PATCH 33/33] refactor(emacs): rename mode sections and add matching headings *minor-modes becomes *editor-modes and *major-modes becomes *languages-and-authoring. Four section comment headings (Identity, Display and interaction, Editor modes, Languages and authoring) are added to align with the current leaf structure. --- home/takeru/features/emacs/init.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/takeru/features/emacs/init.el b/home/takeru/features/emacs/init.el index cd1053f7..c3d236b5 100644 --- a/home/takeru/features/emacs/init.el +++ b/home/takeru/features/emacs/init.el @@ -598,10 +598,14 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." (leaf wgrep :custom ((wgrep-auto-save-buffer . t)))) +;;; Identity + (leaf *identity :custom `((user-mail-address . "takeru.naito@gmail.com") (user-full-name . "Takeru Naito"))) +;;; Display and interaction + (leaf *display-and-interaction :custom ((frame-title-format . `(" %b " (buffer-file-name "( %f )"))) (inhibit-startup-screen . t) @@ -726,7 +730,9 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." ("C-c C-p" . windmove-up) ("C-c C-f" . windmove-right))))) -(leaf *minor-modes +;;; Editor modes + +(leaf *editor-modes :config (leaf anzu :bind (([remap query-replace] . anzu-query-replace) @@ -798,7 +804,9 @@ When called with a prefix argument (C-u), prompt for input in the minibuffer." (leaf vundo :bind (("C-x u" . vundo)))) -(leaf *major-modes +;;; Languages and authoring + +(leaf *languages-and-authoring :config (leaf cc-mode :defun c-toggle-auto-hungry-state