From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Making a function than can only be used interactively Date: Mon, 4 Jul 2022 23:07:28 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7751"; mail-complaints-to="usenet@ciao.gmane.io" To: monnier@iro.umontreal.ca, tsdh@gnu.org, help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 04 23:08:09 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1o8TIf-0001qn-L5 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 23:08:09 +0200 Original-Received: from localhost ([::1]:57300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8TIe-0002cO-55 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 17:08:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8TI7-0002cG-6L for help-gnu-emacs@gnu.org; Mon, 04 Jul 2022 17:07:35 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:45221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8TI5-00025j-C4; Mon, 04 Jul 2022 17:07:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656968848; bh=jfTpXUKVlyjAGHgMWdwxec1HbYh/X61O//QUdI8Ir28=; h=X-UI-Sender-Class:From:To:Subject:Date; b=W6X3jrwKwfLskHRdCaVYYj7plSElXgyjQfFdArf92zvZiue13m5oSa7UzWKYEbeIS Ed3R1dcEJZIRKuabytR3utLEEl58GqIa2+7AIO37I76wcWWvR4yQ6lUj8MbXpnMr60 +etvQAXkWJavuQSW+NNAlJrAIostLNHtMrEs5G0w= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [92.251.127.164] ([92.251.127.164]) by web-mail.gmx.net (3c-app-mailcom-bs07.server.lan [172.19.170.175]) (via HTTP); Mon, 4 Jul 2022 23:07:28 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:1zlwRAq7eN21PB7AB4JWdVGyqd+syZuXqA4S+ke/FDbMusgRayIYLSHMCA77c3Wt7an0B Gjogt1B5b8DJwspYCWm3ZePyWUYGSY1k8QyYimiQ7ngtT7cKQpabStKRb5ZfFixsAOz9sZHocq83 5Bz+5lHbrZkF01Zhzw8nrkdAaY0cXznB7tWWviIsyEUx/p6GC7IoodBb5dmm2KBhSXJwxokDsm7m YyUJ148wJ4SEP6qmdU5dn6O3nsz8DVYKGVWJZvLALPPITW66Q9Uk/JABKXysS8ozIjwsbwViUpaY 1w= X-UI-Out-Filterresults: notjunk:1;V03:K0:Gw0YhFeNFKg=:hO08vljIlCFc3LQD0kbB4Z 3RdgdIZtV82tmeq3cycK8xzUUKGbC785eexQcJ8y4ogZELB+nT7eZpmhsKB5QZ3xT+tJg2JD5 ACcu4McP2xwpB8V6ToXK6WcRsRdUEgC7hAqIs/0RH5VDRqzct08QN8Dedz76u3t9I+NcMiigp R5VdkMbzKCp4TOUNXzyCmffwEoSv4hEUKnMMxDJ5ZUWZPNIJ+pXXSrnPjAktZIeEc49N9c8KV TgH4PFzJquw9nPK0KI4yFSNiFA4srk8OjtoNj5aukCmTAZLBpDKo1KDlg0JUFetH6rpsPko8J YbskUKOdC0vl0l+zkJz76uPqcABm5K73Yw2PfwoAwr7VjNct7DNak/LtB0ZcAN8lpSu8kc1EE pmOYDMDXSZ9K+2e9wrMIWsWuTw/LTWPiCCN0/8FpXdO6x2anZkMczuL/G+uy5OycUoiZZcrRF +MIJxJvyShoInip7u4MH8cMu0bklTJbFuERUCjQb3c49t142nSkeOjRa1NdefqW0WF8NoFTnF YSPUQ9M2636roX7gV2pW/USKVKJVOm9ZZU1dglRBVpyNWcS2Adcl0Av2uCMTZj8ewQbKOI0Zc jl3hP9KQL1BTAaxj7WDPK6HQWoth+CGw3NY1LJdcMCKbO9NK2IzeTlH9wxHlscIwuDXdmppfD LM+nJXULtdUxKYmz7UJoFBJEvgaSTwZspysVHpJFqx6SmmcGKK6w4p1yVD4V0R8UUs6qnVbpb bYGpHW6nK0jYnosmdZUQf4lMvwZqnb6f7Va+90j1fRDUzqVct4DWj16L+CxtXxDBjKDaUi9L Received-SPF: pass client-ip=212.227.17.21; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138300 Archived-At: > Jul 4, 2022, 20:45 by monnier@iro.umontreal.ca: >>>>> More seriously, what are you trying to gain by "mak[ing] = a function >>>>> interactive only"? >>> For instance, writing an interactive wrapper function calling a= non-interactive >>> mother function. > A common enough case, which you can do just fine without having to > prevent non-interactive calls to the interactive wrapper. >>> Technically, you can use `completing-read` and `read-from-minib= uffer` if you'd also >>> like to set values interactively, while calling the function no= n-interactively. > You mean you can turn > (defun foo (a b c) > (interactive ...) > ...) > into > (defun foo () > (interactive) > (let ((a ...) > (b ...) > (c ...)) > ...)) Yes, that is what I had in mind. > Indeed. It's usually discouraged because it's incompatible with > non-interactive uses of the function, but in the case under discussio= n > you don't care about that because you already have another function t= o > use for non-interactive calls. It is indeed incompatible with non-interactive use. A thing that can be d= one is fire the warning even when Lisp Code in not transformed into byte-code. Although byte compilation in recommended, I wonder how often people actual= ly byte-compile every file. Byte compiling will often tell you errors or war= ning in your elisp code that you normally wouldn't know, but I think that runni= ng an interactive-only function non-interactively is serious enough to insert= the warning in the warnings buffer anyway. >>> I am not sure if in practice that is ever desired. > It's done occasionally, typically in cases where it's difficult to > cleanly separate the part of the code that prompts the user from the > part that actually performs the desired operation. > Stefan