* Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional @ 2016-06-27 20:35 Robert Weiner 2016-06-28 19:09 ` John Wiegley 2016-06-28 20:29 ` Glenn Morris 0 siblings, 2 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-27 20:35 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 633 bytes --] I have some older code with a lot of calls to (interactive-p) for which I am having to substitute (called-interactively-p 'interactive) to get the same behavior with a non-obsoleted call. Visually, this does not read well to me and I imagine others. What do people think of making the argument optional and defaulting it to the behavior of (interactive-p) which I believe equates to the 'interactive argument value? Then we would have: if (called-interactively-p) ...) in a lot of places and that would look much better and be much easier to call properly. When more complex behavior is needed, the argument could be given. Bob [-- Attachment #2: Type: text/html, Size: 1331 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-27 20:35 Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional Robert Weiner @ 2016-06-28 19:09 ` John Wiegley 2016-06-28 20:28 ` Robert Weiner 2016-06-30 16:54 ` Andreas Röhler 2016-06-28 20:29 ` Glenn Morris 1 sibling, 2 replies; 37+ messages in thread From: John Wiegley @ 2016-06-28 19:09 UTC (permalink / raw) To: Robert Weiner; +Cc: rswgnu, emacs-devel [-- Attachment #1: Type: text/plain, Size: 746 bytes --] >>>>> Robert Weiner <rsw@gnu.org> writes: > I have some older code with a lot of calls to (interactive-p) for which I am > having to substitute (called-interactively-p 'interactive) to get the same > behavior with a non-obsoleted call. Visually, this does not read well to me > and I imagine others. What do people think of making the argument optional > and defaulting it to the behavior of (interactive-p) which I believe equates > to the 'interactive argument value? I like this suggestion; especially since (called-interactively-p 'interactive) seems needlessly repetitive. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 629 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 19:09 ` John Wiegley @ 2016-06-28 20:28 ` Robert Weiner 2016-06-30 16:54 ` Andreas Röhler 1 sibling, 0 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-28 20:28 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 281 bytes --] On Tue, Jun 28, 2016 at 3:09 PM, John Wiegley <jwiegley@gmail.com> wrote: > I like this suggestion; especially since (called-interactively-p > 'interactive) > seems needlessly repetitive. > Please make it so, John. As Forrest Gump said, "One less thing." Bob [-- Attachment #2: Type: text/html, Size: 924 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 19:09 ` John Wiegley 2016-06-28 20:28 ` Robert Weiner @ 2016-06-30 16:54 ` Andreas Röhler 1 sibling, 0 replies; 37+ messages in thread From: Andreas Röhler @ 2016-06-30 16:54 UTC (permalink / raw) To: emacs-devel On 28.06.2016 21:09, John Wiegley wrote: >>>>>> Robert Weiner <rsw@gnu.org> writes: >> I have some older code with a lot of calls to (interactive-p) for which I am >> having to substitute (called-interactively-p 'interactive) to get the same >> behavior with a non-obsoleted call. Visually, this does not read well to me >> and I imagine others. What do people think of making the argument optional >> and defaulting it to the behavior of (interactive-p) which I believe equates >> to the 'interactive argument value? > I like this suggestion; especially since (called-interactively-p 'interactive) > seems needlessly repetitive. > What about re-honoring good and simple interactive-p? ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-27 20:35 Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional Robert Weiner 2016-06-28 19:09 ` John Wiegley @ 2016-06-28 20:29 ` Glenn Morris 2016-06-28 20:46 ` Robert Weiner 2016-07-06 0:09 ` John Wiegley 1 sibling, 2 replies; 37+ messages in thread From: Glenn Morris @ 2016-06-28 20:29 UTC (permalink / raw) To: emacs-devel It's easy to search for prior discussion on this. Eg http://lists.gnu.org/archive/html/emacs-devel/2015-07/msg00326.html That would defeat the whole purpose (which is to force the author to make a choice between the two kinds, rather than to use one without knowing that there's a choice). ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 20:29 ` Glenn Morris @ 2016-06-28 20:46 ` Robert Weiner 2016-06-28 20:51 ` Robert Weiner 2016-06-29 20:02 ` Richard Stallman 2016-07-06 0:09 ` John Wiegley 1 sibling, 2 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-28 20:46 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 1068 bytes --] On Tue, Jun 28, 2016 at 4:29 PM, Glenn Morris <rgm+news@gnu.org> wrote: > > It's easy to search for prior discussion on this. Eg > > http://lists.gnu.org/archive/html/emacs-devel/2015-07/msg00326.html > > That would defeat the whole purpose (which is to force the author > to make a choice between the two kinds, rather than to use one without > knowing that there's a choice). > This is a frequently called function and it is not good design to make everyone who has encountered it and read the documentation forever more have to add that argument when so many of the use cases would not require it. And again, visually, it looks bad and is much more complex than the prior (interactive-p). Yes, there will be newbies who do not know there is an argument that they could provide because they just copied a snippet of code but that is far from a major issue and not much of a justification to create more work for the bulk of developers. Does anyone concur or disagree? I will have a look at the prior discussion. Bob [-- Attachment #2: Type: text/html, Size: 2506 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 20:46 ` Robert Weiner @ 2016-06-28 20:51 ` Robert Weiner 2016-06-29 20:02 ` Richard Stallman 1 sibling, 0 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-28 20:51 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 968 bytes --] Much of the prior discussion on this topic seems to favor my suggestion and even suggest that people would like (interactive-p) non-deprecated. -- Bob Here is a taste: *From*: Drew Adams *Subject*: RE: Brittleness of called-interactively-p *Date*: Thu, 16 Jul 2015 10:36:41 -0700 (PDT) FWIW, I still use `interactive-p' in much of my code, because the code needs to work also with older Emacs versions. And because I have never noticed any problem, for this code anyway, with `interactive-p'. What's more, the doc for `interactive-p' does not really tell you how to replace it - it just says to use `called-interactively-p', without any mention of which argument gives you the behavior you had previously with `interactive-p' or similar-but-somehow-improved behavior. `interactive-p' was indeed used heavily, over decades. And it is no doubt still in use quite a bit. Too bad there is next-to-no guidance on how to use `called-interactively-p' to replace it. [-- Attachment #2: Type: text/html, Size: 1784 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 20:46 ` Robert Weiner 2016-06-28 20:51 ` Robert Weiner @ 2016-06-29 20:02 ` Richard Stallman 2016-06-29 20:54 ` Robert Weiner 1 sibling, 1 reply; 37+ messages in thread From: Richard Stallman @ 2016-06-29 20:02 UTC (permalink / raw) To: rswgnu; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > This is a frequently called function and it is not good design to make > everyone who has encountered it and read the documentation forever more > have to add that argument when so many of the use cases would not require > it. Maybe there is bad design in this -- in the fact that programmers need to make this complex choice to avoid giving users bad behavior. Good design would, I suppose, make the choice unnecessary. Telling people to ignore the choice, or choose at random, while the choice is still necessary, would not be better design. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 20:02 ` Richard Stallman @ 2016-06-29 20:54 ` Robert Weiner 2016-06-29 21:19 ` Drew Adams ` (3 more replies) 0 siblings, 4 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-29 20:54 UTC (permalink / raw) To: Richard Stallman; +Cc: emacs-devel On Wed, Jun 29, 2016 at 4:02 PM, Richard Stallman <rms@gnu.org> wrote: > Telling people to ignore the choice, or choose at random, while > the choice is still necessary, would not be better design. That is an argument for never allowing optional parameters to functions. But I would assume you are not against these entirely. Any time you make an argument optional, the function caller still has the function signature and documentation to rely on when deciding how to make the call. The only difference is he has the power to avoid sending the argument when he need not. There was a function, interactive-p, that many people used without any arguments and found that useful. Now (called-interactively-p 'interactive) is equivalent but makes code much uglier (I know as I just changed all my code to use it and it is much less readable now). The request is for a function of no arguments that does what interactive-p did; it could be called-interactively-p with an optional argument signature or it could be another function that provides an equivalent. Does that affect your thinking? Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* RE: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 20:54 ` Robert Weiner @ 2016-06-29 21:19 ` Drew Adams 2016-06-29 21:39 ` Robert Weiner 2016-06-29 21:21 ` Clément Pit--Claudel ` (2 subsequent siblings) 3 siblings, 1 reply; 37+ messages in thread From: Drew Adams @ 2016-06-29 21:19 UTC (permalink / raw) To: rswgnu, Richard Stallman; +Cc: emacs-devel > There was a function, interactive-p, that many people used without any > arguments and found that useful. Now (called-interactively-p > 'interactive) is equivalent but makes code much uglier (I know as I > just changed all my code to use it and it is much less readable now). > The request is for a function of no arguments that does what > interactive-p did; it could be called-interactively-p with an optional > argument signature or it could be another function that provides an > equivalent. If (called-interactively-p 'interactive) is equivalent to `interactive-p', and if "the call is for a function of no arguments that does what `interactive-p' did" (and still does) ...then just use `interactive-p'. (I do. But then, I also want to be backward compatible.) ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 21:19 ` Drew Adams @ 2016-06-29 21:39 ` Robert Weiner 2016-06-29 21:48 ` Robert Weiner 0 siblings, 1 reply; 37+ messages in thread From: Robert Weiner @ 2016-06-29 21:39 UTC (permalink / raw) To: Drew Adams; +Cc: Richard Stallman, emacs-devel On Wed, Jun 29, 2016 at 5:19 PM, Drew Adams <drew.adams@oracle.com> wrote: > If (called-interactively-p 'interactive) is equivalent to > `interactive-p', and if "the call is for a function of no > arguments that does what `interactive-p' did" (and still does) > > ...then just use `interactive-p'. I would/did but the byte-compiler keeps telling me it is deprecated and I don't want to see that for this particular function. Is there a way to turn off such errors for particular functions? Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 21:39 ` Robert Weiner @ 2016-06-29 21:48 ` Robert Weiner 2016-06-30 23:18 ` Richard Stallman 0 siblings, 1 reply; 37+ messages in thread From: Robert Weiner @ 2016-06-29 21:48 UTC (permalink / raw) To: Drew Adams; +Cc: Richard Stallman, emacs-devel On Wed, Jun 29, 2016 at 5:39 PM, Robert Weiner <rsw@gnu.org> wrote: > would/did but the byte-compiler keeps telling me it is deprecated > and I don't want to see that for this particular function. > Is there a way to turn off such errors for particular functions? I found the documentation on how to do this: byte-compile-warnings is a variable defined in ‘bytecomp.el.gz’. Its value is t If the list begins with ‘not’, then the remaining elements specify warnings to suppress. For example, (not mapcar) will suppress warnings about mapcar. So I can suppress the warnings locally and have nice looking code but all installers of my packages will still have to look at the byte compile warnings then. I wonder if this could be set within the *-pkg.el file for a package so that it applies to all users too. Or I guess I could redefine called-interactively-p to take an optional parameter inside my packages if John does not want to try that out given this discussion. Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 21:48 ` Robert Weiner @ 2016-06-30 23:18 ` Richard Stallman 0 siblings, 0 replies; 37+ messages in thread From: Richard Stallman @ 2016-06-30 23:18 UTC (permalink / raw) To: rswgnu; +Cc: drew.adams, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] There is also with-no-warnings, that allows you to suppress the warning at a particular place in the code, not everywhere. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 20:54 ` Robert Weiner 2016-06-29 21:19 ` Drew Adams @ 2016-06-29 21:21 ` Clément Pit--Claudel 2016-06-29 21:52 ` Dmitry Gutov 2016-06-30 2:51 ` raman 2016-07-03 0:10 ` Richard Stallman 3 siblings, 1 reply; 37+ messages in thread From: Clément Pit--Claudel @ 2016-06-29 21:21 UTC (permalink / raw) To: emacs-devel [-- Attachment #1.1: Type: text/plain, Size: 451 bytes --] On 2016-06-29 16:54, Robert Weiner wrote: > There was a function, interactive-p, that many people used without any > arguments and found that useful. Now (called-interactively-p > 'interactive) is equivalent but makes code much uglier (I know as I > just changed all my code to use it and it is much less readable now). Hyperbold is pretty large, so you could also define (hyp-interactive-p) to alias (called-interactively-p 'interactive). [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 21:21 ` Clément Pit--Claudel @ 2016-06-29 21:52 ` Dmitry Gutov 2016-06-29 22:00 ` Robert Weiner 0 siblings, 1 reply; 37+ messages in thread From: Dmitry Gutov @ 2016-06-29 21:52 UTC (permalink / raw) To: Clément Pit--Claudel, emacs-devel On 06/30/2016 12:21 AM, Clément Pit--Claudel wrote: > Hyperbold is pretty large, so you could also define (hyp-interactive-p) to alias (called-interactively-p 'interactive). +1. If called-interactive-p is such a nuisance for Robert, this sounds like the best option to me. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 21:52 ` Dmitry Gutov @ 2016-06-29 22:00 ` Robert Weiner 0 siblings, 0 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-29 22:00 UTC (permalink / raw) To: Dmitry Gutov; +Cc: Clément Pit--Claudel, emacs-devel On Wed, Jun 29, 2016 at 5:52 PM, Dmitry Gutov <dgutov@yandex.ru> wrote: > On 06/30/2016 12:21 AM, Clément Pit--Claudel wrote: > >> Hyperbold is pretty large, so you could also define (hyp-interactive-p) to >> alias (called-interactively-p 'interactive). > > If called-interactive-p is such a nuisance for Robert, this sounds like the > best option to me. This is not a bad idea but I think suppressing the warnings on (interactive-p) leaves me with the highest readability for now, so I am going to pursue that and we'll see how it goes. Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 20:54 ` Robert Weiner 2016-06-29 21:19 ` Drew Adams 2016-06-29 21:21 ` Clément Pit--Claudel @ 2016-06-30 2:51 ` raman 2016-06-30 14:25 ` Robert Weiner 2016-07-03 0:10 ` Richard Stallman 3 siblings, 1 reply; 37+ messages in thread From: raman @ 2016-06-30 2:51 UTC (permalink / raw) To: Robert Weiner; +Cc: rswgnu, Richard Stallman, emacs-devel Along those lines I had once suggested that we make (interactive-p) a synonym for (called-interactively-p 'interactive) but it got rejected through a complex email thread. That might still be worth doing. Also, called-interactively-p as it exists has other issues -- specifically fails when called within advice forms. See related email discussion from about a year ago -- as well as comments in the advice implementation. --- for the record interactive-p used to work fine in advice forms for nearly 18 years --- it broke sometime during the transition from advice.el to advice.el plus nadvice.el and the arrival of called-interactively-p, all of which (relatively speaking) happened at around the same time. -- ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-30 2:51 ` raman @ 2016-06-30 14:25 ` Robert Weiner 2016-06-30 15:30 ` Eli Zaretskii 2016-06-30 15:34 ` raman 0 siblings, 2 replies; 37+ messages in thread From: Robert Weiner @ 2016-06-30 14:25 UTC (permalink / raw) To: raman; +Cc: Richard Stallman, emacs-devel On Wed, Jun 29, 2016 at 10:51 PM, raman <raman@google.com> wrote: > Along those lines I had once suggested that we make (interactive-p) a > synonym for (called-interactively-p 'interactive) but it got rejected > through a complex email thread. That might still be worth doing. Maybe the simplest solution would be to undeprecate (interactive-p), if it is not doing anything wrong, and simply continue in its documentation to refer to the other calling form for more complex cases. I have seen another case where a function has been deprecated (find-tag, with a suggestion to use xref-find-definitions) where the new function's calling signature and behavior is totally incompatible with that of the deprecated function. This seems wrong. If the old behavior works fine and is used widely and you want to add new behavior, there should be some good thought towards backwards compatibility, as I am sure is typically done. It would be nice if John and Eli could just make some final decision on the interactive-p issue and then put that one to rest, whatever it is. Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-30 14:25 ` Robert Weiner @ 2016-06-30 15:30 ` Eli Zaretskii 2016-07-03 18:36 ` Andreas Röhler 2016-06-30 15:34 ` raman 1 sibling, 1 reply; 37+ messages in thread From: Eli Zaretskii @ 2016-06-30 15:30 UTC (permalink / raw) To: rswgnu; +Cc: emacs-devel, rms, raman > From: Robert Weiner <rsw@gnu.org> > Date: Thu, 30 Jun 2016 10:25:26 -0400 > Cc: Richard Stallman <rms@gnu.org>, emacs-devel <emacs-devel@gnu.org> > > It would be nice if John and Eli could just make some final decision > on the interactive-p issue and then put that one to rest, whatever it > is. I have no opinion on the subject, except the general principle that we shouldn't back up on past decisions unless they are truly disastrous, because such back-and-forth confuses users and wastes maintenance efforts. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-30 15:30 ` Eli Zaretskii @ 2016-07-03 18:36 ` Andreas Röhler 2016-07-03 18:56 ` Alan Mackenzie 2016-07-03 19:31 ` Eli Zaretskii 0 siblings, 2 replies; 37+ messages in thread From: Andreas Röhler @ 2016-07-03 18:36 UTC (permalink / raw) To: emacs-devel On 30.06.2016 17:30, Eli Zaretskii wrote: >> From: Robert Weiner <rsw@gnu.org> >> Date: Thu, 30 Jun 2016 10:25:26 -0400 >> Cc: Richard Stallman <rms@gnu.org>, emacs-devel <emacs-devel@gnu.org> >> >> It would be nice if John and Eli could just make some final decision >> on the interactive-p issue and then put that one to rest, whatever it >> is. > I have no opinion on the subject, except the general principle that we > shouldn't back up on past decisions unless they are truly disastrous, They are. This is another example from a couple of issues which went wrong last years. Code was made swollen up and complicated, simple solutions rejected. BTW a characteristic design-flaw beyond mentioned last days is around use-region-p. With use-empty-active-region or region-active-p it hardly comes to an end. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-03 18:36 ` Andreas Röhler @ 2016-07-03 18:56 ` Alan Mackenzie 2016-07-03 19:57 ` Andreas Röhler 2016-07-03 19:31 ` Eli Zaretskii 1 sibling, 1 reply; 37+ messages in thread From: Alan Mackenzie @ 2016-07-03 18:56 UTC (permalink / raw) To: Andreas Röhler; +Cc: emacs-devel Hello, Andreas. On Sun, Jul 03, 2016 at 08:36:56PM +0200, Andreas Röhler wrote: > On 30.06.2016 17:30, Eli Zaretskii wrote: > >> From: Robert Weiner <rsw@gnu.org> > >> Date: Thu, 30 Jun 2016 10:25:26 -0400 > >> Cc: Richard Stallman <rms@gnu.org>, emacs-devel <emacs-devel@gnu.org> > >> It would be nice if John and Eli could just make some final > >> decision on the interactive-p issue and then put that one to rest, > >> whatever it is. > > I have no opinion on the subject, except the general principle that > > we shouldn't back up on past decisions unless they are truly > > disastrous, > They are. This is another example from a couple of issues which went > wrong last years. Code was made swollen up and complicated, simple > solutions rejected. This is the sort of thing liable to make people unhappy with your postings. Please say exactly what has become turgid and complicated, where simple solutions have been rejected. Possibly those simple solutions were too simple. > BTW a characteristic design-flaw beyond mentioned last days is around > use-region-p. With use-empty-active-region or region-active-p it > hardly comes to an end. What hardly comes to an end? Are you talking about a loop in the code, our discussion on emacs-devel, or a design flaw not coming to an end? -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-03 18:56 ` Alan Mackenzie @ 2016-07-03 19:57 ` Andreas Röhler 0 siblings, 0 replies; 37+ messages in thread From: Andreas Röhler @ 2016-07-03 19:57 UTC (permalink / raw) To: Alan Mackenzie; +Cc: emacs-devel On 03.07.2016 20:56, Alan Mackenzie wrote: > Hello, Andreas. > > On Sun, Jul 03, 2016 at 08:36:56PM +0200, Andreas Röhler wrote: > > >> On 30.06.2016 17:30, Eli Zaretskii wrote: >>>> From: Robert Weiner <rsw@gnu.org> >>>> Date: Thu, 30 Jun 2016 10:25:26 -0400 >>>> Cc: Richard Stallman <rms@gnu.org>, emacs-devel <emacs-devel@gnu.org> >>>> It would be nice if John and Eli could just make some final >>>> decision on the interactive-p issue and then put that one to rest, >>>> whatever it is. >>> I have no opinion on the subject, except the general principle that >>> we shouldn't back up on past decisions unless they are truly >>> disastrous, >> They are. This is another example from a couple of issues which went >> wrong last years. Code was made swollen up and complicated, simple >> solutions rejected. > This is the sort of thing liable to make people unhappy with your > postings. Hmm, that's not the intended thing. > Please say exactly what has become turgid and complicated, > where simple solutions have been rejected. Possibly those simple > solutions were too simple. The moment interactive-p was deprecated against the form discussed here, argued detailed against it. IIRC also did Drew. It already took hours - in vain so far. > >> BTW a characteristic design-flaw beyond mentioned last days is around >> use-region-p. With use-empty-active-region or region-active-p it >> hardly comes to an end. > What hardly comes to an end? Are you talking about a loop in the code, > our discussion on emacs-devel, or a design flaw not coming to an end? > The redundancy should be visible by the symbols given. Why to employ three symbols pointing at the same? This also was discussed in extenso and a simple form replaced by a complicated one. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-03 18:36 ` Andreas Röhler 2016-07-03 18:56 ` Alan Mackenzie @ 2016-07-03 19:31 ` Eli Zaretskii 1 sibling, 0 replies; 37+ messages in thread From: Eli Zaretskii @ 2016-07-03 19:31 UTC (permalink / raw) To: Andreas Röhler; +Cc: emacs-devel > From: Andreas Röhler <andreas.roehler@online.de> > Date: Sun, 3 Jul 2016 20:36:56 +0200 > > On 30.06.2016 17:30, Eli Zaretskii wrote: > >> From: Robert Weiner <rsw@gnu.org> > >> Date: Thu, 30 Jun 2016 10:25:26 -0400 > >> Cc: Richard Stallman <rms@gnu.org>, emacs-devel <emacs-devel@gnu.org> > >> > >> It would be nice if John and Eli could just make some final decision > >> on the interactive-p issue and then put that one to rest, whatever it > >> is. > > I have no opinion on the subject, except the general principle that we > > shouldn't back up on past decisions unless they are truly disastrous, > > They are. Once again, please back up your assertions with some clear-cut evidence. A disastrous decision should not be hard to show as such: just come up with a couple of examples where this decision causes a disaster. This: > This is another example from a couple of issues which went > wrong last years. > Code was made swollen up and complicated, simple solutions rejected. > > BTW a characteristic design-flaw beyond mentioned last days is around > use-region-p. > With use-empty-active-region or region-active-p it hardly comes to an end. doesn't even come close. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-30 14:25 ` Robert Weiner 2016-06-30 15:30 ` Eli Zaretskii @ 2016-06-30 15:34 ` raman 1 sibling, 0 replies; 37+ messages in thread From: raman @ 2016-06-30 15:34 UTC (permalink / raw) To: Robert Weiner; +Cc: rswgnu, Richard Stallman, emacs-devel Undeprecating it would be a good solution IMHO, but it was also rejected at the time, perhaps there has been enough water under the bridge that one could revisit that. -- ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-29 20:54 ` Robert Weiner ` (2 preceding siblings ...) 2016-06-30 2:51 ` raman @ 2016-07-03 0:10 ` Richard Stallman 3 siblings, 0 replies; 37+ messages in thread From: Richard Stallman @ 2016-07-03 0:10 UTC (permalink / raw) To: rswgnu; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > Telling people to ignore the choice, or choose at random, while > > the choice is still necessary, would not be better design. > That is an argument for never allowing optional parameters to > functions. Only in certain special cases, where the omission of the argument is a pitfall for specific reasons. I am not sure what is right to do here, and I don't want to study the issue enough to reach a conclusion. So I don't have views about what we should do. I just disagreed with a particular argument. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-06-28 20:29 ` Glenn Morris 2016-06-28 20:46 ` Robert Weiner @ 2016-07-06 0:09 ` John Wiegley 2016-07-06 0:21 ` Dmitry Gutov 2016-07-06 0:24 ` Noam Postavsky 1 sibling, 2 replies; 37+ messages in thread From: John Wiegley @ 2016-07-06 0:09 UTC (permalink / raw) To: emacs-devel [-- Attachment #1: Type: text/plain, Size: 1701 bytes --] >>>>> Glenn Morris <rgm+news@gnu.org> writes: > It's easy to search for prior discussion on this. Eg > http://lists.gnu.org/archive/html/emacs-devel/2015-07/msg00326.html > That would defeat the whole purpose (which is to force the author to make > a choice between the two kinds, rather than to use one without knowing > that there's a choice). I do not think this is a good argument. Desiring authors to know about such a distinction is one thing; so document it well. But forcing authors who *do* know the distinction to be explicit about it always -- just so they don't miss out on becoming educated the first time -- is poor design. Simple and common patterns should be simple, because they are common. They should not be made laborious "to promote education". If a developer is uneducated about the options, they can be made aware. This isn't the only place where a mistake can be made by choosing an incorrect option without warning. Is a bad argument to `called-interactively-p' really so dangerous that we require a conscious choice for every point of use? Cargo-culting will result in this explicit option being copied without understanding anyway, so the explicitness is not a guarantee against misuse. I'm completely OK with a patch to undeprecate (interactive-p), even if this reverses previous decisions. I do not feel beholden to past thinking that makes little sense to me, just for petty consistency; I trust people can learn to adapt to any change we make (or, in this case, unmake). -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 629 bytes --] ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:09 ` John Wiegley @ 2016-07-06 0:21 ` Dmitry Gutov 2016-07-06 0:31 ` John Wiegley 2016-07-06 0:24 ` Noam Postavsky 1 sibling, 1 reply; 37+ messages in thread From: Dmitry Gutov @ 2016-07-06 0:21 UTC (permalink / raw) To: emacs-devel On 07/06/2016 03:09 AM, John Wiegley wrote: > I do not think this is a good argument. Desiring authors to know about such a > distinction is one thing; so document it well. But forcing authors who *do* > know the distinction to be explicit about it always -- just so they don't miss > out on becoming educated the first time -- is poor design. I think the reasons for making it verbose and in-your-face are rather clearly decribed in the last paragraphs of called-interactively-p's docstring. As the docstring explains, the function in question should be used rarely, if at all. It should follow that the verbosity of its calling convention can't be a significant problem. > Simple and common patterns should be simple, because they are common. "simple and common", yes. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:21 ` Dmitry Gutov @ 2016-07-06 0:31 ` John Wiegley 2016-07-06 1:46 ` raman 2016-07-06 14:48 ` Eli Zaretskii 0 siblings, 2 replies; 37+ messages in thread From: John Wiegley @ 2016-07-06 0:31 UTC (permalink / raw) To: Dmitry Gutov; +Cc: emacs-devel >>>>> Dmitry Gutov <dgutov@yandex.ru> writes: > As the docstring explains, the function in question should be used rarely, > if at all. It should follow that the verbosity of its calling convention > can't be a significant problem. If this is the case, I'm curious why this is an issue at all then. Bob, is really a problem that needs addressing, or is it just for infrequent convenience? If it's only the latter, let's leave this sleeping dog to lie. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:31 ` John Wiegley @ 2016-07-06 1:46 ` raman 2016-07-06 2:05 ` Dmitry Gutov 2016-07-06 14:49 ` Eli Zaretskii 2016-07-06 14:48 ` Eli Zaretskii 1 sibling, 2 replies; 37+ messages in thread From: raman @ 2016-07-06 1:46 UTC (permalink / raw) To: Dmitry Gutov; +Cc: emacs-devel Here's one example of a large package (Emacspeak) and the number of times the equivalent of interactive-p is used: It would be interesting to validate the assertion "it's not used often" by examining other large packages as well. Note: ems-interactive-p is what I wrote when interactive-p got deprecated. grep ems-interactive-p *.el | wc 1607 4781 79080 Lines Of Elisp In Emacspeak: 18:44:33 raman-glaptop2 lisp $ wc *.el ... 79781 256614 2624155 total -- ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 1:46 ` raman @ 2016-07-06 2:05 ` Dmitry Gutov 2016-07-06 14:49 ` Eli Zaretskii 1 sibling, 0 replies; 37+ messages in thread From: Dmitry Gutov @ 2016-07-06 2:05 UTC (permalink / raw) To: raman; +Cc: emacs-devel On 07/06/2016 04:46 AM, raman wrote: > Here's one example of a large package (Emacspeak) and the number of > times the equivalent of interactive-p is used: It would be interesting > to validate the assertion "it's not used often" by examining other > large packages as well. The assertion is "it should not be used often", not "it is not used often". ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 1:46 ` raman 2016-07-06 2:05 ` Dmitry Gutov @ 2016-07-06 14:49 ` Eli Zaretskii 2016-07-06 15:14 ` raman 1 sibling, 1 reply; 37+ messages in thread From: Eli Zaretskii @ 2016-07-06 14:49 UTC (permalink / raw) To: raman; +Cc: emacs-devel, dgutov > From: raman <raman@google.com> > Date: Tue, 05 Jul 2016 18:46:31 -0700 > Cc: emacs-devel@gnu.org > > Here's one example of a large package (Emacspeak) and the number of > times the equivalent of interactive-p is used: It would be interesting > to validate the assertion "it's not used often" by examining other > large packages as well. > > Note: ems-interactive-p is what I wrote when interactive-p got > deprecated. > > grep ems-interactive-p *.el | wc > 1607 4781 79080 > Lines Of Elisp In Emacspeak: > 18:44:33 raman-glaptop2 lisp $ wc *.el > ... > 79781 256614 2624155 total Did this change after Stefan fixed the bug you reported? Did you try to see afterwards whether the problems you recall are still there or solved? ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 14:49 ` Eli Zaretskii @ 2016-07-06 15:14 ` raman 0 siblings, 0 replies; 37+ messages in thread From: raman @ 2016-07-06 15:14 UTC (permalink / raw) To: Eli Zaretskii; +Cc: dgutov, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: From memory the problem with called-interactively-p failing when called from inside an around advice remain, Stefan fixed part of the bug, but I also remember him saying that he was putting the rest of it on a stack for some future fix.>> From: raman <raman@google.com> >> Date: Tue, 05 Jul 2016 18:46:31 -0700 >> Cc: emacs-devel@gnu.org >> >> Here's one example of a large package (Emacspeak) and the number of >> times the equivalent of interactive-p is used: It would be interesting >> to validate the assertion "it's not used often" by examining other >> large packages as well. >> >> Note: ems-interactive-p is what I wrote when interactive-p got >> deprecated. >> >> grep ems-interactive-p *.el | wc >> 1607 4781 79080 >> Lines Of Elisp In Emacspeak: >> 18:44:33 raman-glaptop2 lisp $ wc *.el >> ... >> 79781 256614 2624155 total > > Did this change after Stefan fixed the bug you reported? Did you try > to see afterwards whether the problems you recall are still there or > solved? > -- ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:31 ` John Wiegley 2016-07-06 1:46 ` raman @ 2016-07-06 14:48 ` Eli Zaretskii 2016-07-06 15:20 ` Robert Weiner 1 sibling, 1 reply; 37+ messages in thread From: Eli Zaretskii @ 2016-07-06 14:48 UTC (permalink / raw) To: John Wiegley, Stefan Monnier; +Cc: emacs-devel > From: John Wiegley <jwiegley@gmail.com> > Date: Tue, 05 Jul 2016 17:31:26 -0700 > Cc: emacs-devel@gnu.org > > >>>>> Dmitry Gutov <dgutov@yandex.ru> writes: > > > As the docstring explains, the function in question should be used rarely, > > if at all. It should follow that the verbosity of its calling convention > > can't be a significant problem. > > If this is the case, I'm curious why this is an issue at all then. Bob, is > really a problem that needs addressing, or is it just for infrequent > convenience? If it's only the latter, let's leave this sleeping dog to lie. IMO, if we want to make a rational decision that would make sense to most everybody, we need first to define the problem. After reading this and past discussions, I'm still not sure what the problem(s) is/are. What's more, I'm not sure anyone else here understands the actual problem(s) being brought up. Large portions of the discussions seem to be based on distant experiences, which I'm not sure is relevant nowadays, and the problems are described very vaguely. A couple of times that an actual problem was reported (e.g., bug#21083), it was promptly fixed, but I don't see any updated reports after it was fixed, it seems people are still claiming the same claims regardless of the fix. So: what exactly is the problem? Is it a convenience issue, or are there some real problems in the recommended replacements for 'interactive-p' (such as 'called-interactively-p')? Do we have reproducible recipes for the problems the recommended practices allegedly have? If so, would someone please present these recipes with the current versions of Emacs, preferably as bug reports? I'd also ask Stefan to please summarize the reasons for deprecating 'interactive-p' and describe its recommended substitutes for the popular use cases. Armed with that knowledge, we can hopefully proceed with the subject: fix the bugs, clarify the documentation, and make the decision whether the recommended practices are viable or need some changes. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 14:48 ` Eli Zaretskii @ 2016-07-06 15:20 ` Robert Weiner 0 siblings, 0 replies; 37+ messages in thread From: Robert Weiner @ 2016-07-06 15:20 UTC (permalink / raw) To: Eli Zaretskii; +Cc: John Wiegley, Stefan Monnier, emacs-devel On Wed, Jul 6, 2016 at 10:48 AM, Eli Zaretskii <eliz@gnu.org> wrote: > So: what exactly is the problem? Is it a convenience issue, or are > there some real problems in the recommended replacements for > 'interactive-p' (such as 'called-interactively-p')? I agree with Eli that a good summary, hopefully with examples, of why one always needs to give an argument to called-interactively-p would be helpful and how making its argument optional could cause problems, if that is indeed the case. I do think called-interactively-p is a better name for the function than interactive-p and that is why I originally suggested just making the argument to it optional, defaulting to the same behavior as when it is given an 'interactive argument. My first post in this thread is a good summary of why the change was suggested, which was for ease of code writing and reading, not any operational problem. Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:09 ` John Wiegley 2016-07-06 0:21 ` Dmitry Gutov @ 2016-07-06 0:24 ` Noam Postavsky 2016-07-06 5:03 ` Robert Weiner 1 sibling, 1 reply; 37+ messages in thread From: Noam Postavsky @ 2016-07-06 0:24 UTC (permalink / raw) To: Emacs developers On Tue, Jul 5, 2016 at 8:09 PM, John Wiegley <jwiegley@gmail.com> 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 ‘call-interactively’ is to give it an optional argument ‘print-message’ and use the ‘interactive’ spec to make it non-‘nil’ in interactive calls. Here’s an example: (defun foo (&optional print-message) (interactive "p") (when print-message (message "foo"))) We use ‘"p"’ because the numeric prefix argument is never ‘nil’. 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 “treat this call as interactive”. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 0:24 ` Noam Postavsky @ 2016-07-06 5:03 ` Robert Weiner 2016-07-06 6:45 ` Andreas Röhler 0 siblings, 1 reply; 37+ messages in thread From: Robert Weiner @ 2016-07-06 5:03 UTC (permalink / raw) To: Noam Postavsky; +Cc: Emacs developers On Tue, Jul 5, 2016 at 8:24 PM, Noam Postavsky <npostavs@users.sourceforge.net> wrote: > The recommended way to test whether the function was called using > ‘call-interactively’ is to give it an optional argument > ‘print-message’ and use the ‘interactive’ spec to make it > non-‘nil’ in interactive calls. Here’s an example: > > (defun foo (&optional print-message) > (interactive "p") > (when print-message > (message "foo"))) This makes little sense to me. Every time I have a function that needs to test whether it was called interactively you want me to add essentially an interactive-flag to its argument signature and then never send this argument when called non-interactively since the caller won't care and the argument is optional so it will be nil by default. Again, why should we name and have to look at an argument to the function when the interactive test we want is internal to it. This is similar to the argument that we shouldn't have to send the default 'interactive argument to called-interactively-p. I'm with John, let's simplify this. Let's undeprecate (interactive-p). Did people actually have problems with that that kept coming up? Raman and I seemed to have used it for years without encountering any. And John, if you undeprecate it do you really need a patch or can you just change it? Bob ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional 2016-07-06 5:03 ` Robert Weiner @ 2016-07-06 6:45 ` Andreas Röhler 0 siblings, 0 replies; 37+ messages in thread From: Andreas Röhler @ 2016-07-06 6:45 UTC (permalink / raw) To: emacs-devel On 06.07.2016 07:03, Robert Weiner wrote: > On Tue, Jul 5, 2016 at 8:24 PM, Noam Postavsky > <npostavs@users.sourceforge.net> wrote: >> The recommended way to test whether the function was called using >> ‘call-interactively’ is to give it an optional argument >> ‘print-message’ and use the ‘interactive’ spec to make it >> non-‘nil’ in interactive calls. Here’s an example: >> >> (defun foo (&optional print-message) >> (interactive "p") >> (when print-message >> (message "foo"))) > This makes little sense to me. Every time I have a function that > needs to test whether it was called interactively you want me to add > essentially an interactive-flag to its argument signature and then > never send this argument when called non-interactively since the > caller won't care and the argument is optional so it will be nil by > default. Again, why should we name and have to look at an argument to > the function when the interactive test we want is internal to it. > This is similar to the argument that we shouldn't have to send the > default 'interactive argument to called-interactively-p. > > I'm with John, let's simplify this. Let's undeprecate > (interactive-p). Did people actually have problems with that that > kept coming up? Raman and I seemed to have used it for years without > encountering any. > > And John, if you undeprecate it do you really need a patch or can you > just change it? > > Bob > 1+ ^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2016-07-06 15:20 UTC | newest] Thread overview: 37+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-27 20:35 Emacs 25.0.04: Feature Request: Make called-interactively-p's argument optional Robert Weiner 2016-06-28 19:09 ` John Wiegley 2016-06-28 20:28 ` Robert Weiner 2016-06-30 16:54 ` Andreas Röhler 2016-06-28 20:29 ` Glenn Morris 2016-06-28 20:46 ` Robert Weiner 2016-06-28 20:51 ` Robert Weiner 2016-06-29 20:02 ` Richard Stallman 2016-06-29 20:54 ` Robert Weiner 2016-06-29 21:19 ` Drew Adams 2016-06-29 21:39 ` Robert Weiner 2016-06-29 21:48 ` Robert Weiner 2016-06-30 23:18 ` Richard Stallman 2016-06-29 21:21 ` Clément Pit--Claudel 2016-06-29 21:52 ` Dmitry Gutov 2016-06-29 22:00 ` Robert Weiner 2016-06-30 2:51 ` raman 2016-06-30 14:25 ` Robert Weiner 2016-06-30 15:30 ` Eli Zaretskii 2016-07-03 18:36 ` Andreas Röhler 2016-07-03 18:56 ` Alan Mackenzie 2016-07-03 19:57 ` Andreas Röhler 2016-07-03 19:31 ` Eli Zaretskii 2016-06-30 15:34 ` raman 2016-07-03 0:10 ` Richard Stallman 2016-07-06 0:09 ` John Wiegley 2016-07-06 0:21 ` Dmitry Gutov 2016-07-06 0:31 ` John Wiegley 2016-07-06 1:46 ` raman 2016-07-06 2:05 ` Dmitry Gutov 2016-07-06 14:49 ` Eli Zaretskii 2016-07-06 15:14 ` raman 2016-07-06 14:48 ` Eli Zaretskii 2016-07-06 15:20 ` Robert Weiner 2016-07-06 0:24 ` Noam Postavsky 2016-07-06 5:03 ` Robert Weiner 2016-07-06 6:45 ` Andreas Röhler
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).