add package to load-path only when needed
This commit is contained in:
22 files changed
+167
-38
No files matched your search
@@ -1,5 +1,8 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "emacs-websocket")
|
||||||
|
|
||||||
(require 'websocket)
|
(require 'websocket)
|
||||||
|
|
||||||
(setq-local websocket-eldoc-callback nil)
|
(setq-local websocket-eldoc-callback nil)
|
||||||
|
|||||||
@@ -58,45 +58,7 @@ If freezing sometimes, decrease it. If stuttering, increase it.")
|
|||||||
(expand-file-name ".cache" creature/config-dir)
|
(expand-file-name ".cache" creature/config-dir)
|
||||||
"Cache directory of Creature.")
|
"Cache directory of Creature.")
|
||||||
|
|
||||||
(defconst creature/pkg-dir
|
|
||||||
(expand-file-name "site-lisp" creature/config-dir)
|
|
||||||
"Package directory.")
|
|
||||||
|
|
||||||
(require 'cl-lib)
|
|
||||||
(require 'subr-x)
|
|
||||||
|
|
||||||
(defun add-dir-and-subdirs-to-load-path (dir)
|
|
||||||
"Add directory and its subdirectoris to `load-path'.
|
|
||||||
Detect whether there are any loadable module in DIR, if so, add DIR to `load-path'.
|
|
||||||
Do this recursively for subdirectories of DIR."
|
|
||||||
(unless (file-directory-p dir)
|
|
||||||
(error "%s is not a directory" dir))
|
|
||||||
|
|
||||||
(let ((subdirs nil)
|
|
||||||
(files nil)
|
|
||||||
(temp-filepath nil)
|
|
||||||
;; (loadable-suffixes (get-load-suffixes))
|
|
||||||
(load-extension (mapcar (lambda (str) (string-remove-prefix "." str)) load-suffixes))
|
|
||||||
(exclude-dirs '("." ".."
|
|
||||||
"dist" "node_modules" "__pycache__"
|
|
||||||
"RCS" "CVS" "rcs" "cvs" ".git" ".github")))
|
|
||||||
|
|
||||||
(dolist (filename (directory-files dir))
|
|
||||||
(setq temp-filepath (file-name-concat dir filename))
|
|
||||||
(if (file-directory-p temp-filepath)
|
|
||||||
(unless (member filename exclude-dirs)
|
|
||||||
(add-to-list 'subdirs temp-filepath t))
|
|
||||||
(when (file-regular-p temp-filepath)
|
|
||||||
(add-to-list 'files temp-filepath t))))
|
|
||||||
|
|
||||||
(when (cl-some (lambda (file)
|
|
||||||
(member (file-name-extension file) load-extension))
|
|
||||||
files)
|
|
||||||
(add-to-list 'load-path dir t))
|
|
||||||
(mapc #'add-dir-and-subdirs-to-load-path subdirs)))
|
|
||||||
|
|
||||||
(add-to-list 'load-path (expand-file-name "lisp" creature/config-dir) t)
|
(add-to-list 'load-path (expand-file-name "lisp" creature/config-dir) t)
|
||||||
(add-dir-and-subdirs-to-load-path creature/pkg-dir)
|
|
||||||
|
|
||||||
|
|
||||||
(require 'init-built-in)
|
(require 'init-built-in)
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "ace-window")
|
||||||
|
(add-pkg-in-pkg-dir "posframe")
|
||||||
|
(add-pkg-in-pkg-dir "avy")
|
||||||
|
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "awesome-pair")
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(unless (locate-library "editorconfig")
|
||||||
|
(add-pkg-in-pkg-dir "editorconfig-emacs"))
|
||||||
|
|
||||||
(autoload 'editorconfig-mode "editorconfig" "" t)
|
(autoload 'editorconfig-mode "editorconfig" "" t)
|
||||||
|
|
||||||
(defun creature/editorconfig-setup ()
|
(defun creature/editorconfig-setup ()
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "emmet-mode")
|
||||||
|
|
||||||
(autoload 'emmet-mode "emmet-mode" "" t)
|
(autoload 'emmet-mode "emmet-mode" "" t)
|
||||||
|
|
||||||
(with-eval-after-load 'emmet-mode
|
(with-eval-after-load 'emmet-mode
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "vimrc-mode")
|
||||||
|
(add-pkg-in-pkg-dir "yaml-mode")
|
||||||
|
(add-pkg-in-pkg-dir "lua-mode")
|
||||||
|
(add-pkg-in-pkg-dir "nginx-mode")
|
||||||
|
(add-pkg-in-pkg-dir "pdf-tools")
|
||||||
|
(add-pkg-in-pkg-dir "tablist")
|
||||||
|
(add-pkg-in-pkg-dir "saveplace-pdf-view")
|
||||||
|
(add-pkg-in-pkg-dir "graphviz-dot-mode")
|
||||||
(autoload 'vimrc-mode "vimrc-mode" "" t)
|
(autoload 'vimrc-mode "vimrc-mode" "" t)
|
||||||
(add-to-list 'auto-mode-alist '("\\.vim\\(rc\\)?\\'" . vimrc-mode))
|
(add-to-list 'auto-mode-alist '("\\.vim\\(rc\\)?\\'" . vimrc-mode))
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "eslint-disable-rule")
|
||||||
|
(add-pkg-in-pkg-dir "emacs-flymake-eslint")
|
||||||
|
|
||||||
(defun creature/flymake-show-diagnostics-buffer-and-jump ()
|
(defun creature/flymake-show-diagnostics-buffer-and-jump ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(flymake-show-diagnostics-buffer)
|
(flymake-show-diagnostics-buffer)
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "magit")
|
||||||
|
(add-pkg-in-pkg-dir "dash")
|
||||||
|
(add-pkg-in-pkg-dir "git-modes")
|
||||||
|
(add-pkg-in-pkg-dir "with-editor")
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
|
|
||||||
(lazy-load-global-keys
|
(lazy-load-global-keys
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "expand-region")
|
||||||
|
(add-pkg-in-pkg-dir "rg")
|
||||||
|
(add-pkg-in-pkg-dir "Emacs-wgrep")
|
||||||
|
(add-pkg-in-pkg-dir "avy")
|
||||||
|
(add-pkg-in-pkg-dir "mwim")
|
||||||
|
(add-pkg-in-pkg-dir "symbol-overlay")
|
||||||
|
|
||||||
|
|
||||||
(defconst creature/prefix-key "M-m"
|
(defconst creature/prefix-key "M-m"
|
||||||
"Prefix key for custom keybindings.")
|
"Prefix key for custom keybindings.")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "markdown-mode")
|
||||||
|
|
||||||
(autoload 'markdown-mode "markdown-mode"
|
(autoload 'markdown-mode "markdown-mode"
|
||||||
"Major mode for editing Markdown files" t)
|
"Major mode for editing Markdown files" t)
|
||||||
(add-to-list 'auto-mode-alist
|
(add-to-list 'auto-mode-alist
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "emms")
|
||||||
|
|
||||||
(autoload 'emms-all "emms-setup" "" t)
|
(autoload 'emms-all "emms-setup" "" t)
|
||||||
(autoload 'emms-default-players "" t)
|
(autoload 'emms-default-players "" t)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "org-pomodoro")
|
||||||
|
(add-pkg-in-pkg-dir "alert")
|
||||||
|
(add-pkg-in-pkg-dir "gntp")
|
||||||
|
(add-pkg-in-pkg-dir "ox-hugo")
|
||||||
|
(add-pkg-in-pkg-dir "tomelr")
|
||||||
|
|
||||||
|
|
||||||
;; customize mode for src lang
|
;; customize mode for src lang
|
||||||
(defconst creature/org-src-lang-modes
|
(defconst creature/org-src-lang-modes
|
||||||
(if (bound-and-true-p creature/treesit-available)
|
(if (bound-and-true-p creature/treesit-available)
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defconst creature/pkg-dir
|
||||||
|
(expand-file-name
|
||||||
|
"../site-lisp"
|
||||||
|
(file-name-directory(or load-file-name buffer-file-name)))
|
||||||
|
"Package directory.")
|
||||||
|
|
||||||
|
(require 'cl-lib)
|
||||||
|
(require 'subr-x)
|
||||||
|
|
||||||
|
(defun add-dir-and-subdirs-to-load-path (dir)
|
||||||
|
"Add directory and its subdirectoris to `load-path'.
|
||||||
|
Detect whether there are any loadable module in DIR, if so, add DIR to `load-path'.
|
||||||
|
Do this recursively for subdirectories of DIR."
|
||||||
|
(unless (file-directory-p dir)
|
||||||
|
(error "%s is not a directory" dir))
|
||||||
|
|
||||||
|
(let ((subdirs nil)
|
||||||
|
(files nil)
|
||||||
|
(temp-filepath nil)
|
||||||
|
;; (loadable-suffixes (get-load-suffixes))
|
||||||
|
(load-extension (mapcar (lambda (str) (string-remove-prefix "." str)) load-suffixes))
|
||||||
|
(exclude-dirs '("." ".."
|
||||||
|
"dist" "node_modules" "__pycache__" "test"
|
||||||
|
"RCS" "CVS" "rcs" "cvs" ".git" ".github")))
|
||||||
|
|
||||||
|
(dolist (filename (directory-files dir))
|
||||||
|
(setq temp-filepath (file-name-concat dir filename))
|
||||||
|
(if (file-directory-p temp-filepath)
|
||||||
|
(unless (member filename exclude-dirs)
|
||||||
|
(add-to-list 'subdirs temp-filepath t))
|
||||||
|
(when (file-regular-p temp-filepath)
|
||||||
|
(add-to-list 'files temp-filepath t))))
|
||||||
|
|
||||||
|
(when (cl-some (lambda (file)
|
||||||
|
(member (file-name-extension file) load-extension))
|
||||||
|
files)
|
||||||
|
(add-to-list 'load-path dir t))
|
||||||
|
(mapc #'add-dir-and-subdirs-to-load-path subdirs)))
|
||||||
|
|
||||||
|
(defun add-pkg-in-pkg-dir (pkg)
|
||||||
|
"Add PKG located in `creature/pkg-dir' to `load-path'."
|
||||||
|
(add-dir-and-subdirs-to-load-path (expand-file-name pkg creature/pkg-dir)))
|
||||||
|
|
||||||
|
(add-to-list 'load-path creature/pkg-dir t)
|
||||||
|
|
||||||
|
;; add basic packages
|
||||||
|
(add-pkg-in-pkg-dir "lazy-load")
|
||||||
|
|
||||||
|
;; builtin maybe exist
|
||||||
|
;; "compat" "transient"
|
||||||
|
(dolist (pkg '("compat" "transient"))
|
||||||
|
(unless (locate-library pkg)
|
||||||
|
(add-pkg-in-pkg-dir)))
|
||||||
|
|
||||||
|
(provide 'init-package)
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "plantuml-mode")
|
||||||
|
(add-pkg-in-pkg-dir "dash")
|
||||||
|
|
||||||
(autoload 'plantuml-mode "plantuml-mode" "" t)
|
(autoload 'plantuml-mode "plantuml-mode" "" t)
|
||||||
(add-to-list 'auto-mode-alist '("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode))
|
(add-to-list 'auto-mode-alist '("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode))
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "prettier")
|
||||||
|
(add-pkg-in-pkg-dir "iter2")
|
||||||
|
(add-pkg-in-pkg-dir "nvm")
|
||||||
|
(add-pkg-in-pkg-dir "s")
|
||||||
|
(add-pkg-in-pkg-dir "dash")
|
||||||
|
(add-pkg-in-pkg-dir "f")
|
||||||
|
(require 'init-editorconfig)
|
||||||
|
|
||||||
(autoload 'prettier-mode "prettier" "" t)
|
(autoload 'prettier-mode "prettier" "" t)
|
||||||
|
|
||||||
(defvar-local creature/formatter nil
|
(defvar-local creature/formatter nil
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "emacs-rime")
|
||||||
|
(add-pkg-in-pkg-dir "dash")
|
||||||
|
(add-pkg-in-pkg-dir "posframe")
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
(require 'rime)
|
(require 'rime)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "sdcv")
|
||||||
|
(add-pkg-in-pkg-dir "posframe")
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "rainbow-delimiters")
|
||||||
|
(add-pkg-in-pkg-dir "rainbow-identifiers")
|
||||||
|
|
||||||
;; Pulse
|
;; Pulse
|
||||||
(defvar creature/pulse-enable t
|
(defvar creature/pulse-enable t
|
||||||
"Whether enable pulse for scroll and switch window.")
|
"Whether enable pulse for scroll and switch window.")
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "marginalia")
|
||||||
|
(add-pkg-in-pkg-dir "vertico")
|
||||||
|
(add-pkg-in-pkg-dir "corfu")
|
||||||
|
(add-pkg-in-pkg-dir "orderless")
|
||||||
|
(add-pkg-in-pkg-dir "corfu-doc")
|
||||||
|
(add-pkg-in-pkg-dir "cape")
|
||||||
|
(add-pkg-in-pkg-dir "consult")
|
||||||
|
(add-pkg-in-pkg-dir "emacs-corfu-terminal")
|
||||||
|
(add-pkg-in-pkg-dir "emacs-popon")
|
||||||
|
(add-pkg-in-pkg-dir "emacs-corfu-doc-terminal")
|
||||||
|
(add-pkg-in-pkg-dir "embark")
|
||||||
|
|
||||||
|
|
||||||
(require 'marginalia)
|
(require 'marginalia)
|
||||||
(marginalia-mode 1)
|
(marginalia-mode 1)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(unless (locate-library "which-key")
|
||||||
|
(add-pkg-in-pkg-dir "emacs-which-key"))
|
||||||
|
|
||||||
(require 'init-keybindings)
|
(require 'init-keybindings)
|
||||||
|
|
||||||
(require 'which-key)
|
(require 'which-key)
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(require 'init-package)
|
||||||
|
(add-pkg-in-pkg-dir "yasnippet")
|
||||||
|
(add-pkg-in-pkg-dir "yasnippet-snippets")
|
||||||
|
(add-pkg-in-pkg-dir "auto-yasnippet")
|
||||||
|
|
||||||
(require 'lazy-load)
|
(require 'lazy-load)
|
||||||
(require 'yasnippet)
|
(require 'yasnippet)
|
||||||
(require 'yasnippet-snippets)
|
(require 'yasnippet-snippets)
|
||||||
|
|||||||
Reference in new issue
Block a user