emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Alan E. Davis" <lngndvs@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Cc: Bernt Hansen <bernt@norang.ca>, Matt Lundin <mdl@imapmail.org>,
	Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: How to add entries to an org file, not diary
Date: Tue, 10 Nov 2009 15:51:52 +1000	[thread overview]
Message-ID: <7bef1f890911092151j2cca33b9ve8e6f6e65cb6bc78@mail.gmail.com> (raw)
In-Reply-To: <4af8c885.1608c00a.50e5.0a86@mx.google.com>


[-- Attachment #1.1: Type: text/plain, Size: 3625 bytes --]

>
> At Mon, 9 Nov 2009 22:09:23 +0100,
> Carsten Dominik <carsten.dominik@gmail.com> 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

[-- Attachment #1.2: Type: text/html, Size: 4492 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-11-10  5:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06 15:16 How to add entries to an org file, not diary Stephen Eglen
2009-11-06 17:02 ` Matt Lundin
2009-11-07  7:04   ` Carsten Dominik
2009-11-06 17:21 ` Bernt Hansen
2009-11-07  7:02   ` Carsten Dominik
2009-11-07 18:28     ` Bernt Hansen
2009-11-09 21:09 ` Carsten Dominik
2009-11-09 21:39   ` Bernt Hansen
2009-11-09 21:45     ` Carsten Dominik
2009-11-10  1:57   ` Darlan Cavalcante Moreira
2009-11-10  5:51     ` Alan E. Davis [this message]
2009-11-10  7:23     ` Carsten Dominik
2009-11-10 14:28       ` Darlan Cavalcante Moreira

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bef1f890911092151j2cca33b9ve8e6f6e65cb6bc78@mail.gmail.com \
    --to=lngndvs@gmail.com \
    --cc=S.J.Eglen@damtp.cam.ac.uk \
    --cc=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).