* Function to get the title of a heading
@ 2009-01-06 18:53 Daniel Clemente
2009-01-08 22:20 ` Carsten Dominik
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Clemente @ 2009-01-06 18:53 UTC (permalink / raw
To: emacs-orgmode list
Hi,
I want to get the title of some entry in Elisp. That is, from this heading:
*** TODO Do something!
I want the "Do something!".
I know no function to do this; although there is probably one. What I found is:
- (org-entry-properties) returns the TODO keyword, the tags, and the category, but not the title.
- (org-get-entry) has no useful documentation but it seems to return the content, not the heading.
- (org-get-header HEADER) does something else related to mail; it seems to be unused and not much documented.
- (org-get-heading t) seems to return the full line (even with keyword), but with properties:
#("TODO Do something!" 0 4
(org-category "test1" fontified t face org-todo)
4 18
(org-category "test1" fontified t face org-level-3))
Based on this, I did a function to remove the TODO keyword and the properties.
(defun org-get-heading-title ()
"Returns the heading of the current entry as a string, without the leading stars, the TODO keyword or the tags."
(let (
(title-with-props (org-get-heading t))
(keyword (org-get-todo-state))
)
(substring-no-properties title-with-props (if keyword (1+ (length keyword))))
)
)
Suggestions:
- This could also be implemented as a parameter to (org-get-heading).
- Or the title returned in (org-entry-properties)
- And (org-get-header HEADER) could be removed.
- In any case, such a function can be included in Org-mode so that it is easy to find.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Function to get the title of a heading
2009-01-06 18:53 Function to get the title of a heading Daniel Clemente
@ 2009-01-08 22:20 ` Carsten Dominik
2009-01-11 17:08 ` Daniel Clemente
0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2009-01-08 22:20 UTC (permalink / raw
To: Daniel Clemente; +Cc: emacs-orgmode list
Hi Daniel,
I have added `org-heading-components'.
HTH
- Carsten
On Jan 6, 2009, at 7:53 PM, Daniel Clemente wrote:
>
> Hi,
>
> I want to get the title of some entry in Elisp. That is, from this
> heading:
>
> *** TODO Do something!
>
> I want the "Do something!".
>
>
> I know no function to do this; although there is probably one. What
> I found is:
>
> - (org-entry-properties) returns the TODO keyword, the tags, and
> the category, but not the title.
> - (org-get-entry) has no useful documentation but it seems to
> return the content, not the heading.
> - (org-get-header HEADER) does something else related to mail; it
> seems to be unused and not much documented.
> - (org-get-heading t) seems to return the full line (even with
> keyword), but with properties:
>
> #("TODO Do something!" 0 4
> (org-category "test1" fontified t face org-todo)
> 4 18
> (org-category "test1" fontified t face org-level-3))
>
>
> Based on this, I did a function to remove the TODO keyword and the
> properties.
>
> (defun org-get-heading-title ()
> "Returns the heading of the current entry as a string, without the
> leading stars, the TODO keyword or the tags."
> (let (
> (title-with-props (org-get-heading t))
> (keyword (org-get-todo-state))
> )
> (substring-no-properties title-with-props (if keyword (1+ (length
> keyword))))
> )
> )
>
> Suggestions:
> - This could also be implemented as a parameter to (org-get-heading).
> - Or the title returned in (org-entry-properties)
> - And (org-get-header HEADER) could be removed.
> - In any case, such a function can be included in Org-mode so that
> it is easy to find.
>
>
> Thanks,
> Daniel
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Function to get the title of a heading
2009-01-08 22:20 ` Carsten Dominik
@ 2009-01-11 17:08 ` Daniel Clemente
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Clemente @ 2009-01-11 17:08 UTC (permalink / raw
To: Carsten Dominik; +Cc: emacs-orgmode list
Carsten Dominik <dominik@science.uva.nl> writes:
> Hi Daniel,
>
> I have added `org-heading-components'.
>
That helps, and it also makes easier other inquiries like the current headline level. Formerly I had to do (org-reduced-level (funcall outline-level)) which was not obvious.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-11 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-06 18:53 Function to get the title of a heading Daniel Clemente
2009-01-08 22:20 ` Carsten Dominik
2009-01-11 17:08 ` Daniel Clemente
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.