From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Horn Subject: Re: Tiny piece of customization for ctrl-c ctrl-c within a timestamp Date: Sat, 16 Oct 2010 15:43:01 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=38647 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7Cf5-0000Zv-Qg for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:43:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7Cf4-0006QA-La for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:43:23 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:37693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7Cf4-0006Q6-IB for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:43:22 -0400 Received: by iwn1 with SMTP id 1so3280949iwn.0 for ; Sat, 16 Oct 2010 12:43:22 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Marc-Oliver Ihm Cc: emacs-orgmode@gnu.org Very useful, since I often do the same! Thanks for this. On Sat, Oct 16, 2010 at 12:34 PM, Marc-Oliver Ihm wrote: > 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 () > =A0"Check if cursor is within a timestamp and compute weekday from numeri= c > date" > =A0(interactive) > =A0(when (org-at-timestamp-p t) > =A0 =A0(org-timestamp-change 0 'year) > =A0 =A0(message "Weekday of timestamp has been adjusted.") > =A0 =A0t > =A0)) > > (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 > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > --=20 Jeffrey Horn Graduate Lecturer and PhD Student in Economics George Mason University (704) 271-4797 jhorn@gmu.edu jrhorn424@gmail.com http://www.failuretorefrain.com/jeff/