From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julian Burgos Subject: Automatically insert inactive timestamps Date: Wed, 8 Dec 2010 00:24:33 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0536428223==" Return-path: Received: from [140.186.70.92] (port=57310 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQ7pl-00041K-62 for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 19:24:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQ7pj-0000Yg-KE for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 19:24:37 -0500 Received: from mail-qw0-f41.google.com ([209.85.216.41]:56558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQ7pj-0000Yc-HJ for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 19:24:35 -0500 Received: by qwa26 with SMTP id 26so542483qwa.0 for ; Tue, 07 Dec 2010 16:24:33 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============0536428223== Content-Type: multipart/alternative; boundary=0016363b8df23f33830496db25ea --0016363b8df23f33830496db25ea Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear list, This is the newbie question of the day. I would like to get an inactive time stamp automatically in each new entry in org mode. Could somebody explain me how to do this? Many thanks, Julian --=20 Julian Mariano Burgos Hafranns=F3knastofnunin/Marine Research Institute Sk=FAlagata 4, 121 Reykjav=EDk, Iceland S=EDmi/Telephone : +354-5752037 Br=E9fs=EDmi/Telefax: +354-5752001 Netfang/Email: julian@hafro.is, jmburgos@uw.edu --0016363b8df23f33830496db25ea Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear list,

This is the newbie question of the day.=A0 I would like t= o get an inactive time stamp automatically in each new entry in org mode. C= ould somebody explain me how to do this?

Many thanks,

Julian<= br clear=3D"all">
--
Julian Mariano Burgos
Hafranns=F3knastofnunin/Marine Research= Institute
Sk=FAlagata 4, 121 Reykjav=EDk, Iceland
S=EDmi/Telephone := +354-5752037
Br=E9fs=EDmi/Telefax:=A0 +354-5752001
Netfang/Email: julian@hafro.is, jmburgos@uw.edu
--0016363b8df23f33830496db25ea-- --===============0536428223== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0536428223==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Re: Automatically insert inactive timestamps Date: Tue, 7 Dec 2010 20:06:36 -0600 Message-ID: <20101208020636.GX5515@x201> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=48153 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQ9Qq-0005vD-P7 for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 21:07:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQ9Qp-0003wc-Ct for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 21:07:00 -0500 Received: from jack.asmallorange.com ([74.52.119.82]:58538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQ9Qp-0003vG-9w for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 21:06:59 -0500 Received: from 206.180.155.43.adsl.hal-pc.org ([206.180.155.43] helo=localhost) by jack.asmallorange.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1PQ9Qj-0001yt-CS for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 21:06:53 -0500 Content-Disposition: inline In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Wed, Dec 08, 2010 at 12:24:33AM +0000, Julian Burgos wrote: > Dear list, > > This is the newbie question of the day. I would like to get an inactive > time stamp automatically in each new entry in org mode. Could somebody > explain me how to do this? > > Many thanks, > > Julian If you are using org-capture, you can include a timestamp with %U. Alternatively, I don't know about "automatically", but I use a one-touch timestamp via F9 with the following in my .emacs file. Every time I switch tasks I hit F9.... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Insert immediate timestamp (setq org-agenda-skip-additional-timestamps nil) (define-key global-map (kbd "") '(lambda () (interactive) (when (eq major-mode 'org-mode) (org-insert-time-stamp nil t t) (insert "\n")))) Good luck. ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: Automatically insert inactive timestamps Date: Tue, 07 Dec 2010 22:01:09 -0500 Message-ID: <87y681nf2i.fsf@norang.ca> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=58430 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQAHS-0001xf-Lw for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 22:01:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQAHR-0004eh-0I for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 22:01:22 -0500 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:53726) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQAHQ-0004ct-UL for emacs-orgmode@gnu.org; Tue, 07 Dec 2010 22:01:20 -0500 In-Reply-To: (Julian Burgos's message of "Wed, 8 Dec 2010 00:24:33 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Julian Burgos Cc: emacs-orgmode@gnu.org Julian Burgos writes: > This is the newbie question of the day.=C2=A0 I would like to get an inac= tive time stamp automatically in each new > entry in org mode. Could somebody explain me how to do this? Hi Julian, Here is what I use in my setup: Creating new headlines insert inactive timestamps automatically: --8<---------------cut here---------------start------------->8--- (defun bh/insert-inactive-timestamp () (interactive) (org-insert-time-stamp nil t t nil nil nil)) (defun bh/insert-heading-inactive-timestamp () (save-excursion (org-return) (org-cycle) (bh/insert-inactive-timestamp))) (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) --8<---------------cut here---------------end--------------->8--- Manually add an inactive timestamp anywhere with f9-t --8<---------------cut here---------------start------------->8--- (global-set-key (kbd " t") 'bh/insert-inactive-timestamp) --8<---------------cut here---------------end--------------->8--- and my Capture templates insert inactive timestamps when capture tasks are created (using %U) --8<---------------cut here---------------start------------->8--- (setq org-capture-templates (quote (("t" "todo" entry (file "~/git/org/refi= le.org") "* TODO %? %U %a" :clock-in t :clock-resume t)))) --8<---------------cut here---------------end--------------->8--- HTH, Bernt From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andrew J. Korty" Subject: Re: Re: Automatically insert inactive timestamps Date: Wed, 08 Dec 2010 07:53:08 -0500 Message-ID: <83884.1291812788@iu.edu> References: <87y681nf2i.fsf@norang.ca> Content-Type: text/plain; charset=utf-8; format=flowed Return-path: Received: from [140.186.70.92] (port=34355 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQJWE-0006sz-43 for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 07:53:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQJWC-0003gU-IN for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 07:53:13 -0500 Received: from locrian.itso.iu.edu ([149.166.143.64]:61611 helo=locrian.uiso.iu.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQJWC-0003eP-FO for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 07:53:12 -0500 Received: from iu.edu (149-166-143-228.dhcp-in.iupui.edu [149.166.143.228]) by locrian.uiso.iu.edu (Postfix) with ESMTPA id 5B72F2A9AB5 for ; Wed, 8 Dec 2010 07:53:09 -0500 (EST) In-reply-to: <87y681nf2i.fsf@norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bernt Hansen wrote: > (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) Using org-insert-heading-hook is more elegant than my way, but I only want timestamps on TODO entries, so I use #+begin_src emacs-lisp (defadvice org-insert-todo-heading (after ajk/org-time-stamp-new-headline activate compile) (let ((previous-location (point))) ; not sure why save-excursion doesn't work (org-insert-time-stamp (current-time) t t (concat "\n " (make-string (org-current-level) ? ))) (goto-char previous-location))) #+end_src Here's my vote for a new hook, org-insert-todo-heading-hook. :-) ajk From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: Automatically insert inactive timestamps Date: Wed, 08 Dec 2010 10:10:14 -0500 Message-ID: <12555.1291821014@gamaville.dokosmarshall.org> References: <87y681nf2i.fsf@norang.ca> <83884.1291812788@iu.edu> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=39014 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQLf8-0004Z7-Nm for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 10:10:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQLf6-0006JW-RS for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 10:10:34 -0500 Received: from vms173019pub.verizon.net ([206.46.173.19]:52116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQLf6-0006J6-Lk for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 10:10:32 -0500 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173019.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LD400G5J7H2JW80@vms173019.mailsrvcs.net> for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 09:10:15 -0600 (CST) In-reply-to: Message from "Andrew J. Korty" of "Wed, 08 Dec 2010 07:53:08 EST." <83884.1291812788@iu.edu> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Andrew J. Korty" Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Andrew J. Korty wrote: > Bernt Hansen wrote: > > > (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) > > Using org-insert-heading-hook is more elegant than my way, but I only > want timestamps on TODO entries, so I use > I think you should be able to use org-entry-get in the hook to get the TODO property of the entry and then conditionally add the timestamp - something like this: (if (equal (org-entry-get (point) "TODO") "TODO") add the timestamp Nick From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Automatically insert inactive timestamps Date: Wed, 08 Dec 2010 12:42:22 -0500 Message-ID: <877hfkxitd.fsf@fastmail.fm> References: <87y681nf2i.fsf@norang.ca> <83884.1291812788@iu.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=36818 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQO27-0001wI-08 for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:42:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQO25-0004Ma-Hb for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:42:26 -0500 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:47486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQO25-0004M8-Fj for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:42:25 -0500 In-Reply-To: <83884.1291812788@iu.edu> (Andrew J. Korty's message of "Wed, 08 Dec 2010 07:53:08 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Andrew J. Korty" Cc: emacs-orgmode@gnu.org "Andrew J. Korty" writes: > Bernt Hansen wrote: > >> (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) > > Using org-insert-heading-hook is more elegant than my way, but I only > want timestamps on TODO entries, so I use > > #+begin_src emacs-lisp > (defadvice org-insert-todo-heading (after ajk/org-time-stamp-new-headline activate > compile) > (let ((previous-location (point))) ; not sure why save-excursion doesn't work > (org-insert-time-stamp (current-time) t t > (concat "\n " (make-string (org-current-level) ? ))) > (goto-char previous-location))) > #+end_src > > Here's my vote for a new hook, org-insert-todo-heading-hook. :-) > FWIW, I use the todo state hook to insert an inactive timestamp when changing to an active todo state (provided a timestamp doesn't already exist): --8<---------------cut here---------------start------------->8--- (defun my-org-todo-insert-timestamp () "Insert an inactive timestamp if none exists." (when (string-match (regexp-opt (append my-org-next-actions my-org-projects)) state) (let ((ts (org-entry-get nil "TIMESTAMP_IA"))) (unless ts (save-excursion (org-back-to-heading) (org-show-entry) (next-line 1) (unless (or (looking-at (concat "\\s-+" org-deadline-time-regexp)) (looking-at (concat "\\s-+" org-scheduled-time-regexp))) (previous-line 1)) (end-of-line) (org-insert-time-stamp (current-time) t t "\n") (indent-for-tab-command)))))) ;; Add a time stamp to the entry if an active todo state is added ;; and there is no timestamp (add-hook 'org-after-todo-state-change-hook 'my-org-todo-insert-timestamp) --8<---------------cut here---------------end--------------->8--- Then to use this hook when calling org-insert-todo-heading, I set the following: (setq org-treat-insert-todo-heading-as-state-change t) Best, Matt From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Andrew J. Korty" Subject: Re: Re: Automatically insert inactive timestamps Date: Wed, 08 Dec 2010 12:25:40 -0500 Message-ID: <87687.1291829140@iu.edu> References: <87y681nf2i.fsf@norang.ca> <83884.1291812788@iu.edu> <12555.1291821014@gamaville.dokosmarshall.org> Content-Type: text/plain; charset=utf-8; format=flowed Return-path: Received: from [140.186.70.92] (port=48335 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQNlw-0001M3-An for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:25:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQNlt-0007La-TW for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:25:44 -0500 Received: from locrian.itso.iu.edu ([149.166.143.64]:62187 helo=locrian.uiso.iu.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQNlt-0007LC-M1 for emacs-orgmode@gnu.org; Wed, 08 Dec 2010 12:25:41 -0500 Received: from iu.edu (149-166-143-228.dhcp-in.iupui.edu [149.166.143.228]) by locrian.uiso.iu.edu (Postfix) with ESMTPA id B039B2A9BDC for ; Wed, 8 Dec 2010 12:25:40 -0500 (EST) In-reply-to: <12555.1291821014@gamaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos wrote: > Andrew J. Korty wrote: > > > Bernt Hansen wrote: > > > > > (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) > > > > Using org-insert-heading-hook is more elegant than my way, but I only > > want timestamps on TODO entries, so I use > > > > I think you should be able to use org-entry-get in the hook to get the > TODO property of the entry and then conditionally add the timestamp - > something like this: > > (if (equal (org-entry-get (point) "TODO") "TODO") > add the timestamp Iirc, the problem is that the entry doesn't yet have a todo keyword at the time the hook is run. ajk