-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
"Marker points into wrong buffer" with helm-mark-ring and Evil #1891
Comments
Pierre Neidhardt <[email protected]> writes:
This issues has already been reported on Evil's issue tracker
emacs-evil/evil#845 but no progress was made so far. It is not clear
whether the issue comes from Helm, Evil, or an incompatibility between
both. Maybe you can help.
Expected behavior
With follow-mode on, navigate through the different marks.
Actual behavior (from emacs-helm.sh if possible, see note at the bottom)
(if rectangle-mark-mode (rectangle-exchange-point-and-mark) (helm-all-mark-rings))
helm-mark-or-exchange-rect()
funcall-interactively(helm-mark-or-exchange-rect)
What is `helm-mark-or-exchange-rect`?
…--
Thierry
|
Sorry, that was the trace from a non-vanilla session. Here is the vanilla trace:
I realized something else: I don't need to turn Evil on to generate the issue, and I don't even need any other mark than a few marks created with My
|
Pierre Neidhardt <[email protected]> writes:
I realized something else: I don't need to turn Evil on to generate
the issue
But evil is loaded, right?
Can you reproduce without evil loaded?
Here without evil (I don't use this) I can't reproduce, seems evil is
doing something wrong with marks to end up with #<marker in no buffer>?
…--
Thierry
|
Evil is loaded with |
I also noticed that after I see the error message, I see that the mark-ring gets corrupted when I check its value: some elements get replaced by other elements of the ring, so that in the end there are a lot of duplicates. Example:
|
Pierre Neidhardt <[email protected]> writes:
I also noticed that the mark-ring gets corrupted: some elements get
replaced by other elements of the ring, so that in the end there are a
lot of duplicates.
Not here without using evil:
(#<marker at 11803 in helm-ring.el> #<marker at 11240 in helm-ring.el> #<marker at 10979 in helm-ring.el> #<marker at 10717 in helm-ring.el> #<marker at 10337 in helm-ring.el> #<marker at 9324 in helm-ring.el> #<marker at 9678 in helm-ring.el> #<marker at 4472 in helm-ring.el>)
…--
Thierry
|
Of course, all issues in this report imply that Evil is |
Pierre Neidhardt <[email protected]> writes:
Of course, all issues in this report imply that Evil is required.
Yes, but if helm without evil have no duplicates, what about evil (just
loaded, not activated) without helm loaded ?
…--
Thierry
|
Some updates: emacs-evil/evil#845
I've investigated the state of the mark ring a little bit:
|
Pierre Neidhardt <[email protected]> writes:
Some updates: emacs-evil/evil#845
Bug was reproduced.
helm-mark-ring is a sync source, so I'm not quite sure why a timer
would be involved. Any clue on this?
Helm is always using a timer, in any kind of sources.
I've investigated the state of the mark ring a little bit:
* Without helm/evil, well, it only changes on C-SPC and the like. Mostly explicit commands.
* With Helm only, starting helm-mark-ring, browsing with follow mode on, and then quitting with C-g does not modify the mark-ring. If however I confirm
instead of quitting (RET), then a new mark is added to the ring. (The previous entries are left untouched.) I'm not sure why that is, considering it's a
ring, it should only change it's starting position, shouldn't it? I think there is something wrong here.
* With Evil only, I get a similar behaviour when I set some marks and I navigate them with C-o/C-i.
* With Helm+Evil, it corrupts the entire ring: markers are duplicated, replaced, swapped, etc. There might be a pattern but I haven't figured it out yet.
…--
Thierry
|
I checked out 178a216, I can still reproduce. |
Pierre Neidhardt <[email protected]> writes:
I checked out 178a216, I can still reproduce.
Can you reproduce yourself?
I am not using evil.
…--
Thierry
|
I understand, but can you install it? It's on MELPA, there is nothing to configure but |
and remove obsolete prefix args for mark in grep/occur actions fns. * helm-grep.el (helm-grep-action): Do it, signature have changed. (helm-grep-persistent-action): Fix call to helm-grep-action. * helm-regexp.el (helm-moccur-action): Same as helm-grep-action. (helm-moccur-goto-line): Remove prefix arg usage. (helm-moccur-goto-line-ow): Remove prefix arg usage. (helm-moccur-goto-line-of): Remove prefix arg usage.
Pierre Neidhardt <[email protected]> writes:
I understand, but can you install it? It's on MELPA, there is nothing to configure but ``require 'evil)`.
I could reproduce duplicates with only helm, should be fixed now, I have
no more duplicates.
Then, I have installed evil and required it, and yes I have now duplicates,
but I have no errors from helm, I can navigate tags with follow-mode
enabled and jump to a tag with RET as expected.
… —
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.*
--
Thierry
|
There is nothing to fix here as the bug with dups in mark-ring comes from `push-mark` itself, advising `push-mark` fixes the problem. * helm-ring.el (helm-mark-ring-get-candidates): Push current mark to mark-ring when it is empty, otherwise use mark-ring. * helm-utils.el (helm-save-current-pos-to-mark-ring): Revert previous.
After investigating I think the problem doesn't come from evil nor helm but from |
I need to do more thorough testing. Thank you so much for this, this issue was by far one of the biggest blockers. |
I've had a look at your patch: looks good to me, but I wonder if upstream like Regardless, would you submit your patch upstream? |
That being said, why do mark duplicates cause |
Pierre Neidhardt <[email protected]> writes:
I've had a look at your patch: looks good to me, but I wonder if
upstream like cl-loops...
They don't.
The cl-lib is require in simple.el where push-mark is defined, but only for cl-assert.
Sadly yes.
Regardless, would you submit your patch upstream?
No, I don't submit bugs nor patchs to emacs anymore.
I can do it too.
If you want, rewrite the patch without cl-loop and submit as yourself,
no problems.
But the fix if accepted will be available only for last emacs.
…--
Thierry
|
Before submitting, I'd need to provide an explanation as for why this fixes the issue (my last comment). Can you explain? |
Pierre Neidhardt <[email protected]> writes:
Before submitting, I'd need to provide an explanation as for why this
fixes the issue (my last comment). Can you explain?
This advice fix two things, the first our issue and the
second update the global mark ring to most recent mark, it also remove
old entries for same buffer.
Perhaps you should report only the first issue and make a second report
for global ring.
So for our issue, the original code push the old mark to mark-ring,
which cause dups when this same marker is already in mark-ring whereas
the new code ensure to remove the marker before adding it on top:
;;old:
(setq mark-ring (cons (copy-marker (mark-marker)) mark-ring))
;;new:
(setq mark-ring (cons marker (delete marker mark-ring)))
…--
Thierry
|
I understand, but why did the duplicates raise the |
Pierre Neidhardt <[email protected]> writes:
I understand, but why did the duplicates raise the "Marker points into wrong buffer" error in helm-mark-ring?
Don't know, I never had this error (even with evil loaded), I only noticed duplicates.
Apparently with no duplicates you don't have such errors anymore?
…--
Thierry
|
Apparently. So you could not reproduce? I'm not sure that will give much incentive to get any patch accepted upstream, but I'll try anyways. |
Pierre Neidhardt <[email protected]> writes:
Apparently. So you could not reproduce? I'm not sure that will give
much incentive to get any patch accepted upstream, but I'll try
anyways.
To reproduce you have from emacs -Q to use C-SPC C-SPC, then move point
somewhere and eval:
(set-marker (mark-marker) (point))
(push-mark)
mark-ring
You should have now one duplicate.
…
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.*
--
Thierry
|
I think they never take care of this because AFAIK there is no ways to use mark-ring in emacs, only the head of the ring, so duplicates are not a problem. |
That's a good point. |
Let's keep in mind though that there probably remains a bug in Helm's code: it should not fail when the mark-ring has duplicates. |
Pierre Neidhardt <[email protected]> writes:
Let's keep in mind though that there still is a bug in Helm's code: it should not fail when the mark-ring has duplicates.
It doesn't, at least here.
…--
Thierry
|
What about providing the advice in helm? |
Sorry to insist, but I'm not sure I understood from your comments: Can you reproduce the issue with my recipe (both helm and evil required) without the advice? @wasamasa could reproduce, so if you can't that would be puzzling. As for the advice: Yes, it could be a good thing, but let's do it cleanly and make sure turning Helm off removes the advice. It would also be a good test ground as there are hundreds users of Helm-unstable, so we would know probably quite soon if this breaks anything. So I suggest you don't publish a stable release for a little while (say 1 month) so we don't force-break everything. |
Pierre Neidhardt <[email protected]> writes:
Sorry to insist, but I'm not sure I understood from your comments:
Can you reproduce the issue with my recipe (both helm and evil
required) without the advice?
I got duplicates but didn't have error when jumping to mark from helm.
Perhaps I didn't insist enough?
I will try to reinstall evil an try again soon.
@wasamasa could reproduce, so if you can't that would be puzzling.
As for the advice: Yes, it could be a good thing, but let's do it
cleanly and make sure turning Helm off removes the advice.
You can accumulate duplicates in mark-ring outside of helm with any code
modifying mark and using push-mark.
So removing the advice when helm is turned of will not prevent us to
have dups in mark-ring.
Otherwise it is what I generally do, removing advices after each helm session.
…--
Thierry
|
even if mark-ring is not empty. * helm-ring.el (helm-mark-ring-get-candidates): Do it and don't copy mark to avoid dups.
Pierre Neidhardt <[email protected]> writes:
Can you reproduce the issue with my recipe (both helm and evil required) without the advice?
Could not reproduce the error after reinstalling evil and retrying.
@wasamasa could reproduce, so if you can't that would be puzzling.
Indeed.
As for the advice: Yes, it could be a good thing, but let's do it
cleanly and make sure turning Helm off removes the advice.
I could get duplicates from emacs -Q just typing C-SPC
C-SPC at different places in a buffer.
So the advice should be always enabled IMO.
…--
Thierry
|
Same as originally. * helm-ring.el (helm-mark-ring-get-candidates): Do it.
* helm-lib.el (helm--advice-push-mark): New advice enabled.
Bug reported upstream: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29110 |
And here is a suggestion from Noam Postavsky:
The discussion suggests that have duplicates in the mark ring is both fine and intended. |
* helm-lib.el (helm-advice-push-mark): Allow using or not an advice for push-mark.
* helm-ring.el (helm-mark-ring-default-action): Check if marker point to a buffer, if so jump to it, calling hook etc.. otherwise remove this marker from mark-ring.
Pierre Neidhardt <[email protected]> writes:
The discussion suggests that have duplicates in the mark ring is both
fine and intended.
As expected, no surprise.
The above suggestion might be a good lead to follow.
Already know this and that's fine as long as there is not a serie of
dereferenced marker in queue, which doesn't happen with a regular use of
markers, but happens if one starts for some reasons to dereference
markers (what Evil does apparently IIUC the comment of its developer).
I pushed a fix that check if marker is referenced to a buffer before
jumping to it and otherwise delete this unreferenced marker from mark-ring.
I made also a defcustom to disable push-mark advice for the fans of
duplicates.
…--
Thierry
|
* helm-ring.el (helm-mark-ring-default-action): Do it.
When the advice is removed, the issue is still here. I might be missing something with the new option, but it seems that turning it off via Custom or with I think the code should be
|
* helm-lib.el (helm-advice-push-mark): Use value of symbol.
Pierre Neidhardt <[email protected]> writes:
When the advice is removed, the issue is still here.
Of course it is, and we can't do anything to fix it, the ball is now in
Evil side.
I might be missing something with the new option, but it seems that
turning it off via Custom or with (setq helm-advice-push-mark nil)
does not remove the advice.
Thanks fixed.
…--
Thierry
|
I think this can be closed as there is no much more to do on our side. |
This issues has already been reported on Evil's issue tracker emacs-evil/evil#845 but no progress was made so far. It is not clear whether the issue comes from Helm, Evil, or an incompatibility between both. Maybe you can help.
Expected behavior
With follow-mode on, navigate through the different marks.
Actual behavior (from
emacs-helm.sh
if possible, see note at the bottom)Some entries follow up to seemingly random locations and an error message is displayed:
Steps to reproduce (recipe)
Use some vim/Evil movements (e.g.Update: Make two different marks with{
and}
over a sequence of paragraphs) to populate the mark ring.C-SPC
.helm-mark-ring
and make sure you have at least 2 entries.helm-follow-mode
withC-c C-f
.Backtraces if any (
M-x toggle-debug-on-error
)Content of the mark-ring:
Describe versions of Helm, Emacs, operating system, etc.
Helm: MELPA
Evil: MELPA
OS: Arch Linux, Gentoo, Ubuntu...
Are you using
emacs-helm.sh
to reproduce this bug (yes/no):With Evil activated.
The text was updated successfully, but these errors were encountered: