emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Auto insert and change date in header?


From: John Kitchin
Subject: Re: [O] Auto insert and change date in header?
Date: Sat, 01 Aug 2015 12:05:12 -0400

This seems to do what you want for the changes. The timestamp is
automatically added when you make changes. It does not propagate
timestamps up though, so if you change a subheading the timestamp there
is updated, but the one in the parent for example. also, this will
update every headline.

You may need to add another (add-hook 'org-mode-hook (lambda ()
(add-to-list 'after-change-functions 'update-last-edited))) kind of line
to enable this in all org-files, the code below might be buffer local.

#+BEGIN_SRC emacs-lisp
(defun update-last-edited (beg end length)
  (when
      (and
       (not (org-before-first-heading-p))
       (org-get-heading))
    (org-entry-put nil "LAST-EDITED" (format-time-string "[%Y-%m-%d %a 
%H:%M:%S]"))))

(add-to-list 'after-change-functions 'update-last-edited)
#+END_SRC



Xebar Saram writes:

> Hi all
>
> coming back to it after 3 years :)
>
> im wondering if anyone has a hook or anything like that that auto adds a
> date when he creates a header. and maybe also auto change the date each
> time  the text under the header is changed? kind of simulating a timestamp
> type function :)
>
> best
>
> Z
>
> On Fri, Jul 26, 2013 at 11:49 PM, Dave Marquardt <address@hidden>
> wrote:
>
>> Xebar Saram <address@hidden> writes:
>>
>> > does any one know of a way to auto insert/change the date in each
>> sections
>> > header when the section is edited?IE have a date in the header showing
>> > last edited date.
>> > Is this technically possible?
>>
>> Try setting before-save-hook.  See "(elisp) Saving Buffers".
>>
>> -Dave
>>
>>
>>

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

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