From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: How to add entries to an org file, not diary Date: Mon, 09 Nov 2009 16:39:37 -0500 Message-ID: <871vk7fkdi.fsf@gollum.intra.norang.ca> References: <31568.1257520584@maps> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7bxn-0006RP-KP for emacs-orgmode@gnu.org; Mon, 09 Nov 2009 16:39:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7bxk-0006Kq-9y for emacs-orgmode@gnu.org; Mon, 09 Nov 2009 16:39:51 -0500 Received: from [199.232.76.173] (port=59341 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7bxk-0006KS-2v for emacs-orgmode@gnu.org; Mon, 09 Nov 2009 16:39:48 -0500 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:53007) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N7bxj-00039w-IC for emacs-orgmode@gnu.org; Mon, 09 Nov 2009 16:39:47 -0500 In-Reply-To: (Carsten Dominik's message of "Mon\, 9 Nov 2009 22\:09\:23 +0100") 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: Carsten Dominik Cc: Org Mode , Matt Lundin , Stephen Eglen Carsten Dominik writes: > Hi Stephen, > > On Nov 6, 2009, at 4:16 PM, Stephen Eglen wrote: > >> Dear all, >> If I'm visting an agenda (C-c a a) buffer, and want to add a diary >> entry >> for a particular day, I can use org-agenda-diary-entry, bound to 'i'. >> This inserts an entry in my diary file. >> >> What I'd like to do is add the entry instead to an org file, >> e.g. 'agenda.org' where I currently store all diary-like entries. Is >> that functionality available? (Am trying to wean myself off diary >> files, after many years of using it...) > > If you get the latest Org version from the git server, you can > configure the variable `org-agenda-diary-file' to point to your > "diary.org" file or any other Org-mode file. This should be a > file dedicated for general appointments, anniversaries > etc. > > Then `i' in the agenda will create new entries in that file. > Simple entries (day and block) will be placed into an outline > tree that is based on dates: Top-level years, level 2 months, > level 3 days[1]. I have always wanted to have something > like this, so that it will be easy to archive old stuff! So thanks > for giving me a reason to finally make it. > > Right now I have implemented > > i d for day entries, > i b for blocks, > i a for anniversaries (which will be collected under a special > heading "Anniversaries" in your `diary.org' > i j To jump to the cursor date in the date tree > > What else would be useful? > > The same command will also be bound to the `i' key in the > calendar (calendar restart required), so you can make the same > kind of entries from the calendar - very convenient at times, > in particular for long blocks. > > The basics of these new commands seem to work OK, but it > is quite possible that I have not yet thought this through > fully. Let me know what I am missing, so that we can tweak it. This is really cool! :) Thanks for implementing the block dates! I just tried it with anniversaries and get the following error GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of 2008-11-09 on raven, modified by Debian Org-mode version 6.32trans (release_6.32b.142.g01b1) My version of org-mode has the clocking commit reverted Debugger entered--Lisp error: (void-function diary-date-display-form) (diary-date-display-form) (let ((calendar-date-display-form ...)) (insert (format "%%%%(diary-anniversary %s) %s" ... text))) (cond ((eq type ...) (or ... ...) (outline-next-heading) (org-back-over-empty-lines) (backward-char 1) (insert "\n") (let ... ...)) ((eq type ...) (require ...) (org-datetree-find-date-create d1) (org-agenda-insert-diary-make-new-entry text) (org-insert-time-stamp ...) (end-of-line 0)) ((eq type ...) (if ... ...) (require ...) (org-datetree-find-date-create d1) (org-agenda-insert-diary-make-new-entry text) (org-insert-time-stamp ...) (insert "--") (org-insert-time-stamp ...) (end-of-line 0))) (let ((cw ...)) (org-switch-to-buffer-other-window (find-file-noselect org-agenda-diary-file)) (widen) (goto-char (point-min)) (cond (... ... ... ... ... ... ...) (... ... ... ... ... ...) (... ... ... ... ... ... ... ... ...)) (if (string-match "\\S-" text) (progn ... ...) (message "Please finish entry here"))) org-agenda-add-entry-to-org-agenda-diary-file(anniversary "foobar" (10 13 2009)) (cond ((equal char 100) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1)) ((equal char 97) (setq d1 ...) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1)) ((equal char 98) (setq text ...) (org-agenda-add-entry-to-org-agenda-diary-file ... text d1 d2)) ((equal char 106) (org-switch-to-buffer-other-window ...) (org-datetree-find-date-create d1) (org-reveal t)) (t (error "Invalid selection character `%c'" char))) (let (d1 d2 char (text "")) (if (equal ... "*Calendar*") (setq d1 ... d2 ...) (setq d1 ... d2 ...)) (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") (setq char (read-char-exclusive)) (cond (... ... ...) (... ... ... ...) (... ... ...) (... ... ... ...) (t ...))) org-agenda-diary-entry-in-org-file() (if (not (eq org-agenda-diary-file ...)) (org-agenda-diary-entry-in-org-file) (require (quote diary-lib)) (let* (... ... ... ... ...) (unless cmd ...) (unless ... ...) (let ... ...))) org-agenda-diary-entry() call-interactively(org-agenda-diary-entry) -Bernt