link-hint--find-property-with-value: Args out of range
tshu-w opened this issue · 27 comments
I often encounter this error in *mu4e-view*
, I'm not sure whether I should report to mu4e or here, but ace-link works fine before I switch to link-hint. If you need more info, please tell me.
Debugger entered--Lisp error: (args-out-of-range 3939 5294)
text-property-any(3939 5294 invisible nil)
link-hint--find-property-with-value(invisible nil 3939 nil)
link-hint--find-property(invisible 3939 nil)
link-hint--next-property(invisible)
link-hint--find-visible-regions(3939 5278)
link-hint--collect-visible-links()
link-hint--get-links()
link-hint--one(:open)
link-hint-open-link()
funcall-interactively(link-hint-open-link)
command-execute(link-hint-open-link)
This is a link-hint issue. Maybe window-max
can be more than point-max
.. When this happens, can you evaluate (window-max)
and (point-max)
and let me know the value of each?
@noctuid void-function for window-max?
GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.3.0, NS appkit-2022.30 Version 11.2.3 (Build 20D91)) of 2021-03-12
I think I'm hitting the same bug, in my case from Org agenda. I have a frustratingly unhelpful data point to add: this seems to be a "Heisenbug", one that only occurs when you're not looking closely. Why? Because if I edebug-instrument link-hint--one
, which gets called with :open
as in @tshu-w stacktrace above, then ... it works! All I have to do is hit g
(run) when it breaks into edebug. No error, hints appear and I can select one, and the associated action takes effect. If I then un-instrument link-hint--one
, the error returns. Emacs 26.1, link-hint 0.1 (20210410.1506), Org 9.4.6, on Linux Mint Debian Edition 3.
Edit: I also get void-function
for window-max
Edit: In case you mean window-end
, it's smaller by an order of magnitude than point-max
.
Yeah, I meant window-end
. I'm not really sure what the issue is. It looks like in both cases it's happening in a non-file-visiting buffer. Is this easy for you to replicate? Can you provide a minimal org file and agenda command to reproduce?
@noctuid I can't reproduce it for now, next time I will provide the buffer content, @PhilHudson can you reproduce it stably?
@tshu-w From the Org agenda I get the identical stacktrace to you (apart from argument values).
If I run emacs -Q
, set org-agenda-files
to just my ToDo.org
file and eval (require 'link-hint)
and (require avy)
, then link-hint-open-link
runs correctly. So something about my hugely complex setup is interfering.
Here's the value of features
in my fully-loaded and running Emacs: https://gist.github.com/PhilHudson/c443e2ce3611c08777242ea38a7615c9
@PhilHudson I can't reproduce it on my end, so if you can reproduce it consistently you can dichotomize your configuration or org-agenda content when you have time. Or wait until I next encounter.
I have a good-enough work-around, which is the way I used to do it before link-hint
: navigate using org-next-link
/org-prev-link
, which I have bound to C-M-n
and C-M-p
, and then use org-agenda-open-link
(C-c C-o
), so, much as I wish I could continue using link-hint
, I can't currently justify dedicating more time to this. Thanks to both of you for your diligence.
One last data point: it does not appear to be anything to do with no-file buffers, as I get the same error in my ToDo.org
.
I find it hard to reproduce, when I save the buffer of mu4e-view, it becomes plain text and when I open the email again, I usually don't have the problem again
I try to find the original file content, but I don't know how to view it in mu4e-view
mail.txt
Got it, I think. Got something, anyway: it's the time grid. If I either scroll the time grid off the top of the window, or toggle the time grid off, then link-hint works.
Thanks, I'll look into it when I get a chance.
Unfortunately, I couldn't replicate. Can you give me a dummy agenda file or more information? I tried having the time grid at various positions in the window (even the entire window as a time grid) and didn't encounter the error. Also tried with different scroll settings and mouse scrolling. How big is your agenda size relative to the buffer?
That said, I did encounter this error for the first time in an embark collect buffer, so I will also try to replicate that (so far no luck).
Sorry, I don't have a stable reproduction method either, but I still encounter it frequently when reading emails with mu4e
@PhilHudson Thx for your information, I will keep my eyes on it.
Here's a reproductible recipe on emacs 28.60
(package-initialize)
(require 'link-hint)
(progn
(package-list-packages)
;; eventually test multiple window setup
;; (package-menu-describe-package)
(link-hint-copy-link))
I still missing this issue, I got following *Backtrace*
, but If I M-: link-hint--collect-visible-links
everything work fine.
Debugger entered--Lisp error: (args-out-of-range 1 1020)
text-property-any(1 1020 invisible nil)
link-hint--find-property-with-value(invisible nil 1 nil)
link-hint--find-property(invisible 1 nil)
link-hint--next-property(invisible)
link-hint--find-visible-regions(1 954)
link-hint--collect-visible-links()
link-hint--get-links()
link-hint--one(:open)
link-hint-open-link()
#<subr funcall-interactively>(link-hint-open-link)
apply(#<subr funcall-interactively> link-hint-open-link)
funcall-interactively(link-hint-open-link)
#<subr call-interactively>(link-hint-open-link nil nil)
apply(#<subr call-interactively> (link-hint-open-link nil nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> link-hint-open-link nil nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (link-hint-open-link nil nil))
call-interactively(link-hint-open-link nil nil)
command-execute(link-hint-open-link)
Here is the script that allows to consistently reproduce the bug (at least on my machine).
GNU Emacs 28.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-12-24
commit 04be23f19f6d1290906d2a392a05c58703ea76c5
on the branch emacs-28
.
bug.el
;; -*- lexical-binding: t; -*-
;; Change these to your actual locations
(add-to-list 'load-path (expand-file-name "~/.emacs.d/straight/build/avy/"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/straight/build/link-hint/"))
(require 'link-hint)
(global-set-key (kbd "C-;") #'link-hint-open-link)
(view-echo-area-messages)
(customize-group "recentf")
(cl-loop for i from 1 to 200 do (message "Filler message #%s" i))
;; Switch to the *Messages* buffer and position point at the very bottom
(other-window 1)
(end-of-buffer)
(previous-line)
(recenter-top-bottom -1)
;; Return focus to the Customize buffer
(other-window 1)
(setq debug-on-error t)
;; This may trigger the heisenbug right away, or you will need to call the
;; link-hint command 2-3 more times. Use C-; C-g rinse and repeat :)
(link-hint-open-link)
Steps to reproduce
- Save the above snippet somewhere on your disk, for example as
~/bug.el
. - Edit the load-path definition at the beginning of the saved file.
- Run Emacs like the following:
emacs -Q -l ~/bug.el
- The bug might or might not manifest itself right away. If not, try to activate-then-cancel the
link-hint-open-link
viaC-; C-g
orC-; ESC
several times.
More info
The bug seems to manifest itself when the window scroll is somehow triggered during the collection of candidate links, thus rendering some of them off-screen.
Also, I noticed the echo area resize was triggered as well.
Great, thanks! Please test that this works. I had suspected this might be caused by #36 but had either rejected the idea for some reason or not made the change since there was no way for me to test it. I will go through the remaining window-end
calls and remove them if possible or have them calculate the up-to-date value to prevent other issues like this (as part of #36).
Great. There are some cases where there could still be similar issues. If you get a chance, please test #203. It should fix any similar issues. I will use it for a bit to make sure everything is still working correctly and then merge.
@noctuid I have switched to this branch to check whether everything is working correctly.
I didn't see issues either. Merged.