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

View File

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

View File

@@ -117,6 +117,7 @@
(use-package desktop-environment
:init
(desktop-environment-mode)
:config
(advice-add 'desktop-environment-screenshot :after
(lambda (&rest _) (message "Saved fullscreen screenshot.")))
@@ -131,22 +132,26 @@
(add-hook 'exwm-init-hook
(lambda ()
(unless (zerop (shell-command "pgrep -x fcitx5"))
(start-process-shell-command "fcitx5" nil "fcitx5 -d"))
(if (zerop (shell-command "pgrep -x fcitx5"))
(restart-fcitx5)
(start-process-shell-command "fcitx5" nil "fcitx5 -d"))
(unless (zerop (shell-command "pgrep -x 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 "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45")))
(use-package xdg-launcher
:straight (xdg-launcher :type git
:host github
:repo "emacs-exwm/xdg-launcher")
:bind (("s-SPC" . xdg-launcher-run-app))
:init (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))))))
:straight
(xdg-launcher :type git
:host github
:repo "emacs-exwm/xdg-launcher")
:bind
(("s-SPC" . xdg-launcher-run-app))
:init
(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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -68,17 +68,10 @@
;; (use-package color-theme-modern)
(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高亮
(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
(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")
(setenv "GIT_CONFIG_GLOBAL" (expand-file-name "~/.emacs.d/.gitconfig-eshell"))))
;; 缩进线
(use-package indent-bars
:custom
(indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.4))

View File

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