From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Tiny piece of customization for ctrl-c ctrl-c within a timestamp Date: Sat, 16 Oct 2010 15:58:05 -0400 Message-ID: <9500.1287259085@gamaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=57646 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7CtX-0005KM-CU for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7CtW-0008Qx-85 for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:58:19 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]:55206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7CtW-0008Ql-4M for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 15:58:18 -0400 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LAE005BWFGT9GB0@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Sat, 16 Oct 2010 14:58:05 -0500 (CDT) In-reply-to: Message from Jeff Horn of "Sat\, 16 Oct 2010 15\:43\:01 EDT." 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: Jeff Horn Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org, Marc-Oliver Ihm Jeff Horn wrote: > Very useful, since I often do the same! Thanks for this. >=20 > 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 () > > =C2=A0"Check if cursor is within a timestamp and compute weekday from n= umeric > > date" > > =C2=A0(interactive) > > =C2=A0(when (org-at-timestamp-p t) > > =C2=A0 =C2=A0(org-timestamp-change 0 'year) > > =C2=A0 =C2=A0(message "Weekday of timestamp has been adjusted.") > > =C2=A0 =C2=A0t > > =C2=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 > > My hack for this is S- S-: it advances the date up and down by 1 but has the side effect of setting the day of the week correctly. Nick