From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Function to get the title of a heading Date: Thu, 8 Jan 2009 23:20:30 +0100 Message-ID: <293B6330-1B33-4B70-B368-72A08175221F@uva.nl> References: <871vvgs1un.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LL3Ez-00059K-IR for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 17:20:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LL3Ex-00057W-0a for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 17:20:36 -0500 Received: from [199.232.76.173] (port=36733 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LL3Ew-00057T-U3 for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 17:20:34 -0500 Received: from ug-out-1314.google.com ([66.249.92.170]:55299) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LL3Ew-0007XZ-H6 for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 17:20:34 -0500 Received: by ug-out-1314.google.com with SMTP id 36so2427518uga.17 for ; Thu, 08 Jan 2009 14:20:33 -0800 (PST) In-Reply-To: <871vvgs1un.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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