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 22:10:36 +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="23446"; 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 22:11:17 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 1o8SPc-0005tf-Jk for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 22:11:16 +0200 Original-Received: from localhost ([::1]:54874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8SPb-00032S-2w for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 Jul 2022 16:11:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8SP5-00032K-Mo for help-gnu-emacs@gnu.org; Mon, 04 Jul 2022 16:10:43 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:37155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8SP3-0002p8-QO; Mon, 04 Jul 2022 16:10:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656965436; bh=y3eQt7it7R7OdMBqyiVWeriODfre6h52aYod/u4nBZ0=; h=X-UI-Sender-Class:From:To:Subject:Date; b=HAdFy6YRSVt0RQ61EN75GNgScceeZiG8tNbbsTM+OqUT5pHrSuGiIOw95sKQ44Oud dTzr31Z4ZWjbYsixwzN06ssfw3U7rQSP/fgoPsKefp/xoFIaSKy8dto2DAVy1JHv9W 8fb5DUDHbwPOMStCIQM76l80LkHk8OXZNqAulwK0= 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-bs02.server.lan [172.19.170.129]) (via HTTP); Mon, 4 Jul 2022 22:10:36 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:8CrWE3oYVVI6x+EyzvH+SEI875gzdPCG2QP5JHgqXcgKIXuSC7lxsnYwU6XZrxgDGJS8E 15i2vjC/hPoOFPPgbURA8z0pMF4v6EnXb5D6rQDB49GUZxyPfkzgDPibsCYoy3v1+D+bif6Ex8w8 hBeNohNF+r3Iy/9dY93w/oYGyWP60N22lgoX+DBZD2lBXEqdgn9HW4Oxqy2A95VrgOpVJW6egUt0 gG5icJqMODxugn0VsRVZaKP7xgeTo9CnFT/iLcl8+POg73Ig8EXYacmhaId46K5c+FhjrQBCpVLH h0= X-UI-Out-Filterresults: notjunk:1;V03:K0:LZ0SM7z4REI=:PehF48WonrxjR10ZJraDjJ s0XEOynES2MNzPNmiym5FYiUTfgJlFQqh0aaD+j1NVNn+nHLgq0ULGTOfD6Xmo8Lo9vFsrrs5 261ZlIdvcV0MAhMjFrJxTz9RvMN5NaHQqxMswcsx+RjtDRUBmlaChs8n+wTICxOVANiZ5wnP4 a6AUwpeeGeqywuy96o8cBCxZ6LBx1SnSw6Wkf60hKcEKULGMJC68Efl7t39hBpyJ/7gLEJYk9 FRHLIRgYj6VCBt9hA9dUTIU//rE43N8pqgwJgG7G+R4zRRMoHoGouk/bLmCW3d4IfcGBNAfYe 61UIsP7kIPnfDXbiEJNJvB5q1KDUrXQjhZW8UmhGoGYsgud8ba6HPIIAEyXVftwrPT9yLCt/1 s6/bCsr7wILmn3oXFoaTQ8FM3Mg+l09ZfslTnhHAQj4bxV8fbBhXGsxJZ4QS0uy2VkABZ2K8G Sq0uS2qX+uj86Zwo98O/+HRd/qUsLFAO7t8u4KOVl99/jTBpbMqvoYhZ5g630aHBUmCMSnPza olMdDW/MUwqON4eS1E+pQnePFtCCjJexo9gYdqBbOTra9//j3XGB8uLCnAFrzFKIJEFulap3F oL4TMOptkfETDDAaM6WhDVwL4ledouUjQsp78x7ZZTeb0595AHorI7QfHYvQRkevfaYyL3OlX s5KxJn6bfhLVBhKDyFtoYKqB2rYvaUtSA6Yt7WHuSTbeWbEISjxejLtKUQUK0BA9DrhpaDf1m /OwTcoupzkoMJ81JZVJgWll0w0HqqAdFc1jywQz/KI3w46/ZOvWLo0RIiLdutzR9sUhuWiSv Received-SPF: pass client-ip=212.227.17.22; 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:138295 Archived-At: Jul 4, 2022, 19:40 by monnier@iro.umontreal.ca: >>> Only after byte-compile of a file? >>> So there is no way to actually make a function interactive only= ? > Please define what it is you mean by "make a function interactive onl= y". > Do you mean that it should be illegal to write code that calls the > function directly, so whoever writes it can be sued? > Would it be acceptable for someone to just think about writing such c= ode > as long as they don't actually write it? > More seriously, what are you trying to gain by "mak[ing] a function > interactive only"? Usually, the reason why one might want to make > a function "interactive only" is that code that calls this function i= s > probably incorrect and would likely be served better by some > other function. I could envisage a situation where someone wants to concentrate on the interactive parts, if taking care of non-interactive use would make the function difficult to maintain. I am not sure that it will always be because of bad design. > So the purpose is to help people write better code. > For this reason the declaration only has an effect in terms of > byte-compiler warnings: those who don't bother to byte-compile their > code presumably don't care about the quality of their code anyway. > Emacs doesn't offer any pre-defined way to really enforce that > a function is only used interactively, and in large parts this is > because, as a matter of design principle, Emacs makes no effort to st= op > people from shooting themselves in the foot (instead, it tries to mak= e > it easier for people not to shoot themselves in the foot). > Stefan I also say that it would be better to have declarations that are somewhat safer for the general elisp user as well.