emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tiny piece of customization for ctrl-c ctrl-c within a timestamp
@ 2010-10-16 16:34 Marc-Oliver Ihm
  2010-10-16 19:43 ` Jeff Horn
  2010-10-16 20:11 ` Sebastian Rose
  0 siblings, 2 replies; 5+ messages in thread
From: Marc-Oliver Ihm @ 2010-10-16 16:34 UTC (permalink / raw)
  To: emacs-orgmode

Hello !


I sometimes find myself adjusting timestamps just by editing its text;
e.g. changing <2010-10-16 Su> to <2011-10-16 Su>. However after that
editing, the day of week is usually wrong (or might be right, I just
dont know).

With this small piece of lisp, one just needs to press ctrl-c ctrl-c
while the cursor is in a timestamp and the day of week is adjusted.


(defun org-set-weekday-of-timestamp ()
  "Check if cursor is within a timestamp and compute weekday from numeric
date"
  (interactive)
  (when (org-at-timestamp-p t)
    (org-timestamp-change 0 'year)
    (message "Weekday of timestamp has been adjusted.")
    t
  ))

(add-hook 'org-ctrl-c-ctrl-c-hook 'org-set-weekday-of-timestamp)


Maybe someone else might find that useful too.


With kind regards, Marc-Oliver Ihm

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-17  6:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-16 16:34 Tiny piece of customization for ctrl-c ctrl-c within a timestamp Marc-Oliver Ihm
2010-10-16 19:43 ` Jeff Horn
2010-10-16 19:58   ` Nick Dokos
2010-10-17  6:31     ` Marc-Oliver Ihm
2010-10-16 20:11 ` Sebastian Rose

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).