config: add macOS support with cross-platform compatibility

- Add platform-specific keybindings, paths, and settings for macOS
- Update org-mode templates and agenda files for both Windows and Mac
- Add vterm and lua-ts-mode packages (non-Windows)
- Configure Chinese segmentation for macOS
- Adjust font sizes and encoding settings per platform
This commit is contained in:
Andsy10
2026-03-24 06:34:19 +08:00
parent 95a6adb2b8
commit 0f4ddc392c
6 changed files with 120 additions and 29 deletions

View File

@@ -37,12 +37,19 @@
(setq system-time-locale "C")
;; capture模板
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "d:/emacs/org/todos.org" "Workspace")
"* TODO [#B] %?\n %i\n %U"
:empty-lines 1)
("j" "Journal" entry (file+datetree "d:/emacs/org/journal.org")
"* %?\nEntered on %U\n %i\n")))
(when *is-windows*
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "d:/emacs/org/todos.org" "Workspace")
"* TODO [#B] %?\n %i\n %U"
:empty-lines 1)
("j" "Journal" entry (file+datetree "d:/emacs/org/journal.org")
"* %?\nEntered on %U\n %i\n"))))
(when *is-mac*
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "~/org/some-orgs/todos.org" "Workspace")
"* TODO [#B] %?\n %i\n %U"
:empty-lines 1))))
(global-set-key (kbd "C-c o c") 'org-capture)
@@ -63,12 +70,17 @@
;; agenda相关
(global-set-key (kbd "C-c a") 'org-agenda)
(with-eval-after-load 'org
(when *is-windows*
(with-eval-after-load 'org
(setq org-agenda-files '("d:/emacs/org/learning-org-mode.org"
"d:/emacs/hugo/this-is-my-blog/all-blog.org"
"d:/emacs/my-org-daily/"))) ; agenda文件目录或文件
(setq org-agenda-span 'day)
"d:/emacs/my-org-daily/")))) ; agenda文件目录或文件
(when *is-mac*
(with-eval-after-load 'org
(setq org-agenda-files '("~/org/my-org-daily"))))
(setq org-agenda-span 'day)
;; hugo
(with-eval-after-load 'org-capture
@@ -150,8 +162,7 @@ See `org-capture-templates' for more information."
;; org-journal
(use-package org-journal
:config
(setq org-journal-dir "D:/emacs/my-org-daily/"
org-journal-file-format "%Y-%m-%d.org"
(setq org-journal-file-format "%Y-%m-%d.org"
org-journal-file-header "#+title: Daily Journal\n#+category: journal\n\n"
org-journal-time-format "%R \n:PROPERTIES:\n:Created: <%Y-%m-%d %a %H:%M:%S>\n:END:\n"
org-journal-time-prefix "\n*** TODO "
@@ -161,7 +172,15 @@ See `org-capture-templates' for more information."
(format-time-string "%Y-%m-%d" time)
(format-time-string "%a" time)
(format-time-string "%Y-%m-%d %a" time))))
(when *is-windows*
(setq org-journal-dir "D:/emacs/my-org-daily/"))
(when *is-mac*
(setq org-journal-dir "~/org/my-org-daily/"))
(add-hook 'org-journal-mode-hook 'font-lock-update)
(defun my/journal-setup-new-day ()
(save-excursion
(org-back-to-heading)
@@ -192,7 +211,21 @@ See `org-capture-templates' for more information."
(funcall org-journal-find-file org-journal-file)
(unless (org-journal--daily-p)
(org-journal--goto-entry date)))
(message "No journal entry for this date.")))))
(message "No journal entry for this date."))))
(defun my/org-journal-mark-old-todos-as-comment (entries)
"Change of TODO entry's TODO key word to COMMENT after carryover."
(save-excursion
(mapc (lambda (entry)
(let ((start (car entry))
(end (cadr entry)))
(goto-char start)
(when (re-search-forward "^\\(\\*+ \\)TODO\\>" end t)
(replace-match "\\1COMMENT" t nil))))
(reverse entries)))
(save-buffer))
(setq org-journal-handle-old-carryover-fn #'my/org-journal-mark-old-todos-as-comment))
;; 在org-journal加载cns-mode
(add-hook 'org-journal-mode-hook