gpt4 book ai didi

emacs - 完全隐藏 :PROPERTIES: drawer in org-mode

转载 作者:行者123 更新时间:2023-12-03 13:33:05 24 4
gpt4 key购买 nike

有人可以给我一些帮助以完全隐藏:PROPERTIES:抽屉,包括写着 :PROPERTIES: 的那一行.

* TASKS (with deadines)

** Next Action [#A] Ask the geniuses how to do this. :lawlist:
DEADLINE: <2013-07-04 Thu >
:PROPERTIES:
:ToodledoID: 330686790
:ToodledoFolder: TASKS
:Hash: afa88f17317bbe2ce0ce661333cdcfb4
:END:
This line is for notes, which appears underneath the properties drawer.

* UNDATED (without deadlines)

** Someday [#A] Close but no cigar -- keep trying. :lawlist:
:PROPERTIES:
:ToodledoID: 330686680
:ToodledoFolder: TASKS
:Hash: eb0b8d360b5b1453dd66ed0c5698e135
:END:
This line is for notes, which appears underneath the properties drawer.

我没有通过谷歌搜索看到这个功能,所以我猜需要一些特殊的代码行才能使这个功能请求成为现实。 [换句话说,我不认为这是一个 super 用户的问题,因为这需要用一些特殊的代码来发明。]

最佳答案

以下答案完全隐藏了 :PROPERTIES: 的所有内容通过 :END: .可以通过评估(org-cycle-hide-drawers 'children)进行测试, 或 (org-cycle-hide-drawers 'all) ,或与其他与循环大纲 View 相关的功能结合使用。包含在 org-mode 中的要展开的标准函数家庭所有工作 - 例如,show-all ; org-show-subtree ;等等。

(require 'org)

(defun org-cycle-hide-drawers (state)
"Re-hide all drawers after a visibility state change."
(when (and (derived-mode-p 'org-mode)
(not (memq state '(overview folded contents))))
(save-excursion
(let* ((globalp (memq state '(contents all)))
(beg (if globalp
(point-min)
(point)))
(end (if globalp
(point-max)
(if (eq state 'children)
(save-excursion
(outline-next-heading)
(point))
(org-end-of-subtree t)))))
(goto-char beg)
(while (re-search-forward org-drawer-regexp end t)
(save-excursion
(beginning-of-line 1)
(when (looking-at org-drawer-regexp)
(let* ((start (1- (match-beginning 0)))
(limit
(save-excursion
(outline-next-heading)
(point)))
(msg (format
(concat
"org-cycle-hide-drawers: "
"`:END:`"
" line missing at position %s")
(1+ start))))
(if (re-search-forward "^[ \t]*:END:" limit t)
(outline-flag-region start (point-at-eol) t)
(user-error msg))))))))))

对于对在所有不同 View 之间循环选项卡(包括显示 :PROPERTIES: 抽屉内的内容)感兴趣的任何人,可以通过在 org-cycle-internal-local 之前添加附加条件来轻松修改 (t ;; Default action: hide the subtree. . . .
((eq org-cycle-subtree-status 'subtree)
(org-show-subtree)
(org-unlogged-message "ALL")
(setq org-cycle-subtree-status 'all))

屏幕截图——抽屉隐藏:

https://www.lawlist.com/images/org_mode_properties_a.png

屏幕截图——抽屉可见:

https://www.lawlist.com/images/org_mode_properties_b.png

关于emacs - 完全隐藏 :PROPERTIES: drawer in org-mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17478260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com