提取第二级标题 [英] Extract the second level headline

查看:139
本文介绍了提取第二级标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的全球TODO列表,我按照建议





我只想显示第二级项目的面包屑,所以在这种情况下,我会只有显示 [Project A] 。我想如果我可以做一个可以提取第二级的函数,我只需要使用%? / code> so th在 [Tasks] 不会出现任务,但只有项目名称将显示为项目。提取第二级的理想方法是什么?

解决方案

所有你需要做的第二个元素(org-get-outline-path)要调用 nth


(nth N LIST)



返回LIST的第N个元素。
N从零开始计数。如果LIST不是很长,则返回nil。


第二个元素是(nth 1 LIST)。将(org-get-outline-path)替换为(list(nth 1(org-get-outline-path)))(我们使用列表,因为这是 org-format-outline-path expects)


For my global TODO list, I am showing breadcrumbs as suggested here :

(concat \"[ \"(org-format-outline-path (org-get-outline-path)) \" ]\") ") 

to produce following:

I would like to show only the second level of project breadcrumb. So in this case, I would only display [Project A]. I think if I can make a function that can extract the second level, I just need to prepend with %? so that [Tasks] does not appear for Tasks, but only project names would appear for Projects. What would be an ideal way of extracting the second level?

解决方案

All you have to do to get the second element of (org-get-outline-path) is to call nth.

(nth N LIST)

Return the Nth element of LIST. N counts from zero. If LIST is not that long, nil is returned.

The second element is (nth 1 LIST). Replace (org-get-outline-path) with (list (nth 1 (org-get-outline-path))) (we use list because that's what org-format-outline-path expects).

这篇关于提取第二级标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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