emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] How to add entries to an org file, not diary


From: Alan E. Davis
Subject: Re: [Orgmode] How to add entries to an org file, not diary
Date: Tue, 10 Nov 2009 15:51:52 +1000

At Mon, 9 Nov 2009 22:09:23 +0100,
Carsten Dominik <address@hidden> wrote:

> 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?
 
Thank you for this:

I don't remember how this came to pass.  I think after writing email to Ed Reingold, author of the various emacs calendar tools, and eventually, this came about.  I've thought ever since, that it needed polishing, but I used it innumerable times over the years.  Perhaps this would be useful for what you are implementing, or something like it.  I'd like to have it.  This was certainly  done up by Ed Reingold originally, but I've lost track (it was in the pre-org-mode time).

The polishing part comes from the inconvenience of typing individually the numbers of days ahead of time one wanted to be reminded.  I don't know how to make it better.  Maybe org-agenda already does this pretty well.  Out of laziness, I used to type something like this, for numbers of days to remind: "30 27 25 22 20 17 14 12 9 7 5 4 3 2 1".  Possibly a hard-coded sequence would be just as good, and it could skip weekends, or other inconvenient days, be sure to hit fridays, or whatever.

Possibly this is all redundant in the context of org-mode.  I guess it is, but I'll send it along anyway.

Anyway, here it is.  I have it bound to "i e" in the calendar map.


;;;;;;;;;;;;;;;Begin "diary-insert-event-with-reminder";;;;;;;;;;;;;;;;;;;;;;;8<;;;;;;;;;;;;;;
;; Trivially, this function is covered by the GPL.  It "borrows liberally" (TM)
;; from the diary-lib package of Ed Reingold. 
;; Alan Davis   15 May 1998.  Saipan, NMI.
;;
;; When  invoked,  this function prompts for  a string of numbers
;; representing the number of days in advance you would like to be
;; reminded.  Enter a sequence of numbers, like '1 2 3 4 7 8 20'.
;; Subsequently, the function will query for a description of the event. 
;; You may optionally type a description of the event; whether or not
;; you do not do so, after you type <ENTER>,  will find yourself in
;; your .diary file at the newly inserted line.
;;
;; You may wish to place the following line in your .emacs:
;;  (require 'diary-insert-event-with-reminder)

(defun diary-insert-event-with-reminder (daylist event arg)
  "Insert a unique event, on a single date as given by point.  A
prefix arg will make the entry nonmarking.  When invoked, this
function will interactively ask for the number of days in advance that
you'd like to be reminded, and a name for the event."
  (interactive "sDays in advance to remind: \nsWhat's the event? \nP")
  (require 'diary-lib)
  (let* ((calendar-date-display-form
      (if european-calendar-style
          '(day " " month " " year)
        '(month " " day " " year))))
    (make-diary-entry
     (format "%s(diary-remind '(diary-date %s) '(%s)) %s"
         sexp-diary-entry-symbol
         (calendar-date-string (calendar-cursor-to-date t) nil t) daylist event)
     arg)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;END;;;;;;;;;;;;;;;;>8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

To bind to keys "ie" in calendar-mode-map:

(setq calendar-load-hook
     '(lambda ()
        ;; Keybinding
        (define-key calendar-mode-map
          "ie"
          'diary-insert-event-with-reminder)
))
;;;;;;;;;;;;;;;

I haven't gotten my feet wet with this new implementation, but will be doing so,  I'm not sure how this would fit in with what you have implemented.

Alan Davis



reply via email to

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