On Thursday, July 28, 2011, Deniz Dogan <deniz@dogan.se> wrote: > I have a command like this: > > (defun ftip-rate-movie (rating) > (interactive > (list
> (if (not ftip-movie-id) > (error "Not viewing movie") > (completing-read "Rating: " '("1" "2" "3" "4" "5" "Remove rating") nil t))))
> (unless ftip-movie-id > (error "Not viewing movie")) > > ;; ...code here > ) > > Is there any more intelligent way to do this? I'm not too keen on the code duplication.
> > Thanks, > Deniz
You could have it pass in nil interactively, and do the completing-read if rating is nil after you check ftip-movie-id. Or have it pass in some other value if you want to distinguish between an interactive call and a lisp call that actually passed in nil.