From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gnuist006@hotmail.com (gnuist006) Newsgroups: gmane.emacs.help Subject: HOW TO GIVE A DEFAULT TO A TRULY INTERACTIVE FUNCTION Date: 14 Oct 2002 09:02:20 -0700 Organization: http://groups.google.com/ Sender: help-gnu-emacs-admin@gnu.org Message-ID: NNTP-Posting-Host: localhost.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1034611575 28432 127.0.0.1 (14 Oct 2002 16:06:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 14 Oct 2002 16:06:15 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1817jS-0007OS-00 for ; Mon, 14 Oct 2002 18:06:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 1817jX-0002K5-00; Mon, 14 Oct 2002 12:06:19 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 31 Original-NNTP-Posting-Host: 209.178.176.116 Original-X-Trace: posting.google.com 1034611340 27759 127.0.0.1 (14 Oct 2002 16:02:20 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 14 Oct 2002 16:02:20 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:106045 comp.emacs:75281 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2592 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2592 (defun demo (&optional number) "Demo of an optional argument of the function." (interactive "nEnter a number:") (setq defaultval 5) (if (null number) (setq number defaultval)) (insert (format "%s" number)) ) (demo) ; works due to optional argument I want the default to work on the command line also. They say emacs is customizable. OK it is if you only want to do what it can do, and never try to do what you want to do. I want to invoke it on command line ie M-x demo It comes and says Enter a number:_ I prefer it display the default 5 in the message and there is SINGLE instance of 5 in the function. ie using defaultval. If this cannot do this and you were all lying to yourself that emacs is customizable, infinitely extensible, then I atleast want quick fix for this. When I hit RTN after it begs for number once, it go away and use defaultval and stop buggin me. At present it does not stap and keeps bugging till I enter 5. Why do I have to remember the default when I am giving it that much money?