emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How to say "I did that yesterday?"


From: Peter Münster
Subject: Re: [O] How to say "I did that yesterday?"
Date: Tue, 22 Nov 2011 21:03:53 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (gnu/linux)

On Tue, Nov 22 2011, Dave Abrahams wrote:

> I often discover that I completed something a few days ago and I would
> like to mark it done with the appropriate date as though I had marked it
> done in the past.  That means, e.g., for a repeating event it might
> repeat sooner than if it had been done today.  Is there a way?

Not exactly what you want, but it might help. Some code for easy
modifying time stamps with C-left, C-right, M-left and M-right:

--8<---------------cut here---------------start------------->8---
(defvar pm/org-ctrlleft-hook nil
  "Hook for functions attaching themselves to `C-left'.")

(defvar pm/org-ctrlright-hook nil
  "Hook for functions attaching themselves to `C-right'.")

(defun pm/org-meta-left ()
  "Decrease the date in the time stamp by one hour."
  (when (org-at-timestamp-p) (org-timestamp-change -60 'minute) t))

(defun pm/org-meta-right ()
  "Increase the date in the time stamp by one hour."
  (when (org-at-timestamp-p) (org-timestamp-change 60 'minute) t))

(defun pm/org-ctrl-left ()
  "Decrease the date in the time stamp by one day."
  (when (org-at-timestamp-p) (org-timestamp-down-day) t))

(defun pm/org-ctrl-right ()
  "Increase the date in the time stamp by one day."
  (when (org-at-timestamp-p) (org-timestamp-up-day) t))

(defun pm/org-ctrlleft ()
  "Run the functions in `pm/org-ctrlleft-hook'."
  (interactive)
  (run-hook-with-args-until-success 'pm/org-ctrlleft-hook))

(defun pm/org-ctrlright ()
  "Run the functions in `pm/org-ctrlright-hook'."
  (interactive)
  (run-hook-with-args-until-success 'pm/org-ctrlright-hook))

(add-hook 'org-metaleft-hook     'pm/org-meta-left)
(add-hook 'org-metaright-hook    'pm/org-meta-right)
(add-hook 'pm/org-ctrlleft-hook  'pm/org-ctrl-left)
(add-hook 'pm/org-ctrlright-hook 'pm/org-ctrl-right)

(org-defkey org-mode-map [(control left)]  'pm/org-ctrlleft)
(org-defkey org-mode-map [(control right)] 'pm/org-ctrlright)
--8<---------------cut here---------------end--------------->8---

-- 
           Peter




reply via email to

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