From d48d07aff93e7abc183dc200791e1aaea365ba76 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Sun, 14 Jul 2024 22:53:11 +0800 Subject: [PATCH] [feat/garden] add plant function --- config.org | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/config.org b/config.org index dbe7827..2a8c1c2 100644 --- a/config.org +++ b/config.org @@ -115,7 +115,8 @@ :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n#+date: %T\n#+hugo_auto_set_lastmod: t\n#+hugo_section: daily\n")))) #+end_src -*** garden + +*** Garden 数字花园,开始种植思想…… #+begin_src emacs-lisp @@ -127,6 +128,29 @@ (add-to-list 'org-agenda-files org-roam-garden-file) #+end_src +#+begin_src emacs-lisp +(defun org-roam-garden-plant () + (interactive) + (save-excursion + (goto-char (point-min)) + (let* ((node (org-roam-node-at-point)) + (title (org-roam-node-title node)) + (file (org-roam-node-file node))) + (org-set-property "GARDEN-STATE" "seedling") + (org-roam-update-garden-file title file)) + (save-buffer))) + +(defun org-roam-update-garden-file (heading file-path) + (with-current-buffer (find-file-noselect org-roam-garden-file) + (let ((buffer (current-buffer))) + (if (org-find-exact-headline-in-buffer heading) + (message "Plant exists, skip...") + (goto-char (point-max)) + (insert (concat "* " heading "\n[[" file-path "]]")) + (org-schedule nil (format "<%s 22:00 ++1d >" (format-time-string "%Y-%m-%d %u"))) + (save-buffer))))) +#+end_src + ** org-roam-ui 非常酷炫的一个网页 =roam= 笔记查看,可惜如果能够只查看某个节点就好了, 数据量一大我怕打开会直接卡死。 @@ -563,7 +587,6 @@ ** Paredit #+begin_src emacs-lisp (use-package! paredit - :after clojure-mode :config (add-hook 'clojure-mode-hook 'enable-paredit-mode) (add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)