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 04:05:31 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>     As I understand the purpose of this feature is practically to move
>     the last expression of the command's body that usually is written as
>
>       (if (interactive-p)
>           (message "Result of this command is %.0f" return-value)
>         (format "%.0f" return-value))
>
> You have the right idea in mind for what the code would be trying to
> do.  But code like that would be a strange way to write it, and in
> practice does seem to occur much if at all.  The way I would envision
> this is more like
>
>       (if interactive-call
>           (message "Result of this command is %.0f" return-value))
>       return-value)
>
> where `interactive-call' is an argument initialized to non-nil
> for an interactive call.
>
> The job of the second arg to `interactive', that I've proposed, would
> be to control how to generate the message in the interactive case.

Then the second arg to `interactive' could be just a lambda
with one argument with the value this function returns, e.g.

(defun command ()
  (interactive
    nil
    (lambda (ret-val)
      (message "Result of this command is %.0f" ret-val)))
  ...
  (let ((return-value ...))
    ...
    return-value))

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




reply via email to

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