emacs-devel
[Top][All Lists]
Advanced

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

Re: Shift selection using interactive spec


From: Juri Linkov
Subject: Re: Shift selection using interactive spec
Date: Sun, 30 Mar 2008 21:33:33 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> Then the second arg to `interactive' could be just a lambda
>> with one argument with the value this function returns, e.g.
>
> Yes, and if the use of `lambda' turns out to be a bit heavy, we can
> provide a handy alternative: if the return-spec is a list but not
> a function, then take the list as a function call with a missing argument:
>
>    (defun command ()
>      (interactive
>        nil
>        (lambda (ret-val)
>          (message "Result of this command is %.0f" ret-val)))
>      ...
>      (let ((return-value ...))
>        ...
>        return-value))
>
> =>
>
>    (defun command ()
>      (interactive
>        nil
>        (message "Result of this command is %.0f"))
>      ...
>      (let ((return-value ...))
>        ...
>        return-value))

And then another simplest alternative we could provide is t when the
return value should be displayed with just `(message "%s" ret-val)':

   (defun command ()
     (interactive
       nil
       t)
     ...
     (let ((return-value ...))
       ...
       return-value))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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