help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: help create function alias


From: Pascal J. Bourguignon
Subject: Re: help create function alias
Date: Wed, 08 Dec 2010 15:29:01 -0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Adam <nospam@example.com> writes:

>> 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))))

(defalias 'id 'insert-date)

M-x id RET     --> Monday, 20 September 2010
C-y M-x id RET --> 2010-09-20

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


reply via email to

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