emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] headlines without timestampes


From: Bastien
Subject: Re: [O] headlines without timestampes
Date: Thu, 29 May 2014 18:59:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi,

zhenjiang zech xu <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]