unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
@ 2021-03-19  8:15 Eli Zaretskii
  2021-03-19  8:28 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-19  8:15 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-devel

> @@ -423,7 +423,7 @@ FILE should be in a form suitable for passing to `locate-library'."
>  
>  (defun finder-mouse-select (event)
>    "Select item in a Finder buffer with the mouse."
> -  (interactive "e")
> +  (interactive "e" finder-mode)
>    (with-current-buffer (window-buffer (posn-window (event-start event)))
>      (goto-char (posn-point (event-start event)))
>      (finder-select)))

I think this part is dangerous: mouse commands are not necessarily
issued with the buffer on which they operate being current, so
conditioning such commands on the mode of the current buffer is
ill-advised.  Even if currently this marking doesn't produce any
visible problems (does it?), it could do so in the future, if and when
we decide to base more on this tagging than we do now.

I think this part should be reverted, and in the future commands bound
to mouse clicks should not be tagged with any major mode.

Thanks.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19  8:15 master 050b830 3/3: Do interactive mode tagging for finder.el Eli Zaretskii
@ 2021-03-19  8:28 ` Lars Ingebrigtsen
  2021-03-19  8:37   ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-19  8:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Kangas, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I think this part is dangerous: mouse commands are not necessarily
> issued with the buffer on which they operate being current, so
> conditioning such commands on the mode of the current buffer is
> ill-advised.

It's a command that is applicable only to finder-mode buffers, so I
think the tagging is correct?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19  8:28 ` Lars Ingebrigtsen
@ 2021-03-19  8:37   ` Eli Zaretskii
  2021-03-19 16:23     ` Stefan Kangas
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-19  8:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Stefan Kangas <stefan@marxist.se>,  emacs-devel@gnu.org
> Date: Fri, 19 Mar 2021 09:28:16 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I think this part is dangerous: mouse commands are not necessarily
> > issued with the buffer on which they operate being current, so
> > conditioning such commands on the mode of the current buffer is
> > ill-advised.
> 
> It's a command that is applicable only to finder-mode buffers, so I
> think the tagging is correct?

It depends on what we do with the tag.

"Applicable only to finder-mode buffers" doesn't tell how we use this
information.  We use it to filter out commands as irrelevant in
certain contexts.  But this command _is_ relevant even when the major
mode of the current buffer is something other than finder-mode,
because the user can click on text in a non-selected window.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19  8:37   ` Eli Zaretskii
@ 2021-03-19 16:23     ` Stefan Kangas
  2021-03-19 16:35       ` Eli Zaretskii
  2021-03-19 17:22       ` Dmitry Gutov
  0 siblings, 2 replies; 16+ messages in thread
From: Stefan Kangas @ 2021-03-19 16:23 UTC (permalink / raw)
  To: Eli Zaretskii, Lars Ingebrigtsen; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> It's a command that is applicable only to finder-mode buffers, so I
>> think the tagging is correct?
>
> It depends on what we do with the tag.
>
> "Applicable only to finder-mode buffers" doesn't tell how we use this
> information.  We use it to filter out commands as irrelevant in
> certain contexts.  But this command _is_ relevant even when the major
> mode of the current buffer is something other than finder-mode,
> because the user can click on text in a non-selected window.

Currently we use it to filter commands in `M-x', where you anyways can't
use it (it will signal an error as EVENT is not bound).  So this change
doesn't break anything.  What am I missing?

If the above is correct, then that also means that there is no point to
show such commands even in `finder-mode'.  So it would be even better to
add some form that marks a command as only relevant to the mouse and
then never show those commands in `M-x'.  ISTR we discussed something
like that but I'm not sure if we reached any conclusion.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 16:23     ` Stefan Kangas
@ 2021-03-19 16:35       ` Eli Zaretskii
  2021-03-19 17:08         ` Stefan Kangas
  2021-03-20  7:51         ` Lars Ingebrigtsen
  2021-03-19 17:22       ` Dmitry Gutov
  1 sibling, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-19 16:35 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: larsi, emacs-devel

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 19 Mar 2021 11:23:25 -0500
> Cc: emacs-devel@gnu.org
> 
> Currently we use it to filter commands in `M-x', where you anyways can't
> use it (it will signal an error as EVENT is not bound).  So this change
> doesn't break anything.  What am I missing?

You are missing what I wrote in my OP.

> If the above is correct, then that also means that there is no point to
> show such commands even in `finder-mode'.  So it would be even better to
> add some form that marks a command as only relevant to the mouse and
> then never show those commands in `M-x'.  ISTR we discussed something
> like that but I'm not sure if we reached any conclusion.

That's a separate issue.  My point is that we shouldn't tag commands
with a mode unless we are 110% sure this tagging is correct and cannot
do any harm.  If there's doubt, there's no doubt.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 16:35       ` Eli Zaretskii
@ 2021-03-19 17:08         ` Stefan Kangas
  2021-03-19 19:39           ` Eli Zaretskii
  2021-03-20  7:51         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Kangas @ 2021-03-19 17:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> If the above is correct, then that also means that there is no point to
>> show such commands even in `finder-mode'.  So it would be even better to
>> add some form that marks a command as only relevant to the mouse and
>> then never show those commands in `M-x'.  ISTR we discussed something
>> like that but I'm not sure if we reached any conclusion.
>
> That's a separate issue.  My point is that we shouldn't tag commands
> with a mode unless we are 110% sure this tagging is correct and cannot
> do any harm.  If there's doubt, there's no doubt.

Makes sense.  I'll revert that part of the change.

Should we take this opportunity to discuss the above, though?  I think
it would be useful to have something like it.  But I don't have any
great ideas for what it could look like.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 16:23     ` Stefan Kangas
  2021-03-19 16:35       ` Eli Zaretskii
@ 2021-03-19 17:22       ` Dmitry Gutov
  2021-03-19 17:47         ` Stefan Monnier
  1 sibling, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2021-03-19 17:22 UTC (permalink / raw)
  To: Stefan Kangas, Eli Zaretskii, Lars Ingebrigtsen; +Cc: emacs-devel

On 19.03.2021 18:23, Stefan Kangas wrote:
> So it would be even better to
> add some form that marks a command as only relevant to the mouse and
> then never show those commands in `M-x'.

Perhaps that could be inferred from the presence of 'e' in the 
interactive spec?



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 17:22       ` Dmitry Gutov
@ 2021-03-19 17:47         ` Stefan Monnier
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2021-03-19 17:47 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Eli Zaretskii, Stefan Kangas, Lars Ingebrigtsen, emacs-devel

>> So it would be even better to
>> add some form that marks a command as only relevant to the mouse and
>> then never show those commands in `M-x'.
>
> Perhaps that could be inferred from the presence of 'e' in the
> interactive spec?

`@` in the interactive spec seems even more relevant.


        Stefan




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 17:08         ` Stefan Kangas
@ 2021-03-19 19:39           ` Eli Zaretskii
  2021-03-19 19:55             ` [External] : " Drew Adams
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-19 19:39 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: larsi, emacs-devel

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 19 Mar 2021 12:08:00 -0500
> Cc: larsi@gnus.org, emacs-devel@gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> If the above is correct, then that also means that there is no point to
> >> show such commands even in `finder-mode'.  So it would be even better to
> >> add some form that marks a command as only relevant to the mouse and
> >> then never show those commands in `M-x'.  ISTR we discussed something
> >> like that but I'm not sure if we reached any conclusion.
> >
> > That's a separate issue.  My point is that we shouldn't tag commands
> > with a mode unless we are 110% sure this tagging is correct and cannot
> > do any harm.  If there's doubt, there's no doubt.
> 
> Makes sense.  I'll revert that part of the change.

Thanks.

> Should we take this opportunity to discuss the above, though?  I think
> it would be useful to have something like it.  But I don't have any
> great ideas for what it could look like.

Sure, let's discuss.  For starters, how about not showing in "M-x"
completions any commands whose interactive spec expects a mouse event?



^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [External] : Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 19:39           ` Eli Zaretskii
@ 2021-03-19 19:55             ` Drew Adams
  0 siblings, 0 replies; 16+ messages in thread
From: Drew Adams @ 2021-03-19 19:55 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: larsi@gnus.org, emacs-devel@gnu.org

> Sure, let's discuss.  For starters, how about not showing in "M-x"
> completions any commands whose interactive spec expects a mouse event?

Once again, I hope you're talking about optional
behavior.  And hopefully opt-in.

(Cue the recent discussion about using `M-x' for
more than just invoking a command.)



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-19 16:35       ` Eli Zaretskii
  2021-03-19 17:08         ` Stefan Kangas
@ 2021-03-20  7:51         ` Lars Ingebrigtsen
  2021-03-20  8:15           ` Lars Ingebrigtsen
  2021-03-20  9:02           ` Eli Zaretskii
  1 sibling, 2 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-20  7:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Kangas, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> That's a separate issue.  My point is that we shouldn't tag commands
> with a mode unless we are 110% sure this tagging is correct and cannot
> do any harm.  If there's doubt, there's no doubt.

There is no doubt.  This is a mode-specific command and should be tagged
as such.

Now, what we do with the tagging later is a different issue.  The
combination of a mode tagging + "e" spec suggests that we can do
something more.

But Stefan's tagging is 100% correct, and should not be reverted.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-20  7:51         ` Lars Ingebrigtsen
@ 2021-03-20  8:15           ` Lars Ingebrigtsen
  2021-03-20  9:02           ` Eli Zaretskii
  1 sibling, 0 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-20  8:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Kangas, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> There is no doubt.  This is a mode-specific command and should be tagged
> as such.

(If there is something missing in the manual to clarify why this tagging
is correct, perhaps that can be added, so that no doubt remains for
anybody?)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-20  7:51         ` Lars Ingebrigtsen
  2021-03-20  8:15           ` Lars Ingebrigtsen
@ 2021-03-20  9:02           ` Eli Zaretskii
  2021-03-20  9:05             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-20  9:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Stefan Kangas <stefan@marxist.se>,  emacs-devel@gnu.org
> Date: Sat, 20 Mar 2021 08:51:33 +0100
> 
> This is a mode-specific command

But it isn't: I can issue this command from a buffer that is under
_any_ mode.

I guess the disagreement is about what exactly does "mode-specific"
mean here.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-20  9:02           ` Eli Zaretskii
@ 2021-03-20  9:05             ` Lars Ingebrigtsen
  2021-03-20  9:23               ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-20  9:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: stefan, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I guess the disagreement is about what exactly does "mode-specific"
> mean here.

If there are unclear points in the manual under

  21.2.4 Specifying Modes For Commands

I can try to clarify.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-20  9:05             ` Lars Ingebrigtsen
@ 2021-03-20  9:23               ` Eli Zaretskii
  2021-03-21  7:47                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2021-03-20  9:23 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: stefan@marxist.se,  emacs-devel@gnu.org
> Date: Sat, 20 Mar 2021 10:05:48 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I guess the disagreement is about what exactly does "mode-specific"
> > mean here.
> 
> If there are unclear points in the manual under
> 
>   21.2.4 Specifying Modes For Commands
> 
> I can try to clarify.

Just what I wrote above: that subsection talks about commands "tied to
a mode", or commands that can be used "in pretty much any mode", or
make no sense "outside" of a mode, or commands that "belong to a
mode", without clarifying what that means.

My interpretation of the notion of "being in the FOO mode" is that the
current buffer has FOO as its major mode.  Under that interpretation,
commands that can only be invoked by mouse gestures cannot be
"mode-specific", because such commands normally can be invoked while
the current buffer is any buffer under any mode.  The relevant buffer
is provided by the mouse event, not by the current buffer.



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: master 050b830 3/3: Do interactive mode tagging for finder.el
  2021-03-20  9:23               ` Eli Zaretskii
@ 2021-03-21  7:47                 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-21  7:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: stefan, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> My interpretation of the notion of "being in the FOO mode" is that the
> current buffer has FOO as its major mode.  Under that interpretation,
> commands that can only be invoked by mouse gestures cannot be
> "mode-specific", because such commands normally can be invoked while
> the current buffer is any buffer under any mode.  The relevant buffer
> is provided by the mouse event, not by the current buffer.

OK, I'll try to clarify that.  The "being in the FOO mode" in a mouse
context is ambiguous (and in that case, the "being" is inherent in the
mouse event, not by `current-buffer'.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-03-21  7:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19  8:15 master 050b830 3/3: Do interactive mode tagging for finder.el Eli Zaretskii
2021-03-19  8:28 ` Lars Ingebrigtsen
2021-03-19  8:37   ` Eli Zaretskii
2021-03-19 16:23     ` Stefan Kangas
2021-03-19 16:35       ` Eli Zaretskii
2021-03-19 17:08         ` Stefan Kangas
2021-03-19 19:39           ` Eli Zaretskii
2021-03-19 19:55             ` [External] : " Drew Adams
2021-03-20  7:51         ` Lars Ingebrigtsen
2021-03-20  8:15           ` Lars Ingebrigtsen
2021-03-20  9:02           ` Eli Zaretskii
2021-03-20  9:05             ` Lars Ingebrigtsen
2021-03-20  9:23               ` Eli Zaretskii
2021-03-21  7:47                 ` Lars Ingebrigtsen
2021-03-19 17:22       ` Dmitry Gutov
2021-03-19 17:47         ` Stefan Monnier

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).