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 10:24:49 +0300 Message-ID: <86sevekvjy.fsf@gnu.org> References: <87y156413v.fsf@dataswamp.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20562"; 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 09:25:11 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 1scJzr-000591-4g for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Aug 2024 09:25:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1scJzZ-0002HC-Vv; Fri, 09 Aug 2024 03:24:54 -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 1scJzY-0002Gm-Cl for emacs-devel@gnu.org; Fri, 09 Aug 2024 03:24:52 -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 1scJzX-0000Gf-B7; Fri, 09 Aug 2024 03:24:51 -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=rpnWyygtNIKX0SsSFsMuxyuL+ZCVXHHEEpTuYr2+QG4=; b=Ve3fu28kLceQ 83K+4Hecu3nesu/rHqYji4r+TJ2UWYJI1GcjaN0UpgrJelmGOS2UpDG8nmYyOx3NVukWuSfafuMur vO5l/m8+vEVnaWbM4bW+w+v+HNTDZTF9COrn1bViGm2U+liY5XUtHhjOvZXJE0779GezgmdkgQ5+X kB3fmSL+D5TjpkQ0T1V+hg8SsM44bnTQrPa/I1UqrAsSGWbJ8FlZOd5vCKflTj73o9503y3hDY+XC 3Eeg75aZ+PLReNk0oFGhu2AXq2yniI0pMJG4VpRgGC2f5zIowhtSY6HsSKV9u5+GK1j4+iJJQhdAJ 7oKuuEZ+9dL+kf3Og4eUjQ==; In-Reply-To: <87y156413v.fsf@dataswamp.org> (message from Emanuel Berg on Fri, 09 Aug 2024 09:16:52 +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:322552 Archived-At: > From: Emanuel Berg > Date: Fri, 09 Aug 2024 09:16:52 +0200 > > One thing one could try is to replace boring, trivial stuff > with non-Lisp syntax and have that embedded. > > For example setting up the interface. > > Note: Over one in five interfaces in the Emacs source uses > Lisp and not the `interactive' format string. So it isn't just > me. It takes _a lot_ of time setting up the interface, > assigning default values, verifying indata, setting up > collections for completion, and so on. > > Here is one example from my own code: > > ;; ... > (interactive (if (numberp current-prefix-arg) > (list current-prefix-arg) > current-prefix-arg)) > (unless end > (setq end 73)) > (unless step > (setq step (min 10 (max 2 (/ end 10))))) > (unless i > (setq i 0)) > (unless (and (numberp i) (<= 0 i) > (numberp end) (< 0 end) > (numberp step) (< 0 step)) > (error "Bogus indata")) > > This is 402 chars! Why do you need that? Interactive functions can supply the arguments inside the 'interactive' spec, where no tests are needed. And non-interactive functions need not provide defaults for each argument, at least not usually. And finally, Emacs does have keyword arguments and cl-defun, if and when you need these facilities. Just look at the Emacs sources: you will rarely if ever find such long sequences of setting missing arguments to their defaults. That's no accident.