Config: streamline config structure and reorganize modules
- Remove init-workspace.el and redundant UI/font/autothemer setup - Add init-prog.el for programming language configs (treesit, lua, scheme, etc.) - Defer org-refile loading via org-mode hook - Adjust load order in init.el, add init-proxy - Fix indentation and formatting issues
This commit is contained in:
159
lisp/init-org.el
159
lisp/init-org.el
@@ -6,6 +6,71 @@
|
||||
|
||||
(use-package org)
|
||||
|
||||
;; 一些随org-mode加载的基础配置
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(require 'org-tempo)
|
||||
(require 'init-org-refile)
|
||||
(org-indent-mode)
|
||||
(visual-line-mode)
|
||||
(setq-local electric-pair-inhibit-predicate
|
||||
(lambda (char)
|
||||
(or (eq char ?<)
|
||||
(electric-pair-default-inhibit char))))))
|
||||
|
||||
;; 预加载,防止windows的org-mode加载卡顿
|
||||
(if *is-windows*
|
||||
(progn (run-with-idle-timer
|
||||
0.5 nil
|
||||
(lambda ()
|
||||
(with-temp-buffer
|
||||
(org-mode)
|
||||
(org-mode))
|
||||
(message "Org preloaded")))))
|
||||
|
||||
;; 设置标题字体大小
|
||||
;; (dolist (face org-level-faces)
|
||||
;; (set-face-attribute face nil :height 1))
|
||||
|
||||
;; log默认放入drawer中
|
||||
(setq org-log-done t)
|
||||
(setq org-log-into-drawer t)
|
||||
|
||||
;; 将系统时间(星期)设为英文,防止中文乱码
|
||||
(setq system-time-locale "C")
|
||||
|
||||
;; 设置todo关键字
|
||||
(setq org-todo-keywords
|
||||
(quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
|
||||
(sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING(m)" "PHONE(p)"))))
|
||||
|
||||
;; agenda相关
|
||||
(cond
|
||||
(*is-windows*
|
||||
(setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org"
|
||||
"h:/emacs/my-org-daily/"
|
||||
"h:/emacs/my-org-note/")))
|
||||
(*is-mac*
|
||||
(setq org-agenda-files '("~/org/my-org-daily"
|
||||
"~/org/my-org-note/")))
|
||||
(*is-linux*
|
||||
(setq org-agenda-files '("~/org/my-org-daily/"
|
||||
"~/org/my-org-note/"))))
|
||||
|
||||
(setq org-agenda-span 'day)
|
||||
(setq org-default-priority ?C)
|
||||
(setq org-agenda-skip-function-global
|
||||
'(org-agenda-skip-entry-if 'todo '("COMMENT")))
|
||||
|
||||
|
||||
;; 批量调整表格
|
||||
(defun org-table-align-all ()
|
||||
"Ajust all table in current buffer."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(org-table-map-tables 'org-table-align t)))
|
||||
|
||||
;; org-babel scheme
|
||||
(use-package ob-scheme
|
||||
:straight (:type built-in)
|
||||
@@ -18,11 +83,11 @@
|
||||
;; org-contrib 和 org-checklist
|
||||
(use-package org-contrib
|
||||
:straight (org-contrib :type git :host github :repo "emacsmirror/org-contrib"
|
||||
:depth 1))
|
||||
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(require 'org-checklist nil t)))
|
||||
:depth 1)
|
||||
:config
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(require 'org-checklist nil t))))
|
||||
|
||||
;; org-download
|
||||
(use-package org-download
|
||||
@@ -36,7 +101,10 @@
|
||||
(setq org-download-dragndrop t)
|
||||
(setq org-image-actual-width nil)
|
||||
(setq org-download-image-html-width 600)
|
||||
(add-hook 'org-mode-hook 'org-display-inline-images)))
|
||||
(add-hook 'org-mode-hook 'org-display-inline-images))
|
||||
(with-eval-after-load 'org
|
||||
(require 'org-download)
|
||||
(setq org-return-follows-link t)))
|
||||
|
||||
;; org-journal
|
||||
(use-package org-journal
|
||||
@@ -111,72 +179,12 @@
|
||||
(reverse entries))))
|
||||
(save-buffer)))
|
||||
|
||||
(setq org-journal-handle-old-carryover-fn #'my/org-journal-mark-old-todos-as-comment))
|
||||
(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
|
||||
(lambda ()
|
||||
(global-cns-mode-enable-in-buffer)))
|
||||
|
||||
;; 一些随org-mode加载的基础配置
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(require 'org-tempo)
|
||||
(org-indent-mode)
|
||||
(setq-local electric-pair-inhibit-predicate
|
||||
(lambda (char)
|
||||
(or (eq char ?<)
|
||||
(electric-pair-default-inhibit char))))))
|
||||
|
||||
(with-eval-after-load 'org
|
||||
(require 'org-download)
|
||||
(setq org-return-follows-link t))
|
||||
|
||||
;; 预加载,防止windows的org-mode加载卡顿
|
||||
(if *is-windows*
|
||||
(progn (run-with-idle-timer
|
||||
0.5 nil
|
||||
;; 在org-journal加载cns-mode
|
||||
(add-hook 'org-journal-mode-hook
|
||||
(lambda ()
|
||||
(with-temp-buffer
|
||||
(org-mode)
|
||||
(org-mode))
|
||||
(message "Org preloaded")))))
|
||||
|
||||
;; 设置标题字体大小
|
||||
;; (dolist (face org-level-faces)
|
||||
;; (set-face-attribute face nil :height 1))
|
||||
|
||||
;; log默认放入drawer中
|
||||
(setq org-log-done t)
|
||||
(setq org-log-into-drawer t)
|
||||
|
||||
;; 将系统时间(星期)设为英文,防止中文乱码
|
||||
(setq system-time-locale "C")
|
||||
|
||||
;; 设置todo关键字
|
||||
(setq org-todo-keywords
|
||||
(quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
|
||||
(sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING(m)" "PHONE(p)"))))
|
||||
|
||||
;; agenda相关
|
||||
(when *is-windows*
|
||||
(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*
|
||||
(setq org-agenda-files '("~/org/my-org-daily"
|
||||
"~/org/my-org-note/")))
|
||||
|
||||
(when *is-linux*
|
||||
(setq org-agenda-files '("~/org/my-org-daily/"
|
||||
"~/org/my-org-note/")))
|
||||
|
||||
(setq org-agenda-span 'day)
|
||||
|
||||
(setq org-default-priority ?C)
|
||||
|
||||
(setq org-agenda-skip-function-global
|
||||
'(org-agenda-skip-entry-if 'todo '("COMMENT")))
|
||||
(global-cns-mode-enable-in-buffer))))
|
||||
|
||||
;; org-ql
|
||||
(use-package org-ql
|
||||
@@ -238,7 +246,6 @@
|
||||
(org-ql-sort '(start-time))
|
||||
(org-super-agenda-groups
|
||||
'((:auto-ts t)))))))
|
||||
|
||||
("qa" "all TODO entries"
|
||||
((org-ql-block '(and (not (done)) (todo))
|
||||
((org-ql-block-header "all TODOs")
|
||||
@@ -301,20 +308,10 @@
|
||||
|
||||
(setq org-bookmark-names-plist nil)
|
||||
|
||||
;; 批量调整表格
|
||||
(defun org-table-align-all ()
|
||||
"Ajust all table in current buffer."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(org-table-map-tables 'org-table-align t)))
|
||||
|
||||
;; hugo
|
||||
|
||||
;; 安装ox-hugo
|
||||
(use-package ox-hugo)
|
||||
|
||||
|
||||
(with-eval-after-load 'org-capture
|
||||
(defun org-hugo-new-subtree-post-capture-template ()
|
||||
"Returns `org-capture' template string for new Hugo post.
|
||||
|
||||
Reference in New Issue
Block a user