From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Making `interactive' conditional Date: Sun, 10 Jan 2016 10:02:55 +0100 Message-ID: References: <87mvszdp6b.fsf@gnus.org> <8737u9kv6f.fsf@russet.org.uk> <87fuy7hdc6.fsf_-_@wanadoo.es> <87bn8vh8q4.fsf@wanadoo.es> <4002fc97-5629-4367-8b8f-48b659fefdce@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1452416631 21013 80.91.229.3 (10 Jan 2016 09:03:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jan 2016 09:03:51 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 10 10:03:41 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 1aIBuX-0000uc-9V for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2016 10:03:41 +0100 Original-Received: from localhost ([::1]:45982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIBuW-0003jT-6d for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2016 04:03:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIBuE-0003fw-4I for emacs-devel@gnu.org; Sun, 10 Jan 2016 04:03:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIBuA-0007LB-Tc for emacs-devel@gnu.org; Sun, 10 Jan 2016 04:03:22 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:36975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIBuA-0007L2-Mf for emacs-devel@gnu.org; Sun, 10 Jan 2016 04:03:18 -0500 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aIBtn-0005sG-Kw for emacs-devel@gnu.org; Sun, 10 Jan 2016 10:02:55 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEXNzMkFAgBeWlf49/T9 /fyQjYkIBQP////+//4hHhvtCv9HAAACUklEQVQ4jX2SwWvbMBTGH3XNlqMuht2CijN8M5MhPQak ER+Ng8p6mwN54FshHvaxrAbr2Bhq8H+7JzkkTbNNYCS/3/u+Jz8/0Fpn8LdV/2P9BzwB7Em5vAa+ /gXgf7oCTXsLsYwBPn+ssf8K/kr72Y+r4ksl2yQRyytAaw8egPDkR1C9gCAA4iNo09QYc2m1nvbK VGnncrojSI/xdSVcjlJH0KX2Xa7rStncxoLGApPe1u5oXiwwbVp3VgSyXtdUtmnqynmqVCmrhWRp HJicm1YmSqq2qUGt2/MdlTFSKCFk0sH9+8srSk8IxLcGVNd0J9AYQxWEEImy3T0DImmsPQsJVO/N mu8DlhvTSjhd6NjmB0T82Urhmni6V9M8Uxx3Qrrx2efzddUZV+K55Jy/CWFBN0O8mxwrsSppAsPE gacRcVvT76iUhNgCPSl+6xzL++nLAHoe8tAOTV1/03rAjYjBo8fvx350wHQ3mg/BXMR+5tE7J0Vm pSqZhSOyV4h9nRHIw1BngmZGCbrFgQBQUZrhG5JsrBWBPDwEOweI+PQdG6sQMef6gDsXJ/DIIwJ2 yuIo6knhkyORHCOu5w6IRRgVbEdBriNqVMbvFvPYgXIsgm0eap4zRq1dpQOGAAkBXgTYE1gwFmA5 E0OBb+DFWHKkwJaPB9oQR29ALAEiAmOB2A/ImCOe/SeQowV06heIzIZwPhzBtPoIJwG+4iUYrRWS 6e4ESmr1VMOllGdFzzmBghSsKFhgHeGR8r7wPB/GgZ1XQIBZ0PNLwBAiu5HVUF6CP5k9fgczdAtu AAAAAElFTkSuQmCC In-Reply-To: (John Wiegley's message of "Sat, 09 Jan 2016 12:55:28 -0800") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aIBtn-0005sG-Kw MailScanner-NULL-Check: 1453021376.42321@vlXuaq5HwoF7d3pgUtnYmQ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:197960 Archived-At: John Wiegley writes: > Right now, functions are interactive if declared with `interactive', and not > otherwise. The suggestion at hand is to allow `interactive' forms to become > conditional -- possibly in multiple ways. I like this concept, and think the > right place for it is indeed in core. > > The question is how to declare such conditionality. We can do this rather > easily by accepting new keyword arguments to `interactive': > > (interactive "sDirectory: " [:mode foo-mode] [:when ]) That does sound kinda exciting. To take a random example, `M-x delete-matching-lines' could have a :when of `buffer-writable-p' and not auto-complete when in a read-only buffer. Etc. > This way, all new modes can take advantage of this support as it becomes > available. I've already tested on 24.5, and keyword arguments are silently > ignored by present-day GNU Emacs. This gives us transparent compatibility in > both directions. Does this also work when transforming (interactive) without parameters, or do we need to put a nil in there? > We could also do it with (declare); I'm open to that too, and it also > gives us such compatibility. I think the interactive with keywords sounds nice, but both are fine by me... > At first, I imagine nothing delivered with Emacs will be conditional, because > it requires annotating packages retroactively. We could alleviate some of that > by writing code to automatically consider every interactive function *without > an autoload token* as being conditional on any modes defined in the same > package (likely determined by prefix matching). The use of such automation > would be configurable and off by default, at least until we believe it's ready > for prime-time. Hm... I think that sounds a bit too magical to be workable in general. I may be wrong, but I think that would probably lead to undesirable side effects (i.e., commands that should be available globally not being available). Magic is nice if you can get it to work, but explicit marking is flexible. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no