最近想改造一下org-mode下回车键的功能,因此参考起了doom-emacs下的配置,有一些代码不理解为什么要这么做,请看这段代码
(`headline
(cond ((memq (bound-and-true-p org-goto-map)
(current-active-maps))
(org-goto-ret))
((and (fboundp 'toc-org-insert-toc)
(member "TOC" (org-get-tags)))
(toc-org-insert-toc)
(message "Updating table of contents"))
((string= "ARCHIVE" (car-safe (org-get-tags)))
(org-force-cycle-archived))
((or (org-element-property :todo-type context)
(org-element-property :scheduled context))
(org-todo
(if (eq (org-element-property :todo-type context) 'done)
(or (car (+org-get-todo-keywords-for (org-element-property :todo-keyword context)))
'todo)
'done))))
;; Update any metadata or inline previews in this subtree
(org-update-checkbox-count)
(org-update-parent-todo-statistics)
(when (and (fboundp 'toc-org-insert-toc)
(member "TOC" (org-get-tags)))
(toc-org-insert-toc)
(message "Updating table of contents"))
这里在判断了两次(when (and (fboundp 'toc-org-insert-toc) (member "TOC" (org-get-tags)))
如果满足条件的话,在上面的cond
当中应该已经完成了对toc的更新,无需下面再次更新了吧,不知道我的理解有没有问题?