Extract the second level headline

為{幸葍}努か 提交于 2019-12-22 12:21:38

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/35881446/extract-the-second-level-headline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!