emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: Tiny piece of customization for ctrl-c ctrl-c within a tim


From: Marc-Oliver Ihm
Subject: [Orgmode] Re: Tiny piece of customization for ctrl-c ctrl-c within a timestamp
Date: Sun, 17 Oct 2010 08:31:27 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.9) Gecko/20100317 SUSE/3.0.4-1.1.1 Thunderbird/3.0.4

Am 16.10.2010 21:58, schrieb Nick Dokos:
> Jeff Horn <address@hidden> wrote:
> 
>> Very useful, since I often do the same! Thanks for this.
>>
>> On Sat, Oct 16, 2010 at 12:34 PM, Marc-Oliver Ihm <address@hidden> 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 ()
>>>  "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
>>>
> 
> My hack for this is S-<right> S-<left>: it advances the date up and down
> by 1 but has the side effect of setting the day of the week correctly.
> 
> Nick
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 

S-<right> S-<left> is nearly as short, and I did not think about it :-)
The only remaining advantage of my hack (besides the apparent
disadvantage of needing explicit customization) is, that it increases
the dwimity of ctrl-c ctrl-c ...

Thanx and kind regards, Marc-Oliver Ihm




reply via email to

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