完全隐藏:属性:抽屉在组织模式 [英] Completely hide the :PROPERTIES: drawer in org-mode
问题描述
:PROPERTIES:
抽屉,包括说的行:PROPERTIES:
。 *任务(带截止日期)
**下一个动作[#A]问天才如何做到这一点。 :lawlist:
DEADLINE:< 2013-07-04 Thu>
:属性:
:ToodledoID:330686790
:ToodledoFolder:TASKS
:哈希:afa88f17317bbe2ce0ce661333cdcfb4
:END:
这行代表笔记,出现属性抽屉下方。
* UNDATED(没有截止日期)
**有一天[#A]关闭但没有雪茄 - 不断尝试。 :lawlist:
:PROPERTIES:
:ToodledoID:330686680
:ToodledoFolder:TASKS
:Hash:eb0b8d360b5b1453dd66ed0c5698e135
:END:
这行是用于笔记,它出现在属性抽屉下面。
我没有看到Google功能,所以我猜测一些特殊的代码行将需要使此功能成为现实。 [换句话说,我不认为这是一个超级用户的问题,因为这需要用一些特殊的代码发明。]
以下功能完全隐藏了中的所有内容:PROPERTIES:
通过:END:
。可以通过评估(lawlist-org-cycle-hide-draers'children)
或(lawlist-org-cycle-hide-draers 'all)
,或者与循环大纲视图相关的其他功能,为此,需要创建一个 defalias
这个新功能代替股票 org-cycle-hide-draers
。这个新功能中的正则表达式需要由用户进行自定义,以便考虑到紧接 / p>
在我的情况下,立即 之前的行:PROPERTIES:
包含一行单词 DEADLINE:
;或者以 **某一天
或 **计划
(在行的最开始)开始的子标题;或者以 * TASKS
开头的主标题(在行的最开始)。我不喜欢总是看到完成任务的封闭时间戳,所以我使用副标题 ** None
(在行的最开始)作为正则表达式的一部分为了隐藏属性抽屉,它也隐藏了所有这样的东西:关闭:[2014-01-13星期一12:18]
。
组织模式系列中包含的标准功能都可以工作 - 例如 show-all
; ORG-显示子树
;等等。
(defun lawlist-org-cycle-hide-draers(state)
重新隐藏所有抽屉
(when(and(derived-mode-p'org-mode)
(not(memq state'(overview folding contents))))
(保存-excursion
(let *((globalp(memq state'(contents all)))
(beg(if globalp(point-min)(point)))
(end (point-max)
(if(eq state'children)
(save-excursion(outline-next-heading)(point))
(org-end-of-subtree t) )))
(goto-char beg)
(while(re-search-forward^。* DEADLINE:。* $ \\ | ^ \\ * \\ *有一天。* $ \\ | ^ \\ * * \\ * *。* $ \\ | ^ \\ * \\ * *规划。* $ \\ | ^ \\ * TASKS。* $end t)
(save-excursion
(行首1)
(when(looking-at^。* DEADLINE: 。* $ \\ | ^ \\ * \\ *有一天。* $ \\ \\\ | ^ \\ * * \\ *无* * \\ \\ | ^ \\ * \\ *规划* $ \\ | ^ \\ *
(let((b(match-end 0)))
(如果(重新搜索转发
^ [\t] *:END:
(save-excursion(outline-next-heading)(point))t)
(outline-flag-region b(point-at-eol)t)
(用户错误:END:在位置%s缺少行b))))))))))))
对于有兴趣在所有各种观点(包括揭示内的内容:属性:
通过在 (t ;;)之前添加附加条件,可以轻松修改
pre> org-cycle-internal-local
默认动作:隐藏子树。 。 。 。$ / $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
$ b $ org-show-subtree)
(org-unlogged-messageALL)
(setq org-cycle-subtree-status'all))
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.]
The following function completely hides everything from :PROPERTIES:
through :END:
. It can be tested by evaluating (lawlist-org-cycle-hide-drawers 'children)
, or (lawlist-org-cycle-hide-drawers 'all)
, or in conjunction with the other functions relating to cycling the outline views -- to do that, it would be necessary to create a defalias
to this new function in lieu of the stock org-cycle-hide-drawers
. The regexp in this new function will need to be customized by the user to take into account any line that immediately precedes the :PROPERTIES:
line.
In my case, lines that immediately precede :PROPERTIES:
include a line that contains the word DEADLINE:
; or, a subheading that begins with either ** Someday
or ** Planning
(at the very beginning of the line); or, a main heading that begins with * TASKS
(at the very beginning of the line). I prefer not to always see the closed time-stamp for done tasks, so I use the subheading ** None
(at the very beginning of the line) as part of the regexp for hiding the properties drawer so that it also hides everything that looks like this: CLOSED: [2014-01-13 Mon 12:18]
.
The standard functions to unfold that are included within the org-mode family all work -- e.g., show-all
; org-show-subtree
; etc.
(defun lawlist-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 "^.*DEADLINE:.*$\\|^\\*\\* Someday.*$\\|^\\*\\* None.*$\\|^\\*\\* Planning.*$\\|^\\* TASKS.*$" end t)
(save-excursion
(beginning-of-line 1)
(when (looking-at "^.*DEADLINE:.*$\\|^\\*\\* Someday.*$\\|^\\*\\* None.*$\\|^\\*\\* Planning.*$\\|^\\* TASKS.*$")
(let ((b (match-end 0)))
(if (re-search-forward
"^[ \t]*:END:"
(save-excursion (outline-next-heading) (point)) t)
(outline-flag-region b (point-at-eol) t)
(user-error ":END: line missing at position %s" b))))))))))
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))
这篇关于完全隐藏:属性:抽屉在组织模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!