From: Bastien <bzg@gnu.org>
To: zhenjiang zech xu <zhenjiang.xu@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: headlines without timestampes
Date: Thu, 29 May 2014 18:59:34 +0200 [thread overview]
Message-ID: <877g54zfk9.fsf@bzg.ath.cx> (raw)
In-Reply-To: <CAAp=d8o0XSEx7m3J2R5Cw_ViRS1izJo58NeTS2+WpG+SQ_Cpxg@mail.gmail.com> (zhenjiang zech xu's message of "Thu, 29 May 2014 07:02:32 -0600")
Hi,
zhenjiang zech xu <zhenjiang.xu@gmail.com> writes:
> For a simple example, assuming current entry is:
>
> * [2014-05-06 Thu] this is the heading
> blahblah...
>
> I'd like to get the time string and the title "this is the heading"
> separately. Is there a canonical way to do that with org-mode APIs?
This function returns a CONS with the timestamp and the rest of the
heading:
(defun get-timestamp-and-heading ()
(interactive)
(save-excursion
(org-back-to-heading t)
(let* ((h (org-element-property :raw-value (org-element-at-point)))
(h-no-ts (replace-regexp-in-string org-ts-regexp-both "" h))
(ts (and (string-match org-ts-regexp-both h)
(match-string 0 h))))
(cons (org-trim h-no-ts) ts))))
HTH,
--
Bastien
next prev parent reply other threads:[~2014-05-29 16:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 13:02 headlines without timestampes zhenjiang zech xu
2014-05-29 16:59 ` Bastien [this message]
2014-05-29 23:38 ` zhenjiang zech xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877g54zfk9.fsf@bzg.ath.cx \
--to=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=zhenjiang.xu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.