[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help create function alias
From: |
Adam |
Subject: |
Re: help create function alias |
Date: |
Wed, 08 Dec 2010 15:29:00 -0000 |
User-agent: |
KNode/0.9.2 |
> Marc Mientki wrote:
[ ... ]
Here's the (insert-date) function. Which I now find doesn't
work when called from the changed (id) example below.
M-x id returns "Wrong type argument: stringp, nil"
Strange, as I never used M-x insert-date with any prefix-argument.
Indeed am not sure how I'd do that (to use its options).
(defun insert-date (prefix)
"Insert the current date. With prefix-argument, use ISO format. With
two prefix arguments, write out the day and month name."
(interactive "P")
(let ((format (cond
((not prefix) "%A, %d %B %Y")
((equal prefix '(4)) "%Y-%m-%d")
((equal prefix '(16)) "%A, %d. %B %Y")))
(system-time-locale "de_DE"))
(insert (format-time-string format))))
>> But actually you don't need "P" in your example. So you can write:
>>
>> (defun id ()
>> "insert date"
>> (interactive)
>> (insert-date t))
[ ... ]
Re: help create function alias, Stefan Monnier, 2010/12/08