From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: how to speed up Lisp devel time Date: Fri, 09 Aug 2024 20:54:05 +0300 Message-ID: <864j7tlgzm.fsf@gnu.org> References: <87y156413v.fsf@dataswamp.org> <86sevekvjy.fsf@gnu.org> <87v80a402y.fsf@dataswamp.org> <86ikwakmdg.fsf@gnu.org> <87frre3pxa.fsf@dataswamp.org> <86ed6xlx9r.fsf@gnu.org> <87a5hl4x9b.fsf@dataswamp.org> <86bk21lp53.fsf@gnu.org> <871q2x4ra3.fsf@dataswamp.org> <87wmkp3c53.fsf@dataswamp.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35717"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Emanuel Berg Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 09 19:55:14 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1scTpY-00092d-Gw for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Aug 2024 19:55:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1scToa-0005sG-Im; Fri, 09 Aug 2024 13:54:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scToY-0005s5-GT for emacs-devel@gnu.org; Fri, 09 Aug 2024 13:54:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scToX-00054i-9D; Fri, 09 Aug 2024 13:54:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TOD+tbliLCrqBDiPgfb8Ji1opTVYWbd0eqz6xDJdVpE=; b=W3FjTrLH6fCF J3r4805upM55uUjtMF1nAMNWd+BEZfdo87/+9UoScgjVXvAYD/qwacvT/ypTsKxplBJ0RerMzVNZY y8IPgLtJDo9vdUF3z866rdtOCGRFQJ2b99cM0VorKEsDJbJq4HVD9vLQYkTYPgNmZ3mY4v6AEwszW +QPdLPrt8SGRRCZpHQkzcA54lvv8Wn/wuHwlCzi3YMAMZDjskma0fInh51X0VZYFEGLCQJxcq5nFA Lwn9mzG1pemSMNfeOjD+saJmhiXhULi8iwa/ZXYsw/e6fehyyY+Up6fbhXDej4tRinVD36h5xBZTj +CUSiOn3o4tUwg6nifFY/g==; In-Reply-To: <87wmkp3c53.fsf@dataswamp.org> (message from Emanuel Berg on Fri, 09 Aug 2024 18:16:08 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322585 Archived-At: > From: Emanuel Berg > Date: Fri, 09 Aug 2024 18:16:08 +0200 > > >> These all are handled by the 'p' interactive code. So all > >> you need is this: > >> > >> (interactive "p") > > > > Okay, that is some improvement at last. > > I spoke to soon. That is not the same as > > (interactive (if (numberp current-prefix-arg) > (list current-prefix-arg) > current-prefix-arg)) If you need to support a numeric optional argument, "p" is all you need. Anything else is redundant over-engineering at best. > That, (interactive "p"), is the same as sending 1 on M-x, but > here we want it to be the default behavior. Since nothing is > stated explicitely. > > M-x should be default, just as (function-name) should > be default. > > But it should be possible to do C-u 1 M-x to set 'end' to 1. It makes no sense to have "M-x" do something different from "C-u 1 M-x", when the argument says how many times to do some job. This is why in Emacs we use this convention consistently in all the commands. You are free to use other conventions in your code, but that's not how Emacs commands work, and we require any command to adhere to that convention. When you want to allow the user to specify more than a single argument to a command, things usually become much more complicated, so it is best to avoid such commands. If you must do that, a separate prompt for each argument is better than tricky conventions regarding the value of prefix arg.