From: "Piotr Zielinski" <piotr.zielinski@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Calendar hack: take the default date from clipboard
Date: Fri, 29 Sep 2006 00:32:00 +0200 [thread overview]
Message-ID: <3c12eb8d0609281532n63301603s5b90bde6dc3943c7@mail.gmail.com> (raw)
Hi all,
When adding a timestamp, org-mode proposes the current date. This
hack makes it look at the contents of the clipboard, and if it
contains a valid date, org-mode proposes that date instead. This
comes useful, when you copy a deadline from another application, for
example, a web browser.
(setq parse-time-months '(("jan" . 1) ("feb" . 2) ("mar" . 3)
("apr" . 4) ("may" . 5) ("jun" . 6)
("jul" . 7) ("aug" . 8) ("sep" . 9)
("oct" . 10) ("nov" . 11) ("dec" . 12)
("january" . 1) ("february" . 2) ("march" . 3)
("april" . 4) ("may" . 5) ("june" . 6)
("july" . 7) ("august" . 8) ("september" . 9)
("october" . 10) ("november" . 11) ("december" . 12)))
(defadvice org-read-date (around local-org-read-date activate)
(let ((local-ct
(let ((clipboard-time
(parse-time-string (current-kill 0))))
(if (nth 3 clipboard-time) ; if day is not nil
(apply 'encode-time
(mapcar (lambda(x) (or x 0)) clipboard-time))
(org-current-time)))))
(flet ((org-current-time () local-ct))
ad-do-it)))
Test and enjoy.
Piotr
--
Piotr Zielinski, Research Associate
Cavendish Laboratory, University of Cambridge, UK
http://www.cl.cam.ac.uk/~pz215/
reply other threads:[~2006-09-28 22:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3c12eb8d0609281532n63301603s5b90bde6dc3943c7@mail.gmail.com \
--to=piotr.zielinski@gmail.com \
--cc=emacs-orgmode@gnu.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).