From f415371331f378e69c42b3c1bc03a938753b7013 Mon Sep 17 00:00:00 2001 From: trogloxene Date: Tue, 7 Apr 2026 21:34:38 +0800 Subject: [PATCH] Config: update path, add org capture tamplate. --- lisp/init-completion.el | 2 ++ lisp/init-dired.el | 14 +++++----- lisp/init-org.el | 57 +++++++++++++++++++++++++++++---------- lisp/init-segmentation.el | 6 ++--- 4 files changed, 55 insertions(+), 24 deletions(-) diff --git a/lisp/init-completion.el b/lisp/init-completion.el index 2a5bbab..afc8217 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -107,6 +107,8 @@ :config (add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode))) +(use-package ahk-mode) + ;; tree-sitter (use-package treesit-auto :demand t diff --git a/lisp/init-dired.el b/lisp/init-dired.el index 4d66d80..10c425d 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -42,14 +42,14 @@ ("e" "~/.emacs.d/") ("p" "c:/Users/gaozh/Pictures/Screenshots/" "Pictures") ("d" "f:/下载25-2-10/" "Download") - ("v" "f:/luping26-1-11/" "Videos")))) - (dirvish-quick-access-entries - (when *is-mac* + ("v" "f:/luping26-1-11/" "Videos") + ("n" "h:/emacs/my-org-note/" "Notes"))) + (when *is-mac* '(("h" "~/" "Home") - ("e" "~/.emacs.d/") - ("p" "~/Pictures/" "Pictures") - ("d" "~/Downloads/" "Download") - ("v" "~/Movies/" "Videos"))))) + ("e" "~/.emacs.d/") + ("p" "~/Pictures/" "Pictures") + ("d" "~/Downloads/" "Download") + ("v" "~/Movies/" "Videos"))))) (use-package trashed :commands (trashed) diff --git a/lisp/init-org.el b/lisp/init-org.el index 642aaff..d1a1fb3 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -35,17 +35,17 @@ (setq org-journal-file-format "%Y-%m-%d.org" org-journal-file-header "#+category: journal\n#+STARTUP: content\n\n" org-journal-time-prefix "\n*** TODO " - org-journal-time-format "%m-%d \n:PROPERTIES:\n:Created: <%Y-%m-%d %a %H:%M:%S>\n:END:\n" + org-journal-time-format "%m-%d \n<%Y-%m-%d %a %H:%M:%S>\n" org-journal-hide-entries-p t org-journal-date-format (lambda (time) - (format "* %s %s\n:PROPERTIES:\n:Created: [%s]\n:END:" + (format "* %s %s\n[%s]\n" (format-time-string "%Y-%m-%d" time) (format-time-string "%a" time) (format-time-string "%Y-%m-%d %a" time))) org-journal-carryover-items "TODO=\"TODO\"|TODO=\"STARTED\"|TODO=\"WAITING\"|TODO=\"SOMEDAY\"") (when *is-windows* - (setq org-journal-dir "D:/emacs/my-org-daily/")) + (setq org-journal-dir "h:/emacs/my-org-daily/")) (when *is-mac* (setq org-journal-dir "~/org/my-org-daily/")) @@ -110,6 +110,7 @@ (lambda () (global-cns-mode-enable-in-buffer))) + ;; 一些随org-mode加载的基础配置 (add-hook 'org-mode-hook (lambda () @@ -155,8 +156,9 @@ (when *is-windows* (with-eval-after-load 'org - (setq org-agenda-files '("d:/emacs/hugo/this-is-my-blog/all-blog.org" - "d:/emacs/my-org-daily/")))) + (setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org" + "h:/emacs/my-org-daily/" + "h:/emacs/my-org-note/")))) (when *is-mac* (with-eval-after-load 'org (setq org-agenda-files '("~/org/my-org-daily")))) @@ -168,14 +170,14 @@ (setq org-agenda-skip-function-global '(org-agenda-skip-entry-if 'todo '("COMMENT"))) +;; org-ql +(use-package org-ql) + ;; org-super-agenda 配置 (use-package org-super-agenda :config (org-super-agenda-mode)) -;; org-ql -(use-package org-ql) - ;; 自定义已完成任务视图 (setq org-agenda-custom-commands '(("pa" "Priority >= A" @@ -209,12 +211,39 @@ (org-super-agenda-groups '((:auto-ts t))))))))) +(setq org-tag-alist '( + ("scheme" . ?s) + ("emacs" . ?e) + ("linux" . ?l) + ("computer-stuff" . ?c) + ("philosophy" . ?p) + ("game" . ?g) + ("gamestudies" . ?G) + )) + ;; capture模板 (when *is-windows* + (defvar my-org-capture-temp-title "" "Temporarily store the org-capture filename.") (setq org-capture-templates - '(("t" "Todo" entry (file+headline "d:/emacs/org/todos.org" "Workspace") - "* TODO [#B] %?\n %i\n %U" - :empty-lines 1)))) + '(("n" "New Note" plain + (file (lambda () + (setq my-org-capture-temp-title (read-string "Filename (without .org): ")) + (expand-file-name (format "%s/%s-%s.org" + "h:/emacs/my-org-note" + (format-time-string "%Y%m%d") + my-org-capture-temp-title)))) + "#+title: %(symbol-value 'my-org-capture-temp-title) +#+created: %U +#+category: %^{Category|none|plan|book|article|note|insight} +#+filetags: %^g + +* %(symbol-value 'my-org-capture-temp-title) +:PROPERTIES: +:END: + +%? +" + :jump-to-captured t)))) (when *is-mac* (setq org-capture-templates @@ -260,14 +289,14 @@ See `org-capture-templates' for more information." ;; It is assumed that below file is present in `org-directory' ;; and that it has a "Blog Ideas" heading. It can even be a ;; symlink pointing to the actual location of all-posts.org! - (file+headline "d:/emacs/hugo/this-is-my-blog/all-blog.org" "Blog Ideas") + (file+headline "h:/emacs/hugo/this-is-my-blog/all-blog.org" "Blog Ideas") (function org-hugo-new-subtree-post-capture-template)))) ;; 快速部署 (defun my-blog-publish () "Publish blog , git add/commit/push , generate commit message." (interactive) - (let* ((blog-dir "d:/emacs/hugo/this-is-my-blog/") + (let* ((blog-dir "h:/emacs/hugo/this-is-my-blog/") (timestamp (format-time-string "%Y-%m-%d %H:%M:%S")) (default-directory blog-dir)) @@ -296,7 +325,7 @@ See `org-capture-templates' for more information." "Save and preview blog." (interactive) (save-buffer) - (let ((default-directory "d:/emacs/hugo/this-is-my-blog/")) + (let ((default-directory "h:/emacs/hugo/this-is-my-blog/")) ;; 启动 Hugo server (start-process "hugo-server" "*hugo-server*" "hugo" "server" "-D" "--bind" "0.0.0.0" "--port" "1313") diff --git a/lisp/init-segmentation.el b/lisp/init-segmentation.el index f8fd67b..7127364 100644 --- a/lisp/init-segmentation.el +++ b/lisp/init-segmentation.el @@ -6,13 +6,13 @@ ;; emacs-chinese-word-segmentation 配置 (when *is-windows* - (add-to-list 'load-path "D:/emacs/emacs-chinese-word-segmentation") + (add-to-list 'load-path "h:/emacs/emacs-chinese-word-segmentation/") ;; 设置为进程调用方式 (setq cns-process-type 'shell) ;; 设置可执行文件路径 - (setq cns-prog "D:/emacs/emacs-chinese-word-segmentation/cnws.exe") + (setq cns-prog "h:/emacs/emacs-chinese-word-segmentation/cnws.exe") ;; 设置字典目录 - (setq cns-dict-directory "D:/emacs/emacs-chinese-word-segmentation/cppjieba/dict") + (setq cns-dict-directory "h:/emacs/emacs-chinese-word-segmentation/cppjieba/dict") ;; 直接设置进程命令,绕过 Windows shell 检测 (setq cns-process-shell-command (format "%s %s %s %s %s %s"