From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#14254: 24.3; read-number fails to recognize faulty numbers (string-to-number to blame) Date: Tue, 07 May 2013 09:38:02 -0400 Message-ID: References: <87ehe0ayf9.fsf@gmail.com> <87bo93abt8.fsf@mail.jurta.org> <87ppxi49xd.fsf@mail.jurta.org> <877gjbgozi.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1367933954 1230 80.91.229.3 (7 May 2013 13:39:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 May 2013 13:39:14 +0000 (UTC) Cc: 14254@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 07 15:39:12 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UZi6p-0008K1-Dk for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 May 2013 15:39:12 +0200 Original-Received: from localhost ([::1]:35604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZi6p-0006mM-2e for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 May 2013 09:39:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZi6k-0006m2-Pw for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 09:39:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZi6f-00013V-7m for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 09:39:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZi6f-00013D-3C for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 09:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UZi7e-00089X-Oz for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 09:40:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 May 2013 13:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14254 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14254-submit@debbugs.gnu.org id=B14254.136793395231151 (code B ref 14254); Tue, 07 May 2013 13:40:02 +0000 Original-Received: (at 14254) by debbugs.gnu.org; 7 May 2013 13:39:12 +0000 Original-Received: from localhost ([127.0.0.1]:60833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZi6p-00086L-LU for submit@debbugs.gnu.org; Tue, 07 May 2013 09:39:12 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:18429) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZi6m-00086A-UU for 14254@debbugs.gnu.org; Tue, 07 May 2013 09:39:09 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GsR+QDo0fg2sDklqSIIFegxOBUw X-IPAS-Result: Av4EABK/CFG4rwb8/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GsR+QDo0fg2sDklqSIIFegxOBUw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="11457594" Original-Received: from 184-175-6-252.dsl.teksavvy.com (HELO pastel.home) ([184.175.6.252]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 07 May 2013 09:38:00 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 0C83067A76; Tue, 7 May 2013 09:38:03 -0400 (EDT) In-Reply-To: <877gjbgozi.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 07 May 2013 11:42:41 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74049 Archived-At: > I should have mentioned that original code contained the line > visargs[i] = args[i]; > but I omitted it in the change since it has no effect > because this code at the end of `Fcall_interactively' > for (i = 1; i < nargs; i++) > { > if (varies[i] > 0) > visargs[i] = Fcons (intern (callint_argfuns[varies[i]]), Qnil); > else > visargs[i] = quotify_arg (args[i]); > } Here's what's going on: visargs is used in two different ways, just in order to avoid allocating a third array: - inside the loop, visargs keeps a representation of the arguments, which is used when the prompt of an argument contains a % (in which case it's passed to `format'). This is a rarely used feature which can be seen in: % grep '(interactive ".*%' lisp/**/*.el lisp/abbrev.el: (interactive "sDefine global abbrev: \nsExpansion for %s: ") lisp/abbrev.el: (interactive "sDefine mode abbrev: \nsExpansion for %s: ") lisp/dired-x.el: (interactive "FRelSymLink: \nFRelSymLink %s: \np") lisp/mail/mailabbrev.el: (interactive "sDefine mail alias: \nsDefine %s as mail alias for: ") lisp/mail/mailalias.el: (interactive "sDefine mail alias: \nsDefine %s as mail alias for: ") lisp/net/ange-ftp.el: (interactive "fCopy file: \nFCopy %s to file: \np") lisp/net/ange-ftp.el: (interactive "fRename file: \nFRename %s to file: \np") lisp/subr.el: (interactive "KSet key globally: \nCSet key %s to command: ") lisp/subr.el: (interactive "KSet key locally: \nCSet key %s locally to command: ") % This is the reason why it's called "visargs" because it contains a representation of the argument which should be appropriate for display (e.g. it keeps a key-description instead of a key). FWIW, I think this is a misfeature. Better force people to use a Lisp form for the interactive spec when they need access to previous args while building subsequent args. - after the loop, this is not needed any more, but the same array is reused to build the arguments to pass to `Flist' to make the entry to add in command-history. > I don't understand why `Fcall_interactively' contains many lines of > such useless code as > visargs[i] = last_minibuf_string; > If the intention was to collect strings in `visargs' and use them later > then old code for numbers (currently still useless) was wrong, > it should convert numbers to strings with something like > visargs[i] = Fnumber_to_string(args[i]); I don't understand all those "visargs[i] = last_minibuf_string;" either, because visargs doesn't need to contain only strings, since format's %s will handle non-strings. Stefan