在组织模式下完全隐藏 :PROPERTIES: 抽屉 [英] Completely hide the :PROPERTIES: drawer in org-mode
问题描述
有人可以帮我完全隐藏 :PROPERTIES:
抽屉,包括写着 :PROPERTIES:
的那一行.
Could someone please give me some assistance to completely hide the :PROPERTIES:
drawer, including the line that says :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.
我没有通过谷歌搜索看到这个功能,所以我猜需要一些特殊的代码行才能使这个功能请求成为现实.[换句话说,我不认为这是一个超级用户的问题,因为这需要用一些特殊的代码来发明.]
I didn't see this feature by Googling, so I'm guessing that some special lines of code will be needed to make this feature request a reality. [In other words, I don't think it is a Super User question because this will need to be invented with some special code.]
推荐答案
以下答案完全隐藏了从 :PROPERTIES:
到 :END:
的所有内容.可以通过评估 (org-cycle-hide-drawers 'children)
或 (org-cycle-hide-drawers 'all)
或结合与循环大纲视图相关的其他功能.org-mode
系列中包含的标准展开函数都可以工作——例如,show-all
;org-show-subtree
;等
The following answer completely hides everything from :PROPERTIES:
through :END:
. It can be tested by evaluating (org-cycle-hide-drawers 'children)
, or (org-cycle-hide-drawers 'all)
, or in conjunction with the other functions relating to cycling the outline views. The standard functions to unfold that are included within the org-mode
family all work -- e.g., show-all
; org-show-subtree
; etc.
(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 "^[ ]*:END:" limit t)
(outline-flag-region start (point-at-eol) t)
(user-error msg))))))))))
<小时>
对于对在所有不同视图之间循环选项卡(包括显示 :PROPERTIES:
抽屉中的内容)感兴趣的任何人,可以轻松修改 org-cycle-internal-local
通过在before (t ;; 默认操作:隐藏子树...
For anyone who interested in tab cycling between all of the various views (including revealing what is inside the :PROPERTIES:
drawer, there is an easy modification to org-cycle-internal-local
by adding an additional condition before (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))
<小时>
屏幕截图——隐藏的抽屉:
Screenshot -- Drawers Hidden:
https://www.lawlist.com/images/org_mode_properties_a.png
屏幕截图——抽屉可见:
Screenshot -- Drawers Visible:
https://www.lawlist.com/images/org_mode_properties_b.png
这篇关于在组织模式下完全隐藏 :PROPERTIES: 抽屉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!