From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: carlmarcos--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Placement of list within an interactive clause Date: Fri, 15 Jul 2022 21:55:17 +0200 (CEST) Message-ID: References: Reply-To: carlmarcos@tutanota.com 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="14662"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 15 21:57:19 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 1oCRR8-0003cA-JA for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Jul 2022 21:57:18 +0200 Original-Received: from localhost ([::1]:43236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCRR6-0004Y0-91 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Jul 2022 15:57:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCRPO-0004Dc-SQ for help-gnu-emacs@gnu.org; Fri, 15 Jul 2022 15:55:30 -0400 Original-Received: from w1.tutanota.de ([81.3.6.162]:58032) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCRPM-0001sV-Dt for help-gnu-emacs@gnu.org; Fri, 15 Jul 2022 15:55:29 -0400 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id CDC16FBF69D; Fri, 15 Jul 2022 19:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657914917; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=XEK4l+Ra0FU98Z5h5QFtkjWTrP73CMpxEZzOK2U4oTA=; b=jMZOy+QYvtKWvmwDAA3useacH1co89Wka1cdQp7UbMXHcmVeXG9zxSYoQXY7dXYt 7I+fMPDO+oPyTGStlji5H/BaUriAPBgLmtY231aUL8t8RY1JwWE4OUga9qNx11YQ63F DNkK1LgVXnUTK8iF/77fUo4IFeLIOpkubmE6VmHloOWMkdUoYA9M6y9TWn2EM6BChIN Pri2DIb2/fo5XT5ya2vd/tU9U6H5VFMaQ9bwo1sbTcMkc7Bno4jNgd6au+RxUDmjIOW QzCIidU7M6JDFG4s0DKUjlmoBkTKEYI4ZhcGrqsgtFxaSUihqE0DQROQRPz4dzNI2Ha UtJq8V9eBA== In-Reply-To: Received-SPF: pass client-ip=81.3.6.162; envelope-from=carlmarcos@tutanota.com; helo=w1.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-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:138491 Archived-At: Jul 15, 2022, 07:26 by bugs@gnu.support: > Most of time I do not use `interactive' for supply arguments to > function. > > Thus instead of following: > > (defun my-fun-1 (&optional name) > (interactive "MName: ") > (message "Hello %s" name)) > > I am using following: > > (defun my-fun-2 (&optional name) > (interactive) > (let ((name (or name (read-from-minibuffer "Name: ")))) > (message "Hello %s" name))) > > as that gives me little more freedom: > > - if I call (my-fun-1) =E2=87=92 "Hello nil" that result is not what I > really want. It makes it difficult to get the wanted result. To > get the wanted result I need to use: > > (call-interactively 'my-fun-1) =E2=87=92 "Hello Bob" > > - but if I call (my-fun-2) and NAME is not supplied, I will be > asked for name: (my-fun-2) =E2=87=92 "Hello Bob" and will not get "NIL" > as result. In this case I need not complicate the call and use > `call-interactively`. > > Additionall, complex `interactive` clauses I find often too > difficult to comprehend than reading the body of the function. > > Fo this reason I recommend using this second approach with (or > ARGUMENT (GET-ARGUMENT)) rather then using `interactive` with > purpose to supply arguments. > > --=20 > Jean > If with GET-ARGUMENT you use a command that calls the minibuffer, then call= ing the function in lisp code will ask the user for input.=C2=A0 Something that= a pure function call in elisp code does not normally do.