style(config): Reformat Emacs Lisp code for consistency

Standardize formatting across multiple init files: expand
single-line use-package keywords onto separate lines, fix
indentation, remove outdated comments, and clean up whitespace. Also
adds mc/keymap <return> binding and improves fcitx5 startup logic in
EXWM.
This commit is contained in:
2026-05-11 03:40:06 +08:00
parent 71a57a6922
commit aa4dea523e
11 changed files with 89 additions and 67 deletions

View File

@@ -6,25 +6,29 @@
;; eglot ;; eglot
(use-package eglot (use-package eglot
:hook ((python-mode . eglot-ensure) :hook
;; (scheme-mode . eglot-ensure) ((python-mode . eglot-ensure)
) ;; (scheme-mode . eglot-ensure)
)
:config :config
(setq eglot-send-changes-idle-time 0.25) (setq eglot-send-changes-idle-time 0.25)
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
'(scheme-mode . ("guile-lsp-server"))) '(scheme-mode . ("guile-lsp-server")))
(add-hook 'eglot-managed-mode-hook ;; 在scheme模式禁用eglot补全保留其他功能 ;; 在scheme模式禁用eglot补全保留其他功能
(lambda () (add-hook 'eglot-managed-mode-hook
(when (derived-mode-p 'scheme-mode) (lambda ()
(setq-local completion-at-point-functions (when (derived-mode-p 'scheme-mode)
(remq 'eglot-completion-at-point (setq-local completion-at-point-functions
completion-at-point-functions)))))) (remq 'eglot-completion-at-point
completion-at-point-functions))))))
;; corfu ;; corfu
(use-package corfu (use-package corfu
:autoload (corfu-quit consult-completion-in-region) :autoload
:functions (persistent-scratch-save) (corfu-quit consult-completion-in-region)
:functions
(persistent-scratch-save)
:custom :custom
(corfu-auto t) (corfu-auto t)
(corfu-auto-prefix 2) (corfu-auto-prefix 2)
@@ -47,8 +51,9 @@
;;Quit completion before saving ;;Quit completion before saving
(add-hook 'before-save-hook #'corfu-quit) (add-hook 'before-save-hook #'corfu-quit)
(advice-add #'persistent-scratch-save :before #'corfu-quit) (advice-add #'persistent-scratch-save :before #'corfu-quit)
:bind (:map corfu-map :bind
("RET" . nil))) (:map corfu-map
("RET" . nil)))
;; 在eshell中使用tab打开补全 ;; 在eshell中使用tab打开补全
(add-hook 'eshell-mode-hook (add-hook 'eshell-mode-hook

View File

@@ -28,7 +28,7 @@
(setq dirvish-default-layout '(1 0.15 0.45)) (setq dirvish-default-layout '(1 0.15 0.45))
(with-eval-after-load 'dirvish (with-eval-after-load 'dirvish
(add-hook 'dired-mode-hook #'dired-hide-details-mode)) (add-hook 'dired-mode-hook #'dired-hide-details-mode))
:custom :custom
(dirvish-quick-access-entries (dirvish-quick-access-entries
@@ -62,7 +62,8 @@
(t nil)))) (t nil))))
(use-package trashed (use-package trashed
:commands (trashed) :commands
(trashed)
:config :config
(setq trashed-action-confirmer 'y-or-n-p) (setq trashed-action-confirmer 'y-or-n-p)
(setq trashed-use-header-line t) (setq trashed-use-header-line t)

View File

@@ -14,7 +14,7 @@
(let ((display-buffer-alist (let ((display-buffer-alist
'((".*" . (display-buffer-no-window . nil))))) '((".*" . (display-buffer-no-window . nil)))))
(async-shell-command command)))) (async-shell-command command))))
(defun restart-fcitx5 () (defun restart-fcitx5 ()
"Kill and restart fcitx5, to fix random issues in exwm." "Kill and restart fcitx5, to fix random issues in exwm."
(interactive) (interactive)
@@ -117,6 +117,7 @@
(use-package desktop-environment (use-package desktop-environment
:init :init
(desktop-environment-mode) (desktop-environment-mode)
:config :config
(advice-add 'desktop-environment-screenshot :after (advice-add 'desktop-environment-screenshot :after
(lambda (&rest _) (message "Saved fullscreen screenshot."))) (lambda (&rest _) (message "Saved fullscreen screenshot.")))
@@ -131,22 +132,26 @@
(add-hook 'exwm-init-hook (add-hook 'exwm-init-hook
(lambda () (lambda ()
(unless (zerop (shell-command "pgrep -x fcitx5")) (if (zerop (shell-command "pgrep -x fcitx5"))
(start-process-shell-command "fcitx5" nil "fcitx5 -d")) (restart-fcitx5)
(start-process-shell-command "fcitx5" nil "fcitx5 -d"))
(unless (zerop (shell-command "pgrep -x mihomo")) (unless (zerop (shell-command "pgrep -x mihomo"))
(start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/")) (start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
(start-process-shell-command "xrandr-refresh" nil "xrandr --output DP-4 --mode 2560x1440 --rate 165.00") (start-process-shell-command "xrandr-refresh" nil "xrandr --output DP-4 --mode 2560x1440 --rate 165.00")
(start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45"))) (start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45")))
(use-package xdg-launcher (use-package xdg-launcher
:straight (xdg-launcher :type git :straight
:host github (xdg-launcher :type git
:repo "emacs-exwm/xdg-launcher") :host github
:bind (("s-SPC" . xdg-launcher-run-app)) :repo "emacs-exwm/xdg-launcher")
:init (with-eval-after-load 'consult :bind
(unless (memq 'xdg-launcher-consult-source consult-buffer-sources) (("s-SPC" . xdg-launcher-run-app))
(setq consult-buffer-sources :init
(append consult-buffer-sources '(xdg-launcher-consult-source)))))) (with-eval-after-load 'consult
(unless (memq 'xdg-launcher-consult-source consult-buffer-sources)
(setq consult-buffer-sources
(append consult-buffer-sources '(xdg-launcher-consult-source))))))
) )
(provide 'init-exwm) (provide 'init-exwm)

View File

@@ -5,7 +5,9 @@
;;; Code: ;;; Code:
(use-package gptel (use-package gptel
:hook (gptel-mode-hook . visual-line-mode) :hook
(gptel-mode-hook . visual-line-mode)
:config :config
(setq gptel-log-level t) (setq gptel-log-level t)
(setq gptel-default-mode 'org-mode) (setq gptel-default-mode 'org-mode)
@@ -129,6 +131,7 @@ from the last 1500 characters of the buffer."
(use-package gptel-magit (use-package gptel-magit
:hook :hook
(magit-mode . gptel-magit-install) (magit-mode . gptel-magit-install)
:init :init
(with-eval-after-load 'gptel (with-eval-after-load 'gptel
(gptel-make-openai "Kimi-Code-magit" (gptel-make-openai "Kimi-Code-magit"

View File

@@ -177,6 +177,10 @@
(general-def calendar-mode-map (general-def calendar-mode-map
"RET" 'denote-journal-calendar-find-file) "RET" 'denote-journal-calendar-find-file)
;; multiple-cursor
(general-def mc/keymap
"<return>" 'newline)
;; emms ;; emms
(general-def emms-playlist-mode-map (general-def emms-playlist-mode-map
"<prior>" 'emms-previous "<prior>" 'emms-previous
@@ -272,7 +276,7 @@
(lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer))) (lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
"show diff between the buffer and its file")) "show diff between the buffer and its file"))
;; multiple-cursors ;; multiple-cursors hydra
(defhydra hydra-multiple-cursors () (defhydra hydra-multiple-cursors ()
" "
^Mark^ ^Unmark^ ^Other^ ^Mark^ ^Unmark^ ^Other^

View File

@@ -172,6 +172,7 @@
(:name "someday" :todo "SOMEDAY") (:name "someday" :todo "SOMEDAY")
)))))))) ))))))))
;; capture模板
(unless *is-windows* (unless *is-windows*
(setq org-capture-templates (setq org-capture-templates
'(("t" "TODO" entry '(("t" "TODO" entry
@@ -186,7 +187,6 @@
(setq org-bookmark-names-plist nil) (setq org-bookmark-names-plist nil)
;; hugo ;; hugo
;; 安装ox-hugo
(use-package ox-hugo) (use-package ox-hugo)
(with-eval-after-load 'org-capture (with-eval-after-load 'org-capture

View File

@@ -16,21 +16,21 @@
(async-bytecomp-package-mode 1) (async-bytecomp-package-mode 1)
(setq async-bytecomp-allowed-packages '(all))) (setq async-bytecomp-allowed-packages '(all)))
;; 安装multiple-cursors ;; multiple-cursors
(use-package multiple-cursors (use-package multiple-cursors
:config :config
(setq mc/insert-numbers-default 1)) (setq mc/insert-numbers-default 1))
;; 安装crux增强快捷键快捷键配置在init-kbd.el中 ;; crux实用函数
(use-package crux) (use-package crux)
;; 安装hungry-delete ;; hungry-delete,快速删除
(use-package hungry-delete) (use-package hungry-delete)
;; 安装drag-stuff拖动字符 ;; drag-stuff拖动字符
(use-package drag-stuff) (use-package drag-stuff)
;; 安装which-key快捷键提示 ;; which-key快捷键提示
(use-package which-key (use-package which-key
:delight :delight
:defer 0 :defer 0
@@ -40,22 +40,22 @@
;; ripgrep ;; ripgrep
(use-package rg) (use-package rg)
;; 安装vertico ;; verticominibuffer补全
(use-package vertico (use-package vertico
:init :init
(vertico-mode)) (vertico-mode))
;; 安装orderless用于模糊搜索 ;; orderless模糊搜索
(use-package orderless (use-package orderless
:custom :custom
(completion-styles '(orderless basic))) (completion-styles '(orderless basic)))
;; 安装marginalia用于命令注释 ;; marginalia命令注释
(use-package marginalia (use-package marginalia
:init :init
(marginalia-mode)) (marginalia-mode))
;; 安装consult增强搜索和其他菜单 ;; consult搜索与导航
(use-package consult (use-package consult
:config :config
;; everything ;; everything
@@ -74,7 +74,7 @@
(when *is-linux* (when *is-linux*
(setq consult-locate-args "plocate --basename --ignore-case"))) (setq consult-locate-args "plocate --basename --ignore-case")))
;; embark ;; embark,快捷指令
(use-package embark (use-package embark
:config :config
(setq prefix-help-command 'embark-prefix-help-command) (setq prefix-help-command 'embark-prefix-help-command)
@@ -87,7 +87,6 @@
(let ((embark-quit-after-action nil)) (let ((embark-quit-after-action nil))
(embark-dwim))))) (embark-dwim)))))
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil nil
@@ -140,10 +139,10 @@ targets."
'embark-collect-mode-hook 'embark-collect-mode-hook
#'consult-preview-at-point-mode)) #'consult-preview-at-point-mode))
;; wgrep ;; wgrepwritable grep
(use-package wgrep) (use-package wgrep)
;; anzu ;; anzu显示isearch匹配数字
(use-package anzu (use-package anzu
:delight :delight
:init :init
@@ -162,12 +161,12 @@ targets."
savehist-autosave-interval 300) savehist-autosave-interval 300)
(savehist-mode)) (savehist-mode))
;; saveplace保存光标位置 ;; 启用saveplace保存光标位置
(use-package saveplace (use-package saveplace
:init :init
(save-place-mode)) (save-place-mode))
;; undo增强 ;; 撤回增强和跨会话历史
(use-package undo-fu) (use-package undo-fu)
(use-package undo-fu-session (use-package undo-fu-session
@@ -184,7 +183,7 @@ targets."
;; expand-region快速展开选中 ;; expand-region快速展开选中
(use-package expand-region) (use-package expand-region)
;; projectile ;; projectile,项目管理
(use-package projectile (use-package projectile
:delight :delight
:init :init
@@ -239,11 +238,11 @@ targets."
(modify-syntax-entry (+ start i) "_" jinx--syntax-table))))) (modify-syntax-entry (+ start i) "_" jinx--syntax-table)))))
(require 'init-jinx))) (require 'init-jinx)))
;; vterm ;; vterm,终端
;; (unless *is-windows* ;; (unless *is-windows*
;; (use-package vterm)) ;; (use-package vterm))
;; eat ;; eat,终端
(use-package eat (use-package eat
:straight :straight
(eat :type git (eat :type git
@@ -263,7 +262,7 @@ targets."
:config :config
(setq eat-term-terminfo-directory eat--terminfo-path)) (setq eat-term-terminfo-directory eat--terminfo-path))
;; general ;; general,键位绑定
(use-package general) (use-package general)
;; hydra ;; hydra
@@ -281,12 +280,12 @@ targets."
(?t "Types" font-lock-type-face) (?t "Types" font-lock-type-face)
(?v "Variables" font-lock-variable-name-face))))))) (?v "Variables" font-lock-variable-name-face)))))))
;; perspective ;; perspective,工作区管理
(use-package perspective (use-package perspective
:bind :bind
("C-x M-b" . persp-list-buffers) ; or use a nicer switcher, see below ("C-x M-b" . persp-list-buffers)
:custom :custom
(persp-mode-prefix-key (kbd "C-c p")) ; pick your own prefix key here (persp-mode-prefix-key (kbd "C-c p"))
:init :init
(persp-mode) (persp-mode)
:config :config

View File

@@ -27,7 +27,8 @@
;; lua ;; lua
(use-package lua-ts-mode (use-package lua-ts-mode
:mode ("\\.lua\\'" . lua-ts-mode) :mode
("\\.lua\\'" . lua-ts-mode)
:config :config
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode))) (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)))
@@ -41,9 +42,12 @@
;; markdown ;; markdown
(use-package markdown-mode (use-package markdown-mode
:mode ("README\\.md\\'" . gfm-mode) :mode
:init (setq markdown-command "multimarkdown") ("README\\.md\\'" . gfm-mode)
:bind (:map markdown-mode-map :init
(setq markdown-command "multimarkdown")
:bind
(:map markdown-mode-map
("C-c C-e" . markdown-do))) ("C-c C-e" . markdown-do)))

View File

@@ -36,12 +36,15 @@
;; 其他配置 ;; 其他配置
(setq cns-recent-segmentation-limit 40) (setq cns-recent-segmentation-limit 40)
(require 'cns nil t) (require 'cns nil t)
;; 自动启动 ;; 自动启动
(when (featurep 'cns) (when (featurep 'cns)
(add-hook 'find-file-hook 'global-cns-mode)) (add-hook 'find-file-hook 'global-cns-mode))
;; 取消C-<backspace>绑定 ;; 取消C-<backspace>绑定
(with-eval-after-load 'cns (with-eval-after-load 'cns
(define-key cns-mode-map (kbd "C-<backspace>") nil)) (define-key cns-mode-map (kbd "C-<backspace>") nil))
;; vterm下关闭cns-mode ;; vterm下关闭cns-mode
(add-hook 'vterm-mode-hook (add-hook 'vterm-mode-hook
(lambda () (lambda ()

View File

@@ -68,17 +68,10 @@
;; (use-package color-theme-modern) ;; (use-package color-theme-modern)
(use-package naysayer-theme) (use-package naysayer-theme)
;; (use-package simple-modeline
;; :init (simple-modeline-mode)
;; :config
;; ;; (defun simple-modeline-segment-buffer-name ()
;; ;; "Displays the full path of current file in the mode-line."
;; ;; (propertize " %f" 'face 'mode-line-buffer-id))
;; )
;; eshell高亮 ;; eshell高亮
(use-package eshell-syntax-highlighting (use-package eshell-syntax-highlighting
:hook (eshell-mode . eshell-syntax-highlighting-global-mode)) :hook
(eshell-mode . eshell-syntax-highlighting-global-mode))
(add-hook 'eshell-mode-hook (add-hook 'eshell-mode-hook
(lambda () (lambda ()
@@ -90,6 +83,7 @@
"di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46") "di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46")
(setenv "GIT_CONFIG_GLOBAL" (expand-file-name "~/.emacs.d/.gitconfig-eshell")))) (setenv "GIT_CONFIG_GLOBAL" (expand-file-name "~/.emacs.d/.gitconfig-eshell"))))
;; 缩进线
(use-package indent-bars (use-package indent-bars
:custom :custom
(indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.4)) (indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.4))

View File

@@ -5,9 +5,13 @@
;;; Code: ;;; Code:
(use-package popper (use-package popper
:defines popper-echo-dispatch-actions :defines
:commands popper-group-by-directory popper-echo-dispatch-actions
:hook (emacs-startup . popper-mode) :commands
popper-group-by-directory
:hook
(emacs-startup . popper-mode)
:init :init
(setq popper-reference-buffers (setq popper-reference-buffers
'("\\*Messages\\*" '("\\*Messages\\*"