emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-mouse.el breaks org-open-at-point
@ 2022-12-11  3:26 Matt Lundin
  2022-12-11  9:37 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2022-12-11  3:26 UTC (permalink / raw)
  To: emacs-orgmode

The org-mouse feature advises org-open-at-point in a way that overrides
the desired behavior of calling "M-x org-open-at-point" on a headline.

See the advice function org--mouse-open-at-point. It seems the intended
behavior of this advice is to allow the user to click on headline stars
and cycle the visibility of an entry. However, there is no test to see
if the user is indeed clicking with a mouse.

As a result, this advice also overrides org-open-at-point even when one
is typing.

- Expected behavior 

  - calling org-open-at-point with the keyboard "C-c C-o" should produce
    a list of links in the entry as advertised in the docstring ("When
    point is on a headline, display a list of every link in the entry,
    so it is possible to pick one, or all, of them.")

- What currently happens if org-mouse has been loaded:

  - calling "C-c C-o" with the keyboard cycles the visibility of the
    entry

Thanks,

Matt


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

* Re: [BUG] org-mouse.el breaks org-open-at-point
  2022-12-11  3:26 [BUG] org-mouse.el breaks org-open-at-point Matt Lundin
@ 2022-12-11  9:37 ` Ihor Radchenko
  2022-12-13 16:08   ` Matt Lundin
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2022-12-11  9:37 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode

Matt Lundin <mdl@imapmail.org> writes:

> - Expected behavior 
>
>   - calling org-open-at-point with the keyboard "C-c C-o" should produce
>     a list of links in the entry as advertised in the docstring ("When
>     point is on a headline, display a list of every link in the entry,
>     so it is possible to pick one, or all, of them.")
>
> - What currently happens if org-mouse has been loaded:
>
>   - calling "C-c C-o" with the keyboard cycles the visibility of the
>     entry

Confirmed.
Patches welcome!

I think we need to modify `org-open-at-mouse' directly instead of using advice.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-mouse.el breaks org-open-at-point
  2022-12-11  9:37 ` Ihor Radchenko
@ 2022-12-13 16:08   ` Matt Lundin
  2022-12-14  8:05     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2022-12-13 16:08 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Matt Lundin <mdl@imapmail.org> writes:

>> - What currently happens if org-mouse has been loaded:
>>
>>   - calling "C-c C-o" with the keyboard cycles the visibility of the
>>     entry

> Patches welcome!
>
> I think we need to modify `org-open-at-mouse' directly instead of
> using advice.

I can give this a try.

The advice in org-mouse.el currently does the following:

 - cycles when on headline
 - toggles checkbox when on checkbox
 - cycles plain lists when on a list item

Would it make any sense to make this part of the default behavior or
org-open-at-mouse? 

If not, I think I can make it dependent on the value of
org-mouse-features, thus giving user the option of turning off the extra
mouse click behavior via that variable (as a workaround to avoid
undesired side effects of calling interactive help). This would be a
temporary workaround until the org-mouse is converted to a global minor
mode.

Matt


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

* Re: [BUG] org-mouse.el breaks org-open-at-point
  2022-12-13 16:08   ` Matt Lundin
@ 2022-12-14  8:05     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-12-14  8:05 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode

Matt Lundin <mdl@imapmail.org> writes:

>> Patches welcome!
>>
>> I think we need to modify `org-open-at-mouse' directly instead of
>> using advice.
>
> I can give this a try.
>
> The advice in org-mouse.el currently does the following:
>
>  - cycles when on headline
>  - toggles checkbox when on checkbox
>  - cycles plain lists when on a list item
>
> Would it make any sense to make this part of the default behavior or
> org-open-at-mouse? 

Not really. These advised extras do not really belong to "opening"
links. We usually use "action" (C-c C-c) for toggling staff and
"cycling" (TAB) to cycle staff. It's just that "clicking" falls into
"open" paradigm in Emacs, but users also expect "toggle" and "switch
state" as in other applications.

> If not, I think I can make it dependent on the value of
> org-mouse-features, thus giving user the option of turning off the extra
> mouse click behavior via that variable (as a workaround to avoid
> undesired side effects of calling interactive help). This would be a
> temporary workaround until the org-mouse is converted to a global minor
> mode.

I think we can do the following:

1. Introduce new `org-open-at-mouse-first-hook' hook that will be run by
   `org-open-at-mouse' before calling `org-open-at-point'.

2. Introduce `org-mouse-features' as you suggested.

3. Make org-mouse.el add appropriate hooks into
   `org-open-at-mouse-first-hook' according to the value of
   `org-mouse-features'.  The default should keep the current behaviour
   for `org-open-at-mouse'.

4. The new variables are to be documented in etc/ORG-NEWS

5. Ideally, we can convert org-mouse.el to global minor mode immediately
   and turn it on when org-mouse.el is loaded. Then, moving to
   side effect-free loading will be simply a question of removing a
   single statement from org-mouse.el.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2022-12-14  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-11  3:26 [BUG] org-mouse.el breaks org-open-at-point Matt Lundin
2022-12-11  9:37 ` Ihor Radchenko
2022-12-13 16:08   ` Matt Lundin
2022-12-14  8:05     ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).