[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: If clause depending on name of the day
From: |
Sven Bretfeld |
Subject: |
Re: If clause depending on name of the day |
Date: |
3 Apr 2012 22:58:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Dear all
"Pascal J. Bourguignon" <pjb@informatimago.com> writes:
> "Sven Bretfeld" <sven.bretfeld@gmx.ch> writes:
>
>> Is it possible to have an if-condition that looks for the current day?
>> So that the then-expression does something different on Tuesday than on
>> Friday?
>>
>> This is not working:
>>
>> (if (string-equal 'current-time-string ".*Tue.*")
>> (delete-other-windows)
>> (split-window-horizontally))
>
> What Lars said.
> Otherwise you would have wanted:
>
> (require 'cl)
>
> (search "Tue" (current-time-string)) ; search a substring
>
> or:
>
> (string-match "Tue" (current-time-string)) ; search a regexp.
This is working just as I wanted it to. Thank you very much.
>> p.s. unnecessary to mention that I have only a weak knowledge of elisp.
>
> An Introduction to Programming in Emacs Lisp
> http://www.gnu.org/software/emacs/emacs-lisp-intro/
> (for non-programmers)
Bookmarked for later reading. Thanks.
Sven