From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Xebar Saram <zeltakc@gmail.com>
Cc: Dave Marquardt <davemarq@us.ibm.com>, org mode <emacs-orgmode@gnu.org>
Subject: Re: Auto insert and change date in header?
Date: Sat, 01 Aug 2015 12:05:12 -0400 [thread overview]
Message-ID: <m24mkj0zbb.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAOQHXPpPM_OM9ZDUoLtWkoud6qHP_Gy6Zaihs9kazXnvHXh-7g@mail.gmail.com>
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 <davemarq@us.ibm.com>
> wrote:
>
>> Xebar Saram <zeltakc@gmail.com> 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
next prev parent reply other threads:[~2015-08-01 16:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 0:30 Auto insert and change date in header? Xebar Saram
2013-07-26 20:49 ` Dave Marquardt
2015-08-01 14:45 ` Xebar Saram
2015-08-01 16:05 ` John Kitchin [this message]
2015-08-02 18:34 ` Xebar Saram
2015-08-03 0:09 ` John Kitchin
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=m24mkj0zbb.fsf@andrew.cmu.edu \
--to=jkitchin@andrew.cmu.edu \
--cc=davemarq@us.ibm.com \
--cc=emacs-orgmode@gnu.org \
--cc=zeltakc@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.