From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "FKtPp@Office ;)" Newsgroups: gmane.emacs.help Subject: Re: [elisp]How to ask and provide a Default value? Date: Fri, 05 Mar 2004 09:02:04 +0800 Organization: Bentium Ltd. (CN99) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <40475137.5080409@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1078746713 965 80.91.224.253 (8 Mar 2004 11:51:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Mar 2004 11:51:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 08 12:51:43 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B0JIM-0005j8-00 for ; Mon, 08 Mar 2004 12:51:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B0JGh-0006Dg-Pk for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Mar 2004 06:49:59 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.cn99.com!news.yaako.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: 61.55.97.79 Original-X-Trace: news.yaako.com 1078448548 26290 61.55.97.79 (5 Mar 2004 01:02:28 GMT) Original-X-Complaints-To: usenet@news.yaako.com Original-NNTP-Posting-Date: Fri, 5 Mar 2004 01:02:28 +0000 (UTC) User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:OxSqOev3jstMeF6P8OBk7hA3PxA= Original-Xref: shelby.stanford.edu gnu.emacs.help:121477 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:17463 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17463 Kevin Rodgers writes: [...] > > (defun foo (number) > (interactive "nNumber: ") > (message "number=%d" number)) > > When I type `M-x foo RET RET' on Emacs 19.34, I get an "End of file > during parsing" error. When I type that on Emacs 21.3, I get a > transient "Please enter a number." Message, then the prompt is > redisplayed. Thank you. I got it too :) > So evidently Emacs does not provide a default for the `n' character > code. But, I still don't know how to use the default character description :P Would u please give me a sample? > > > > (let ((step-number (if (numberp step) > > step > > (string-to-number step))) > > (base-number (if (numberp base) > > base > > (string-to-number base))) > > (column-number (if (numberp column) > > column > > (string-to-number column)))) > > You are confused here: the `n' characters codes in the interactive form > will cause base, step, and column to be bound to numbers, not strings. > > > (save-excursion > > (narrow-to-region beginning end) > > (goto-char (point-min)) > > (beginning-of-line) > > (while (< (point) (point-max)) > > (goto-char (+ (point) column-number)) > > (insert (number-to-string base-number)) > > (setq base-number (+ base-number step-number)) > > (forward-line)) > > (widen)))) > > When the save-excursion form returns, it will restore the previous > narrowing (if any), so you should not explicitly call widen there. And thank u again. I will take ur advise :P