add magit
This commit is contained in:
10 files changed
+147
No files matched your search
@@ -0,0 +1,3 @@
|
||||
/auto-save-list/
|
||||
/transient/
|
||||
/elpa/
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
[submodule "site-lisp/magit"]
|
||||
path = site-lisp/magit
|
||||
url = https://github.com/magit/magit.git
|
||||
[submodule "site-lisp/dash"]
|
||||
path = site-lisp/dash
|
||||
url = https://github.com/magnars/dash.el.git
|
||||
[submodule "site-lisp/transient"]
|
||||
path = site-lisp/transient
|
||||
url = https://github.com/magit/transient.git
|
||||
[submodule "site-lisp/with-editor"]
|
||||
path = site-lisp/with-editor
|
||||
url = https://github.com/magit/with-editor.git
|
||||
[submodule "site-lisp/compat"]
|
||||
path = site-lisp/compat
|
||||
url = https://git.sr.ht/~pkal/compat
|
||||
[submodule "site-lisp/lazy-load"]
|
||||
path = site-lisp/lazy-load
|
||||
url = https://github.com/manateelazycat/lazy-load.git
|
||||
@@ -0,0 +1,16 @@
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
;; Initialize frame with alpha
|
||||
(add-to-list 'default-frame-alist '(alpha-background . 85))
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
|
||||
(when (fboundp 'menu-bar-mode)
|
||||
(menu-bar-mode -1))
|
||||
|
||||
(when (fboundp 'tool-bar-mode)
|
||||
(tool-bar-mode -1))
|
||||
|
||||
(when (fboundp 'scroll-bar-mode)
|
||||
(scroll-bar-mode -1))
|
||||
@@ -0,0 +1,104 @@
|
||||
(defvar creature-gc-cons-threshold
|
||||
(if (display-graphic-p) (* 64 1024 1024) (* 16 1024 1024))
|
||||
"The default value to use for `gc-cons-threshold'.
|
||||
If freezing sometimes, decrease it. If stuttering, increase it.")
|
||||
|
||||
(defvar creature-gc-cons-upper-limit
|
||||
(if (display-graphic-p) (* 512 1024 1024) (* 128 1024 1024))
|
||||
"The temporary value for `gc-cons-threshold' to defer it.")
|
||||
|
||||
(defvar creature-gc-timer (run-with-idle-timer 10 t #'garbage-collect)
|
||||
"Run garbage collection when idle 10s.")
|
||||
|
||||
(defvar default-file-name-handler-alist file-name-handler-alist
|
||||
"Temporary `file-name-handler-alist' for restore after startup.")
|
||||
|
||||
;; Speed up startup
|
||||
(defun creature-enlarge-gc-cons-threshold ()
|
||||
"Enlarge garbage collection threshold."
|
||||
(setq gc-cons-percentage 0.6
|
||||
gc-cons-threshold creature-gc-cons-upper-limit))
|
||||
|
||||
(defun creature-normalize-gc-cons-threshold ()
|
||||
"Normalize garbage collection threshold."
|
||||
(setq gc-cons-percentage 0.1
|
||||
gc-cons-threshold creature-gc-cons-threshold))
|
||||
|
||||
(creature-enlarge-gc-cons-threshold)
|
||||
(setq file-name-handler-alist nil)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(creature-normalize-gc-cons-threshold)
|
||||
(setq file-name-handler-alist default-file-name-handler-alist)
|
||||
|
||||
(setq read-process-output-max (* 1024 1024))
|
||||
|
||||
;; GC automatically when unfocused
|
||||
(if (boundp 'after-focus-change-function)
|
||||
(add-function :after after-focus-change-function
|
||||
(lambda ()
|
||||
(unless (frame-focus-state) (garbage-collect))))
|
||||
(add-hook 'focus-out-hook #'garbage-collect))
|
||||
|
||||
;; Avoid GC while minibuffer active.
|
||||
(add-hook 'minibuffer-setup-hook
|
||||
#'creature-enlarge-gc-cons-threshold)
|
||||
(add-hook 'minibuffer-exit-hook
|
||||
#'creature-normalize-gc-cons-threshold)))
|
||||
|
||||
(defconst creature/config-dir
|
||||
(file-name-directory
|
||||
(or load-file-name buffer-file-name))
|
||||
"Root directory of Creature.")
|
||||
|
||||
(defconst creature/cache-dir
|
||||
(expand-file-name ".cache" creature/config-dir)
|
||||
"Cache directory of Creature.")
|
||||
|
||||
(defconst creature/pkg-dir
|
||||
(expand-file-name "site-lisp" creature/config-dir)
|
||||
"Package directory.")
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defun add-subdirs-to-load-path (search-dir)
|
||||
(interactive)
|
||||
(let* ((dir (file-name-as-directory search-dir)))
|
||||
(dolist (subdir
|
||||
;; 过滤出不必要的目录,提升Emacs启动速度
|
||||
(cl-remove-if
|
||||
#'(lambda (subdir)
|
||||
(or
|
||||
;; 不是目录的文件都移除
|
||||
(not (file-directory-p (concat dir subdir)))
|
||||
;; 父目录、 语言相关和版本控制目录都移除
|
||||
(member subdir '("." ".."
|
||||
"dist" "node_modules" "__pycache__"
|
||||
"RCS" "CVS" "rcs" "cvs" ".git" ".github"))))
|
||||
(directory-files dir)))
|
||||
(let ((subdir-path (concat dir (file-name-as-directory subdir))))
|
||||
;; 目录下有 .el .so .dll 文件的路径才添加到 `load-path' 中,提升Emacs启动速度
|
||||
(when (cl-some #'(lambda (subdir-file)
|
||||
(and (file-regular-p (concat subdir-path subdir-file))
|
||||
;; .so .dll 文件指非Elisp语言编写的Emacs动态库
|
||||
(member (file-name-extension subdir-file) '("el" "so" "dll"))))
|
||||
(directory-files subdir-path))
|
||||
|
||||
;; 注意:`add-to-list' 函数的第三个参数必须为 t ,表示加到列表末尾
|
||||
;; 这样Emacs会从父目录到子目录的顺序搜索Elisp插件,顺序反过来会导致Emacs无法正常启动
|
||||
(add-to-list 'load-path subdir-path t))
|
||||
|
||||
;; 继续递归搜索子目录
|
||||
(add-subdirs-to-load-path subdir-path)))))
|
||||
|
||||
(add-subdirs-to-load-path creature/pkg-dir)
|
||||
|
||||
(require 'lazy-load)
|
||||
(lazy-load-global-keys
|
||||
'(("C-x g" . magit-status))
|
||||
"magit")
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(message (emacs-init-time))))
|
||||
Submodule
+1
Submodule site-lisp/compat added at e827a9f3e2.
Submodule
+1
Submodule site-lisp/dash added at e926385625.
Submodule
+1
Submodule site-lisp/lazy-load added at cd9819069c.
Submodule
+1
Submodule site-lisp/magit added at 3e833f3699.
Submodule
+1
Submodule site-lisp/transient added at 097f5be6e0.
Submodule
+1
Submodule site-lisp/with-editor added at 1d5860cfd0.
Reference in new issue
Block a user