Orgmode:显示标题下的孩子数 [英] Orgmode: Show number of children under heading

查看:49
本文介绍了Orgmode:显示标题下的孩子数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 orgmode 文件中有一个标题.它会定期自动更新新的孩子.我希望标题行显示孩子的数量.

I have a heading in my orgmode file. It is automatically updated periodically with new children. I want the heading line to show the number of children.

所以如果我有一个孩子,它会说(1)

So if I have one child it would say something like (1)

* Heading (1)
** Subheading

当它被另一个副标题更新后,数字应该自动更改为(2)

After it gets updated with another subheading the number should automatically be changed to (2)

* Heading (2)
** Subheading
** A new added subheading

我希望它这样做,因为顶级标题通常会被折叠.我希望能够查看是否有任何新子项添加到其中而无需扩展它

I want it to do this because the toplevel heading will normally be collapsed. I want to be able to see if any new children were added to it without having to expand it

推荐答案

与您搜索的内容最相似的称为统计 cookie.它们在手册中的这个页面的末尾进行了描述.起初用于列表,但这也可以计算标题.只需将 [/] 放在标题的末尾,如下所示:

What's most similar to what you're searching are called statistics cookies. They're described at the end of this page in the manual. At first meant for lists, but that can also count headlines. Just put [/] at the end of your header, like so :

* Main header [/]
** sub-header 1
** sub-header 2
** sub-header 3

然后在 cookie 上按 C-c C-c 来更新它(让它更新它的计数).您确实需要添加到您描述的用例中的是TODO 标题中的关键字,因为cookie 将计算的是有多少完成了多少要做.因此,我建议您将它们全部标记为 DONE,如下所示:

And press C-c C-c on the cookie to update it (make it update its count). What you do need to add to what you describe to be your use-case is TODO keywords to your headers, because what the cookie will count is how many are done over how many are to do. Therefore I suggest you mark them all as DONE, like so :

* Main header [3/3]
** DONE sub-header 1
** DONE sub-header 2
** DONE sub-header 3

然后,柜台会告诉你你想要什么.

Then, the counter will show you what you want.

您或许可以调整这些 cookie 的代码以满足您的具体需求.

You could probably adapt these cookies' code to meet your precise needs.

这篇关于Orgmode:显示标题下的孩子数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆