From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.devel Subject: Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional Date: Tue, 5 Jul 2016 20:24:52 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1467764729 26471 80.91.229.3 (6 Jul 2016 00:25:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Jul 2016 00:25:29 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 06 02:25:28 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bKaee-0006lB-I4 for ged-emacs-devel@m.gmane.org; Wed, 06 Jul 2016 02:25:28 +0200 Original-Received: from localhost ([::1]:58691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKaed-0003Vf-SV for ged-emacs-devel@m.gmane.org; Tue, 05 Jul 2016 20:25:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKae6-0003VO-KY for emacs-devel@gnu.org; Tue, 05 Jul 2016 20:24:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKae5-0003qb-KQ for emacs-devel@gnu.org; Tue, 05 Jul 2016 20:24:54 -0400 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:36201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKae5-0003qX-G6 for emacs-devel@gnu.org; Tue, 05 Jul 2016 20:24:53 -0400 Original-Received: by mail-oi0-x22f.google.com with SMTP id f189so251936912oig.3 for ; Tue, 05 Jul 2016 17:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-transfer-encoding; bh=pD82THZmR0462KvD3Fgq8UPN+bmGNykJjB+K804Y6yg=; b=URnO9oqmjIZ/2hMcrxVoUSide/t0aZLLRKkU/ePiqRpc9yhmWXYM8OTBSdEvm5iDFS xrvy615DcAEfyJWRR6E4Yb17UHZzZXr+W9J4HUK/9r16lQaKJhm9yKSLQIekwyGCTsSY gw7H741R89by3Q+2i/+MZaSmSzRiqXm07DtXsgLe5QwuomoFSmK9Yf+H8VXVSEBCalxQ JTF8SxzeeqzXP3DZCTJ3rKamw8/bd7BGOIzn1/xGfmuO/DDQJGJUYxCYCg8GPzKPjrhM 2/EqPqABmDjC4rGYC9GqKnuq/GwJ69wpL+uZBzD3jSGKOJCewbI7Tooj9az7yI1MPc75 C5zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:content-transfer-encoding; bh=pD82THZmR0462KvD3Fgq8UPN+bmGNykJjB+K804Y6yg=; b=GGGtuU6HugqbxE/joDvcj3T2cj2C1Y0gPzT42uplziv6r7Q8ESl1qpdiz/I2NgywBk mjjf8J2JKD2RUZwYboSFG1GPbiUXoyhPMQ7On8U4nIxm6X9MATgjDpnD9Tc0ugVkIcYt dU5l8rC82d44ZC/36E2GDn8DSm77AYIcEhjlIe+kVETwk0kl+WFIQQwkm1n6agyEbLGe ugxWJndKRDHdOJGkLRy0kn33y3JkSX+XOX19iimzHHkCcJJerceCuuwv+Jso6UrpXnES GGil2A0ydfzEeqgrCIiCgjnJNnIuAPsVzgsH29bC0H7Wzw/Spa44Tczve6tk2ivudXMI KvFA== X-Gm-Message-State: ALyK8tLWWuUs+teV7EETVUjKGAFkNVXqC5/ugRpMjBsA0pCJ4cKjSuJXuXHxtXnF9RPmyFAn8f+TjI+r6Twx+g== X-Received: by 10.157.1.103 with SMTP id 94mr8670893otu.17.1467764692790; Tue, 05 Jul 2016 17:24:52 -0700 (PDT) Original-Received: by 10.157.4.197 with HTTP; Tue, 5 Jul 2016 17:24:52 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 08FCoiHleFQrO4Bi0g1PmERsr3c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205224 Archived-At: On Tue, Jul 5, 2016 at 8:09 PM, John Wiegley wrote: > Simple and common patterns should be simple, because they are common. The simplest way to do this if you don't care about the distinction between (called-interactively 'any) and (called-interactively 'interactive) is to add an argument that is set to non-nil by the interactive spec, as described in the manual: The recommended way to test whether the function was called using =E2=80=98call-interactively=E2=80=99 is to give it an optional argument =E2=80=98print-message=E2=80=99 and use the =E2=80=98interactive=E2=80= =99 spec to make it non-=E2=80=98nil=E2=80=99 in interactive calls. Here=E2=80=99s an exam= ple: (defun foo (&optional print-message) (interactive "p") (when print-message (message "foo"))) We use =E2=80=98"p"=E2=80=99 because the numeric prefix argument is nev= er =E2=80=98nil=E2=80=99. Defined in this way, the function does display the message when called from a keyboard macro. The above method with the additional argument is usually best, because it allows callers to say =E2=80=9Ctreat this call as interactiv= e=E2=80=9D.