Compare commits

...
1 Commits
Author SHA1 Message Date
zedhugh b5d9ce18a7 use "creature/pkg-active" manage packages manually
- replace "add-pkg-in-pkg-dir" (recursive load-path scanning) with a
  central "creature/pkgs" registry that handles load path, autoloads,
  info dirs and dependencies
- adapt all init-*.el files to the new activation function
- add a top-level Makefile to byte-compile site-lisp packages
- remove unused "emacs-kv" and "emacs-db" submodules
2026-09-14 15:02:43 +08:00
27 changed files with 422 additions and 149 deletions

No files matched your search

-6
View File
@@ -193,12 +193,6 @@
[submodule "site-lisp/esxml"]
path = site-lisp/esxml
url = https://github.com/tali713/esxml.git
[submodule "site-lisp/emacs-kv"]
path = site-lisp/emacs-kv
url = https://github.com/nicferrier/emacs-kv.git
[submodule "site-lisp/emacs-db"]
path = site-lisp/emacs-db
url = https://github.com/nicferrier/emacs-db.git
[submodule "site-lisp/edit-indirect"]
path = site-lisp/edit-indirect
url = https://github.com/Fanael/edit-indirect.git
+239
View File
@@ -0,0 +1,239 @@
EMACS ?= emacs
ROOT := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
SITE_LISP := $(ROOT)/site-lisp
INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info)
INFO_DIR ?= $(ROOT)/.cache
.PHONY: transient emms
all: magit git-modes emmet-mode expand-region rg wgrep avy mwim symbol-overlay markdown-mode emms dash yasnippet yaml file gptel nov org plantuml-mode posframe prettier rime f s sdcv vertico
clean: compat-clean cond-let-clean llama-clean transient-clean with-editor-clean magit-clean git-modes-clean emmet-mode-clean expand-region-clean rg-clean wgrep-clean avy-clean mwim-clean symbol-overlay-clean markdown-mode-clean emms-clean dash-clean yasnippet-clean yaml-clean file-clean gptel-clean nov-clean org-clean plantuml-mode-clean posframe-clean prettier-clean rime-clean f-clean s-clean sdcv-clean vertico-clean
compat:
$(MAKE) -C $(SITE_LISP)/compat compile compat.info
$(INSTALL_INFO) --info-dir=$(INFO_DIR) $(SITE_LISP)/compat/compat.info
compat-clean:
$(INSTALL_INFO) --delete --quiet --info-dir=$(INFO_DIR) $(SITE_LISP)/compat/compat.info
$(MAKE) -C $(SITE_LISP)/compat clean
cond-let:
$(MAKE) -C $(SITE_LISP)/cond-let lisp
cond-let-clean:
$(MAKE) -C $(SITE_LISP)/cond-let clean
llama: compat
$(MAKE) -C $(SITE_LISP)/llama lisp
llama-clean:
$(MAKE) -C $(SITE_LISP)/llama clean
transient: compat cond-let
$(MAKE) -C $(SITE_LISP)/transient lisp info
transient-clean:
$(MAKE) -C $(SITE_LISP)/transient clean
with-editor: compat cond-let
$(MAKE) -C $(SITE_LISP)/with-editor lisp info
with-editor-clean:
$(MAKE) -C $(SITE_LISP)/with-editor clean
magit: compat cond-let llama transient with-editor
$(MAKE) -C $(SITE_LISP)/magit/lisp lisp
$(MAKE) -C $(SITE_LISP)/magit info
magit-clean:
$(MAKE) -C $(SITE_LISP)/magit clean
git-modes: compat
$(MAKE) -C $(SITE_LISP)/git-modes lisp
git-modes-clean:
$(MAKE) -C $(SITE_LISP)/git-modes clean
emmet-mode:
$(MAKE) -C $(SITE_LISP)/emmet-mode emmet-mode.elc
emmet-mode-clean:
$(RM) $(SITE_LISP)/emmet-mode/emmet-mode.elc
expand-region:
$(EMACS) -Q --batch -L $(SITE_LISP)/expand-region -f batch-byte-compile $(SITE_LISP)/expand-region/*.el
expand-region-clean:
$(RM) $(SITE_LISP)/expand-region/*.elc
rg: transient wgrep
$(EMACS) -Q --batch -L $(SITE_LISP)/rg -L $(SITE_LISP)/transient -L $(SITE_LISP)/Emacs-wgrep -f batch-byte-compile $(SITE_LISP)/rg/*.el
$(INSTALL_INFO) --info-dir=$(INFO_DIR) $(SITE_LISP)/rg/rgel.info
rg-clean:
$(RM) $(SITE_LISP)/rg/*.elc
$(INSTALL_INFO) --delete --quiet --info-dir=$(INFO_DIR) $(SITE_LISP)/rg/rgel.info
wgrep:
$(MAKE) -C $(SITE_LISP)/Emacs-wgrep compile
wgrep-clean:
$(MAKE) -C $(SITE_LISP)/Emacs-wgrep clean
avy:
$(MAKE) -C $(SITE_LISP)/avy compile
avy-clean:
$(MAKE) -C $(SITE_LISP)/avy clean
mwim:
$(MAKE) -C $(SITE_LISP)/mwim
mwim-clean:
$(MAKE) -C $(SITE_LISP)/mwim clean
symbol-overlay:
$(MAKE) -C $(SITE_LISP)/symbol-overlay compile
symbol-overlay-clean:
rm -f $(SITE_LISP)/symbol-overlay/*.elc
markdown-mode:
$(MAKE) -C $(SITE_LISP)/markdown-mode
markdown-mode-clean:
$(MAKE) -C $(SITE_LISP)/markdown-mode clean
emms:
$(MAKE) -C $(SITE_LISP)/emms
$(INSTALL_INFO) --info-dir=$(INFO_DIR) $(SITE_LISP)/emms/doc/emms.info
emms-clean:
$(INSTALL_INFO) --delete --info-dir=$(INFO_DIR) $(SITE_LISP)/emms/doc/emms.info
$(MAKE) -C $(SITE_LISP)/emms clean
dash:
$(MAKE) -C $(SITE_LISP)/dash lisp
dash-clean:
$(MAKE) -C $(SITE_LISP)/dash clean
yasnippet:
$(MAKE) -C $(SITE_LISP)/yasnippet compile
$(EMACS) -Q --batch -L $(SITE_LISP)/yasnippet -f batch-byte-compile $(SITE_LISP)/yasnippet-snippets/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/yasnippet -f batch-byte-compile $(SITE_LISP)/auto-yasnippet/auto-yasnippet.el
yasnippet-clean:
$(MAKE) -C $(SITE_LISP)/yasnippet clean
$(RM) $(SITE_LISP)/yasnippet-snippets/*.elc
$(RM) $(SITE_LISP)/auto-yasnippet/*.elc
yaml:
$(MAKE) -C $(SITE_LISP)/yaml-mode
yaml-clean:
$(MAKE) -C $(SITE_LISP)/yaml-mode clean
lua:
$(MAKE) -C $(SITE_LISP)/lua-mode lua-mode.elc
lua-clean:
$(RM) $(SITE_LISP)/lua-mode/lua-mode.elc
file:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/vimrc-mode/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/nginx-mode/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/tablist -f batch-byte-compile $(SITE_LISP)/tablist/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/pdf-tools/lisp -L $(SITE_LISP)/tablist -f batch-byte-compile $(SITE_LISP)/pdf-tools/lisp/*.el
$(MAKE) -C $(SITE_LISP)/pdf-tools loaddefs autobuild
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/saveplace-pdf-view/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/graphviz-dot-mode/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/meson-mode/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/crontab-mode/*.el
file-clean:
$(RM) $(SITE_LISP)/vimrc-mode/*.elc
$(RM) $(SITE_LISP)/nginx-mode/*.elc
$(RM) $(SITE_LISP)/tablist/*.elc
$(MAKE) -C $(SITE_LISP)/pdf-tools clean
$(RM) $(SITE_LISP)/pdf-tools/lisp/pdf-tools-autoloads.el
$(RM) $(SITE_LISP)/pdf-tools/lisp/*.elc
$(RM) $(SITE_LISP)/saveplace-pdf-view/*.elc
$(RM) $(SITE_LISP)/graphviz-dot-mode/*.elc
$(RM) $(SITE_LISP)/meson-mode/*.elc
$(RM) $(SITE_LISP)/crontab-mode/*.elc
gptel: transient compat
$(EMACS) -Q --batch -L $(SITE_LISP)/transient -L $(SITE_LISP)/compat -L $(SITE_LISP)/gptel -f batch-byte-compile $(SITE_LISP)/gptel/*.el
gptel-clean:
$(RM) $(SITE_LISP)/gptel/*.elc
nov:
$(EMACS) -Q --batch -L $(SITE_LISP)/esxml -f batch-byte-compile $(SITE_LISP)/esxml/esxml.el $(SITE_LISP)/esxml/esxml-query.el
$(EMACS) -Q --batch -L $(SITE_LISP)/esxml -f batch-byte-compile $(SITE_LISP)/nov/*.el
nov-clean:
$(RM) $(SITE_LISP)/esxml/*.elc
$(RM) $(SITE_LISP)/nov/*.elc
org:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/gntp/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/alert -L $(SITE_LISP)/gntp -f batch-byte-compile $(SITE_LISP)/alert/alert.el
$(EMACS) -Q --batch -L $(SITE_LISP)/alert -L $(SITE_LISP)/org-pomodoro -f batch-byte-compile $(SITE_LISP)/org-pomodoro/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/tomelr/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/tomelr -L $(SITE_LISP)/ox-hugo -f batch-byte-compile $(SITE_LISP)/ox-hugo/*.el
org-clean:
$(RM) $(SITE_LISP)/gntp/*.elc
$(RM) $(SITE_LISP)/alert/*.elc
$(RM) $(SITE_LISP)/org-pomodoro/*.elc
$(RM) $(SITE_LISP)/tomelr/*.elc
$(RM) $(SITE_LISP)/ox-hugo/*.elc
plantuml-mode:
$(EMACS) -Q --batch -L $(SITE_LISP)/dash -f batch-byte-compile $(SITE_LISP)/deflate/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/dash -L $(SITE_LISP)/deflate -f batch-byte-compile $(SITE_LISP)/plantuml-mode/*.el
plantuml-mode-clean:
$(RM) $(SITE_LISP)/deflate/*.elc
$(RM) $(SITE_LISP)/plantuml-mode/*.elc
posframe:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/posframe/posframe.el
posframe-clean:
$(RM) $(SITE_LISP)/posframe/*.elc
prettier:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/iter2/iter2.el
$(EMACS) -Q --batch -L $(SITE_LISP)/s -L $(SITE_LISP)/dash -L $(SITE_LISP)/f -f batch-byte-compile $(SITE_LISP)/nvm/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/iter2 -L $(SITE_LISP)/nvm -L $(SITE_LISP)/s -L $(SITE_LISP)/dash -L $(SITE_LISP)/f -f batch-byte-compile $(SITE_LISP)/prettier/*.el
prettier-clean:
$(RM) $(SITE_LISP)/iter2/*.elc
$(RM) $(SITE_LISP)/nvm/*.elc
$(RM) $(SITE_LISP)/prettier/*.elc
.PHONY: rime
rime:
$(MAKE) -C $(SITE_LISP)/emacs-rime lib
$(EMACS) -Q --batch -L $(SITE_LISP)/emacs-rime -L $(SITE_LISP)/dash -L $(SITE_LISP)/posframe -f batch-byte-compile $(SITE_LISP)/emacs-rime/rime*.el
rime-clean:
$(MAKE) -C $(SITE_LISP)/emacs-rime clean
$(RM) $(SITE_LISP)/emacs-rime/*.elc
f:
$(EMACS) -Q --batch -L $(SITE_LISP)/s -L $(SITE_LISP)/dash -f batch-byte-compile $(SITE_LISP)/f/*.el
f-clean:
$(RM) $(SITE_LISP)/f/*.elc
s:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/s/*.el
s-clean:
$(RM) $(SITE_LISP)/s/*.elc
sdcv:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/sdcv/*.el
sdcv-clean:
$(RM) $(SITE_LISP)/sdcv/*.elc
vertico:
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/marginalia/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/vertico/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/vertico -L $(SITE_LISP)/vertico/extensions -f batch-byte-compile $(SITE_LISP)/vertico/extensions/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/corfu/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/corfu -L $(SITE_LISP)/corfu/extensions -f batch-byte-compile $(SITE_LISP)/corfu/extensions/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/orderless -f batch-byte-compile $(SITE_LISP)/orderless/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/cape -f batch-byte-compile $(SITE_LISP)/cape/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/consult -f batch-byte-compile $(SITE_LISP)/consult/*.el
$(EMACS) -Q --batch -f batch-byte-compile $(SITE_LISP)/emacs-popon/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/corfu -L $(SITE_LISP)/emacs-popon/ -f batch-byte-compile $(SITE_LISP)/emacs-corfu-terminal/*.el
$(EMACS) -Q --batch -L $(SITE_LISP)/embark -L $(SITE_LISP)/consult -L $(SITE_LISP)/avy -f batch-byte-compile $(SITE_LISP)/embark/*.el
vertico-clean:
$(RM) $(SITE_LISP)/marginalia/*.elc
$(RM) $(SITE_LISP)/vertico/*.elc
$(RM) $(SITE_LISP)/vertico/extensions/*.elc
$(RM) $(SITE_LISP)/corfu/*.elc
$(RM) $(SITE_LISP)/corfu/extensions/*.elc
$(RM) $(SITE_LISP)/orderless/*.elc
$(RM) $(SITE_LISP)/cape/*.elc
$(RM) $(SITE_LISP)/consult/*.elc
$(RM) $(SITE_LISP)/emacs-popon/*.elc
$(RM) $(SITE_LISP)/emacs-corfu-terminal/*.elc
$(RM) $(SITE_LISP)/embark/*.elc
+1 -1
View File
@@ -1,7 +1,7 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "emacs-websocket")
(add-to-list 'load-path (file-name-concat creature/pkg-dir "emacs-websocket"))
(require 'websocket)
+1 -2
View File
@@ -1,9 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "awesome-pair")
(require 'lazy-load)
(creature/pkg-active 'awesome-pair)
(with-eval-after-load 'awesome-pair
+7 -7
View File
@@ -1,10 +1,14 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(unless (locate-library "editorconfig")
(add-pkg-in-pkg-dir "editorconfig-emacs"))
(require 'init-package)
(autoload 'editorconfig-mode "editorconfig" "" t)
(creature/pkg-active 'editorconfig)
(autoload 'editorconfig-mode "editorconfig" "" t)
(autoload 'editorconfig-conf-mode "editorconfig-conf-mode" "" t)
(add-to-list 'auto-mode-alist
'("\\.editorconfig\\'" . editorconfig-conf-mode)))
(defun creature/editorconfig-setup ()
(editorconfig-mode 1)
@@ -26,10 +30,6 @@
(add-hook 'find-file-hook #'creature/editorconfig-setup)
(autoload 'editorconfig-conf-mode "editorconfig-conf-mode" "" t)
(add-to-list 'auto-mode-alist
'("\\.editorconfig\\'" . editorconfig-conf-mode))
(with-eval-after-load 'editorconfig
(add-to-list 'editorconfig-indentation-alist '(js-ts-mode js-indent-level))
(add-to-list 'editorconfig-indentation-alist '(plantuml-mode plantuml-indent-level))
+3 -1
View File
@@ -1,6 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'lazy-load)
(require 'init-package)
(creature/pkg-active 'lazy-load)
(defun creature/eglot-load-markdown-for-doc ()
(when (and (fboundp 'eglot-managed-p)
+2 -1
View File
@@ -1,7 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "emmet-mode")
(creature/pkg-active 'emmet-mode)
(autoload 'emmet-mode "emmet-mode" "" t)
+10 -10
View File
@@ -1,16 +1,16 @@
;; -*- 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")
(add-pkg-in-pkg-dir "meson-mode")
(add-pkg-in-pkg-dir "crontab-mode")
(creature/pkg-active 'vimrc-mode)
(creature/pkg-active 'yaml-mode)
(creature/pkg-active 'lua-mode)
(creature/pkg-active 'nginx-mode)
(creature/pkg-active 'pdf-tools)
(creature/pkg-active 'saveplace-pdf-view)
(creature/pkg-active 'graphviz-dot-mode)
(creature/pkg-active 'meson-mode)
(creature/pkg-active 'crontab-mode)
(autoload 'vimrc-mode "vimrc-mode" "" t)
+3 -2
View File
@@ -1,8 +1,9 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "eslint-disable-rule")
(add-pkg-in-pkg-dir "eslint")
(creature/pkg-active 'eslint-disable-rule)
(creature/pkg-active 'eslint)
(defun creature/flymake-show-diagnostics-buffer-and-jump ()
(interactive)
+6 -14
View File
@@ -1,15 +1,11 @@
;; -*- 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")
(add-pkg-in-pkg-dir "llama")
(add-pkg-in-pkg-dir "cond-let")
(add-pkg-in-pkg-dir "pinentry")
(require 'lazy-load)
(creature/pkg-active 'magit)
(creature/pkg-active 'git-modes)
(creature/pkg-active 'pinentry)
(creature/pkg-active 'lazy-load)
(lazy-load-global-keys
'(("C-x g" . magit-status))
@@ -42,11 +38,7 @@
;; (require 'forge)
;; pinentry for prompting password of gpg when sign git commit
(condition-case nil
(progn
(require 'pinentry)
(pinentry-start))
(error nil))
(condition-case nil (pinentry-start) (error nil))
(setq magit-revision-show-gravatars t))
@@ -55,7 +47,7 @@
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(with-eval-after-load 'project
(require 'magit))
(require 'magit-extras))
(provide 'init-git)
+3 -1
View File
@@ -1,6 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(add-pkg-in-pkg-dir "gptel")
(require 'init-package)
(creature/pkg-active 'gptel)
(let ((gptel-autoload-file
(file-name-concat creature/cache-dir "gptel-autoloads.el")))
+7 -8
View File
@@ -1,12 +1,13 @@
;; -*- 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")
(creature/pkg-active 'expand-region)
(creature/pkg-active 'rg)
(creature/pkg-active 'avy)
(creature/pkg-active 'mwim)
(creature/pkg-active 'symbol-overlay)
(creature/pkg-active 'lazy-load)
(defconst creature/prefix-key "M-m"
@@ -19,8 +20,6 @@
(global-set-key (kbd "C-c '") (kbd "`"))
(require 'lazy-load)
;;; expand-region
(lazy-load-local-keys
'(("v" . er/expand-region))
+2 -2
View File
@@ -1,8 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "markdown-mode")
(add-pkg-in-pkg-dir "edit-indirect")
(creature/pkg-active 'markdown-mode)
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
+1 -3
View File
@@ -1,10 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "emms")
(autoload 'emms-all "emms-setup" "" t)
(autoload 'emms-default-players "" t)
(creature/pkg-active 'emms)
(with-eval-after-load 'emms-lyrics
(setq emms-lyrics-dir "/home/zedhugh/.lyrics"))
+3 -4
View File
@@ -2,10 +2,9 @@
;; `nov' package need enable libxml2 for Emacs
(add-pkg-in-pkg-dir "nov")
(add-pkg-in-pkg-dir "esxml")
(add-pkg-in-pkg-dir "emacs-kv")
(add-pkg-in-pkg-dir "emacs-db")
(require 'init-package)
(creature/pkg-active 'nov)
(autoload 'nov-mode "nov" "" t)
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
+2 -5
View File
@@ -1,12 +1,9 @@
;; -*- 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")
(creature/pkg-active 'org-pomodoro)
(creature/pkg-active 'ox-hugo)
;; customize mode for src lang
(defconst creature/org-src-lang-modes
+104 -48
View File
@@ -1,67 +1,123 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'cl-lib)
(require 'subr-x)
(require 'info)
(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)
(defconst creature/pkgs
'((magit . ( :load "magit/lisp" :autoload "magit-autoloads" :info "magit/docs"
:deps (compat cond-let llama transient with-editor)))
(compat . (:load "compat" :info "compat"))
(cond-let . (:load "cond-let" :autoload "cond-let-autoloads"))
(llama . ( :load "llama" :autoload "llama-autoloads"
:deps (compat)))
(transient . ( :load "transient/lisp" :autoload "transient-autoloads"
:info "transient/docs" :deps (compat cond-let)))
(with-editor . ( :load "with-editor/lisp" :autoload "with-editor-autoloads"
:info "with-editor/docs" :deps (compat cond-let)))
(git-modes . ( :load "git-modes" :autoload "git-modes-autoloads"
:deps (compat)))
(pinentry . (:load "pinentry" :autoload "pinentry"))
(lazy-load . (:load "lazy-load" :autoload "lazy-load"))
(awesome-pair . (:load "awesome-pair"))
(editorconfig . (:load "editorconfig-emacs"))
(emmet-mode . (:load "emmet-mode"))
(eslint-disable-rule . (:load "eslint-disable-rule"))
(eslint . (:load "eslint/lisp"))
(gptel . (:load "gptel" :deps (compat transient)))
(expand-region . (:load "expand-region"))
(rg . (:load "rg" :info "rg" :deps (transient wgrep)))
(wgrep . (:load "Emacs-wgrep"))
(avy . (:load "avy"))
(mwim . (:load "mwim"))
(symbol-overlay . (:load "symbol-overlay"))
(markdown-mode . (:load "markdown-mode" :deps (edit-indirect)))
(edit-indirect . (:load "edit-indirect"))
(emms . (:load "emms" :autoload "emms-auto" :info "emms/doc"))
(nov . (:load "nov" :deps (esxml)))
(esxml . (:load "esxml"))
(org-pomodoro . (:load "org-pomodoro" :deps (alert)))
(alert . (:load "alert" :deps (gntp)))
(gntp . (:load "gntp"))
(ox-hugo . (:load "ox-hugo" :autoload "ox-hugo-autoloads" :deps (tomelr)))
(tomelr . (:load "tomelr"))
(plantuml-mode . (:load "plantuml-mode" :deps (dash deflate)))
(dash . (:load "dash"))
(deflate . (:load "deflate" :deps (dash)))
(prettier . (:load "prettier" :info "prettier" :deps (iter2 nvm)))
(iter2 . (:load "iter2"))
(nvm . (:load "nvm" :deps (s dash f)))
(s . (:load "s"))
(f . (:load "f" :deps (s dash)))
(prisma-ts-mode . (:load "prisma-ts-mode"))
(rime . (:load "emacs-rime" :deps (dash posframe)))
(posframe . (:load "posframe"))
(sdcv . (:load "sdcv" :deps (posframe)))
(which-key . (:load "emacs-which-key"))
(yasnippet . (:load "yasnippet"))
(yasnippet-snippets . (:load "yasnippet-snippets" :deps (yasnippet)))
(auto-yasnippet . (:load "auto-yasnippet" :deps (yasnippet)))
(vimrc-mode . (:load "vimrc-mode"))
(yaml-mode . (:load "yaml-mode"))
(lua-mode . (:load "lua-mode"))
(nginx-mode . (:load "nginx-mode"))
(pdf-tools . ( :load "pdf-tools/lisp" :autoload "pdf-tools-autoloads"
:deps (tablist)))
(tablist . (:load "tablist"))
(saveplace-pdf-view . (:load "saveplace-pdf-view"))
(graphviz-dot-mode . (:load "graphviz-dot-mode"))
(meson-mode . (:load "meson-mode"))
(crontab-mode . (:load "crontab-mode"))
(marginalia . (:load "marginalia" :deps (compat)))
(vertico . (:load ("vertico" "vertico/extensions") :deps (compat)))
(corfu . (:load ("corfu" "corfu/extensions") :deps (compat)))
(orderless . (:load "orderless" :deps (compat)))
(cape . (:load "cape" :deps (compat)))
(consult . (:load "consult" :deps (compat)))
(corfu-terminal . (:load "emacs-corfu-terminal" :deps (corfu popon)))
(popon . (:load "emacs-popon"))
(embark . (:load "embark"))
)
"Package name and config pair.")
(cl-defun add-dir-and-subdirs-to-load-path (dir)
"Add directory and its subdirectoris to `load-path' when no `.nosearch' file exists in DIR.
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))
(defvar creature/pkgs-actived nil
"Actived packages.
This is temporary variable for function `creature/pkg-active'.")
;; if a `.nosearch' file exists in dir, skip it directly
(when (file-exists-p (expand-file-name ".nosearch" dir))
(cl-return-from add-dir-and-subdirs-to-load-path))
(cl-defun creature/pkg-active (pkg)
"Setup package."
(when (member pkg creature/pkgs-actived)
(cl-return-from creature/pkg-active creature/pkgs-actived))
(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")))
(let* ((pkg-config (alist-get pkg creature/pkgs))
(pkg-load-path (plist-get pkg-config :load))
(pkg-autoload (plist-get pkg-config :autoload))
(pkg-info-dir (plist-get pkg-config :info))
(pkg-deps (plist-get pkg-config :deps)))
(unless pkg-config (error "package(%s) not in `creature/pkgs'." pkg))
(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))))
(dolist (dep pkg-deps) (creature/pkg-active dep))
(if (stringp pkg-load-path)
(add-to-list 'load-path (file-name-concat creature/pkg-dir pkg-load-path))
(dolist (path pkg-load-path)
(add-to-list 'load-path (file-name-concat creature/pkg-dir path))))
(when pkg-autoload (load pkg-autoload t t))
(when pkg-info-dir
(add-to-list 'Info-additional-directory-list
(file-name-concat creature/pkg-dir pkg-info-dir))))
(when (cl-some (lambda (file)
(member (file-name-extension file) load-extension))
files)
(add-to-list 'load-path dir))
(mapc #'add-dir-and-subdirs-to-load-path subdirs)))
(add-to-list 'creature/pkgs-actived pkg))
(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 'Info-additional-directory-list
(file-truename (file-name-concat creature/pkg-dir "../.cache")))
(add-to-list 'load-path creature/pkg-dir)
;; add basic packages
(add-pkg-in-pkg-dir "lazy-load")
;; "transient" and "compat" always use submodule package
;; and "cond-let" is dependency of "transient"
(dolist (pkg '("transient" "cond-let" "compat"))
(add-pkg-in-pkg-dir pkg))
(dolist (pkg '("transient" "compat"))
(let ((file (locate-library pkg))
(feature (intern-soft pkg)))
(when (and (featurep feature) (string-prefix-p "/usr/share/emacs" file))
(unload-feature feature t)
(require feature))))
(provide 'init-package)
+2 -3
View File
@@ -1,9 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "plantuml-mode")
(add-pkg-in-pkg-dir "dash")
(add-pkg-in-pkg-dir "deflate")
(creature/pkg-active 'plantuml-mode)
(autoload 'plantuml-mode "plantuml-mode" "" t)
(add-to-list 'auto-mode-alist '("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode))
+3 -6
View File
@@ -1,12 +1,9 @@
;; -*- 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")
(creature/pkg-active 'prettier)
(require 'init-editorconfig)
(autoload 'prettier-mode "prettier" "" t)
+2 -1
View File
@@ -2,7 +2,8 @@
(require 'init-package)
(add-pkg-in-pkg-dir "prisma-ts-mode")
(creature/pkg-active 'prisma-ts-mode)
(autoload 'prisma-ts-mode "prisma-ts-mode" "" t)
;; remember run `treesit-install-language-grammar' command to install `prisma'
(add-to-list
+3 -4
View File
@@ -1,11 +1,10 @@
;; -*- 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)
(creature/pkg-active 'rime)
(creature/pkg-active 'lazy-load)
(require 'rime)
+2 -3
View File
@@ -1,10 +1,9 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(add-pkg-in-pkg-dir "sdcv")
(add-pkg-in-pkg-dir "posframe")
(require 'lazy-load)
(creature/pkg-active 'sdcv)
(creature/pkg-active 'lazy-load)
(require 'init-keybindings)
+9 -9
View File
@@ -1,15 +1,15 @@
;; -*- 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 "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 "embark")
(creature/pkg-active 'marginalia)
(creature/pkg-active 'vertico)
(creature/pkg-active 'corfu)
(creature/pkg-active 'orderless)
(creature/pkg-active 'cape)
(creature/pkg-active 'consult)
(creature/pkg-active 'corfu-terminal)
(creature/pkg-active 'embark)
(require 'marginalia)
+2 -2
View File
@@ -1,8 +1,8 @@
;; -*- coding: utf-8; lexical-binding: t; -*-
(require 'init-package)
(unless (locate-library "which-key")
(add-pkg-in-pkg-dir "emacs-which-key"))
(require 'init-package)
(creature/pkg-active 'which-key))
(require 'init-keybindings)
+5 -4
View File
@@ -1,11 +1,12 @@
;; -*- 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)
(creature/pkg-active 'yasnippet)
(creature/pkg-active 'yasnippet-snippets)
(creature/pkg-active 'auto-yasnippet)
(creature/pkg-active 'lazy-load)
(require 'yasnippet)
(require 'yasnippet-snippets)