From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Placement of list within an interactive clause Date: Fri, 15 Jul 2022 10:26:06 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10505"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/+ () (2022-06-11) Cc: Help Gnu Emacs To: carlmarcos@tutanota.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 15 09:30:45 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 1oCFme-0002WY-W4 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Jul 2022 09:30:44 +0200 Original-Received: from localhost ([::1]:37138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCFmd-0003Sk-9h for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Jul 2022 03:30:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCFlT-0003SZ-Ey for help-gnu-emacs@gnu.org; Fri, 15 Jul 2022 03:29:31 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:54283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCFlR-0002J5-AZ for help-gnu-emacs@gnu.org; Fri, 15 Jul 2022 03:29:30 -0400 Original-Received: from localhost ([::ffff:154.225.39.176]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 00000000000A3C53.0000000062D11736.0000603F; Fri, 15 Jul 2022 00:28:53 -0700 Mail-Followup-To: carlmarcos@tutanota.com, Help Gnu Emacs Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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:138485 Archived-At: 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) ⇒ "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) ⇒ "Hello Bob" - but if I call (my-fun-2) and NAME is not supplied, I will be asked for name: (my-fun-2) ⇒ "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. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/