求助,org mode自动归档已完成任务,抄作业失败

我查找了论坛里给的org mode自动归档配置,但是自己抄了配置以后每次设置任务已完成后,要退出时会在当前目录递归生成一堆_archive文件,例如: org_error

求助大家,我是否抄作业没抄全??

我的相关配置是:


;;;;;;;;;;;;;;;;;;;;;; org mode configuration start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;org mode标题美化
;; 打开 org-indent mode
(setq org-startup-indented t)

;; org mode代码高亮
(setq org-src-fontify-natively t)

;; 设置任务流程(这是我的配置)
(setq org-todo-keywords
      '((sequence "未开始(p!)" "进行中(t!)" "阻塞中(s!)" "|" "已完成(d!)" "已取消(a@/!)")))
?
;; 设置任务样式
(setq org-todo-keyword-faces
   '(("未开始" .   (:foreground "red"  :background "#000000" :weight bold))
    ("阻塞中" .   (:foreground "white"   :background "#FF0000" :weight bold))
    ("进行中" .      (:foreground "yellow"  :background "#0000FF" :weight bold))
    ("已完成" .      (:foreground "blue"  :background "#00FF00" :weight bold))
    ("已取消" .     (:background "black"  :background "#777777" :foreground "black"))
))

;; 设置 Org Agenda 快捷键
(global-set-key (kbd "C-c a") 'org-agenda)
?
;; 加入到日程列表里
(setq org-agenda-files (list "e:/org"))
(setq org-agenda-files
    (file-expand-wildcards "e:/org/*.org"))
(setq org-default-notes-file "e:/org/todo.org")
(global-set-key (kbd "C-c r") 'org-capture)

(defun org-summary-todo (n-done n-not-done)
      "Switch entry to DONE when all subentries are done, to TODO otherwise."
      (let (org-log-done org-log-states)   ; turn off logging
        (org-todo (if (= n-not-done 0) "DONE" "TODO"))))

    (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

;; capture模板
(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "e:/org/todo.org" "Tasks")
             "* TODO %?\n  %t\n")
        ("j" "Journal" entry (file+datetree "e:/org/diary.org" "Diary")
             "* %?\nEntered on %U\n  %i\n  %a")))

(defun archive-done-tasks ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward
            (concat "\\* " (regexp-opt org-done-keywords) " ") nil t)
      (goto-char (line-beginning-position))
      (org-archive-subtree))))	  

(defun enable-auto-archive ()
  (add-hook 'after-save-hook 'archive-done-tasks))
(add-hook 'org-mode-hook 'enable-auto-archive)
;;;;;;;;;;;;;;;;;;;;;; org mode configuration end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1 个赞

论坛排版是支持 markdown 语法的。调一下,不然没法看呀。

谢提醒,已修改 :persevere: