From b52bb6853561808153ba57825d7acdc1ecf3a510 Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 1 May 2021 20:26:21 +0800 Subject: [PATCH] Org: complicate package! statement for dev and use --- config.org | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/config.org b/config.org index 7513bbf..6ad7bd2 100644 --- a/config.org +++ b/config.org @@ -1620,9 +1620,45 @@ I think the latest AucTeX may be a bit dodgy, so #+end_src *** Org Mode -Use ~HEAD~ for development. -#+begin_src emacs-lisp -(package! org-mode :pin nil) + +There are actually three possible package statements I may want to use for Org. + +If I'm on a machine where I can push changes, I want to be able to develop Org. +I can check this by checking the content of the SSH key =~/.ssh/id_ed25519.pub=. +1. If this key exists and there isn't a repo at + =$straight-base-dir/straight/repos/org-mode= with the right remote, we should + install it as such. +2. If the key exists and repo are both set up, the package should just be ignored. +3. If the key does not exist, the Org's ~HEAD~ should just be used + +To account for this situation properly, we need a short script to determine the +correct package statement needed. + +#+name: org-pkg-statement +#+begin_src emacs-lisp :tangle no +(setq doom-first-input-hook nil) ; HACK temporary bugfix +(load (expand-file-name "core/core.el" user-emacs-directory) nil t) ; for `doom-local-dir' +(let ((dev-key (and (file-exists-p "~/.ssh/id_ed25519.pub") + (= 0 (shell-command "cat ~/.ssh/id_ed25519.pub | grep -q AAAAC3NzaC1lZDI1NTE5AAAAIOZZqcJOLdN+QFHKyW8ST2zz750+8TdvO9IT5geXpQVt")))) + (dev-pkg (let ((default-directory (expand-file-name "straight/repos/org-mode" doom-local-dir))) + (and (file-exists-p default-directory) + (string= "git@code.orgmode.org:bzg/org-mode.git\n" (shell-command-to-string "git remote get-url origin")))))) + (prin1-to-string + (cond ((and dev-key dev-pkg) + `(package! org-mode + :recipe (:local-repo ,(expand-file-name "straight/repos/org-mode" doom-local-dir) + :files ("*.el" "lisp/*.el" "contrib/lisp/*.el" "contrib/scripts")) + :pin nil)) + (dev-key + `(package! org-mode + :recipe (:host nil :repo "git@code.orgmode.org:bzg/org-mode.git" + :files ("*.el" "lisp/*.el" "contrib/lisp/*.el" "contrib/scripts")) + :pin nil) + (t `(package! org-mode :pin nil)))))) +#+end_src + +#+begin_src emacs-lisp :noweb no-export +<> #+end_src **** Improve agenda/capture