;;; init-startup.el --- startup settings -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: ;; 编码设置 (set-selection-coding-system 'utf-8) (when (fboundp 'set-charset-priority) (set-charset-priority 'unicode)) (set-default-coding-systems 'utf-8) (set-buffer-file-coding-system 'utf-8) (set-clipboard-coding-system 'utf-8) (set-file-name-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-next-selection-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (setq locale-coding-system 'utf-8) (setq system-time-locale "C") ;; 全屏 (cond (*is-mac* (set-frame-parameter nil 'fullscreen 'fullscreen) (toggle-frame-fullscreen) (global-unset-key (kbd "")) (global-set-key (kbd "") 'toggle-frame-fullscreen)) (*is-windows* (toggle-frame-maximized)) (t nil)) ;; 备份文件和自动保存文件 (setq backup-directory-alist `((".*" . ,(expand-file-name "backup/" user-emacs-directory))) backup-by-copying t delete-old-versions t kept-new-versions 6 kept-old-versions 2 version-control t) (setq auto-save-file-name-transforms `((".*" ,(expand-file-name "auto-save-list/" user-emacs-directory) t))) ;; 开启水平滚动 (put 'scroll-left 'disabled nil) ;; 关闭lock文件 (setq create-lockfiles nil) ;; 关闭提示音 (setq ring-bell-function 'ignore) ;; 添加包管理器目录 (cond (*is-windows* (add-to-list 'exec-path (expand-file-name "H/appppppppppp/scoop/apps/")) (setenv "PATH" (concat (expand-file-name "H/appppppppppp/scoop/apps/") ";" (getenv "PATH")))) (*is-mac* (add-to-list 'exec-path (expand-file-name "/opt/homebrew/bin/")) (setenv "PATH" (concat (expand-file-name "/opt/homebrew/bin/") ":" (getenv "PATH")))) (*is-linux* (add-to-list 'exec-path (expand-file-name "~/.guix-home/profile/bin/")) (setenv "PATH" (concat (expand-file-name "~/.guix-home/profile/bin/") ":" (getenv "PATH"))))) ;; scratch buffer (setq initial-scratch-message "") (defun my/scratch-set-mode (&rest _) (when (eq major-mode 'fundamental-mode) (funcall initial-major-mode))) (advice-add 'scratch-buffer :after #'my/scratch-set-mode) ;; 窗口名 (setq-default frame-title-format '("%b - Emacs")) ;; 关闭native compile警告 (setq native-comp-async-warnings-errors-kind 'silent) ;; short anwser (if (boundp 'use-short-answers) (setq use-short-answers t) (fset 'yes-or-no-p 'y-or-n-p)) ;; 移动到垃圾桶 (setq delete-by-moving-to-trash t) (provide 'init-startup) ;;; init-startup.el ends here