emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How can I calculate the "age" of a headline?


From: Thorsten Jolitz
Subject: Re: [O] How can I calculate the "age" of a headline?
Date: Tue, 19 Aug 2014 17:34:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

M <address@hidden> writes:

> In my task lists, I'm working with scheduled and deadline dates.
> However, it would also often be very interesting, how "old" a task is, how
> long it is lurking around on my lists..

I copied Bernt Hansens setup for toggling automatic insertion of
inactive timestamps at headline creation. The tj/ prefix is there only
for my convenience, it should really be bh/ (-> Bernt Hansen).

#+BEGIN_SRC emacs-lisp  
;; *** Timestamps

;; **** Configuration 

(add-hook 'org-insert-heading-hook
          'tj/insert-heading-inactive-timestamp 'append)

;; **** Functions

(defvar tj/insert-inactive-timestamp t)

(defun tj/toggle-insert-inactive-timestamp ()
  (interactive)
  (setq tj/insert-inactive-timestamp
        (not tj/insert-inactive-timestamp))
  (message "Heading timestamps are %s"
           (if tj/insert-inactive-timestamp "ON" "OFF")))

(defun tj/insert-inactive-timestamp ()
  (interactive)
  (org-insert-time-stamp nil t t nil nil nil))

(defun tj/insert-heading-inactive-timestamp ()
  (save-excursion
    (when tj/insert-inactive-timestamp
      (org-return)
      (org-cycle)
      (tj/insert-inactive-timestamp))))
#+END_SRC

-- 
cheers,
Thorsten




reply via email to

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