Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caml-types-explore (emacs) #8319

Closed
vicuna opened this issue Oct 9, 2003 · 1 comment
Closed

caml-types-explore (emacs) #8319

vicuna opened this issue Oct 9, 2003 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 9, 2003

Original bug ID: 1872
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Eric Cooper
Version: 3.07
OS: i686 GNU/Linux
Submission from: 12-203-149-172.client.attbi.com (12.203.149.172)

The emacs function caml-types-explore, bound to the middle mouse button, works
fine while the mouse button is held down, but produces an error when the mouse
button is released:
Invalid function: #

The problem is the (unwind-protect (caml-track-mouse ...) ...) form. It works
OK if you replace caml-track-mouse by track-mouse. I assume the defalias
doesn't work because track-mouse is itself a special form.

A couple of related problems with this function:

The very first time I click on an expression, it displays no type information.
Subsequent clicks work fine.

If there are no .annot files, I get a "wrong type argument: number-or-marker-p"
error. This one is annoying, because it also pastes the X cut buffer at that
point, modifying the file in a random way.

Minor problems aside, this is a great feature -- thanks a lot.

@vicuna
Copy link
Author

vicuna commented Oct 10, 2003

Comment author: administrator

Thanks for you bug report. Every think should now be fixed in the CVS
version.

More precisely...

The emacs function caml-types-explore, bound to the middle mouse button,
works fine while the mouse button is held down, but produces an error when
the mouse button is released:

Invalid function: #

The problem is the (unwind-protect (caml-track-mouse ...) ...) form. It
works OK if you replace caml-track-mouse by track-mouse. I assume the
defalias doesn't work because track-mouse is itself a special form.

Yes. This was a real problem, but only in the compiled version. The
interpreted version worked fine. In fact, we ommitted to add caml-types.el
in the list of files to be complied, hence we did not catch the bug.

The problem is fixed by making caml-track-mouse a macro instead of an alias.

A couple of related problems with this function: The very first time I
click on an expression, it displays no type information. Subsequent
clicks work fine.

Yes. This is now fixed.

If there are no .annot files, I get a "wrong type argument:
number-or-marker-p" error.

Yes. This is now fixed.

This one is annoying, because it also pastes
the X cut buffer at that point, modifying the file in a random way.

This should not appear anymore here as the result of previous fixes.
However, this revealed an underlying problem, and could show up again in
other circumstances. The problem is the following:

'caml-types-explore' is activated by a [mouse-down] event. Then it follows
mouse mouvements, and stops at the first event that is not a mouse
mouvement. If an error occurs, 'caml-types-explore' must exit. In general the
mouse is down; hence the next event will be a mouse release, which in case
it is bound to some action will be executed.

There is not easy fix. I've made two pacthes.

First, in case of an error, I now consume the next event, which in general
be the mouse release event, but not necessarily. I am afraid that looping
for catching the release event could be dangerous in case the event would
have been lost... Hence following an error by a keystroke before releasing
the mouse will still produce the undesirable behavior. Note that
the same problem can occur when successfully exploring types and exiting
through ^G instead of mouse release. The ^G will generate an event that is
not a mouse mouvement and will exit caml-types-explore. Then the mouse
release event will then be executed outside of caml-types-explore.
I hope that these situations are rare.

Still, another change to prevent them was not only to [mouse-down-2] to
caml-types-explore as before, but also [mouse-2] to some nop function.

Hope that this solves all the problems.

    Didier

@vicuna vicuna closed this as completed Oct 13, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant