-
Notifications
You must be signed in to change notification settings - Fork 22
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
Bug: Error during save if source-buffer is narrowed (args out of range) #83
Comments
After some more tests - the save-restriction with widen has to be done a little above - otherwise the narrowing will also create problems for I also tried messing around with the after-save-hook for the notes buffer - aka |
@nobiot Hey sorry for pinging you, but can you comment on this if you have some time. Do you think pushing something like this would be alright? Thanks for your time. |
Yes, what you are proposing looks fine. What’s your concern? I need someone (me included) to repro the issue and test your solution. It is possible that there is a better place to put save-restriction ans widen — I would have thought I’d already placed them but that’s not the case from this issue :) |
@nobiot I have no concern - I am in want for somebody to repro the issue too. Please take your time, let me know if you need any more information if you want to reproduce in the future when you get free time. In my case - it is very trivial to cause this error - the highlight simply needs to be outside the narrow. Much thanks, |
I cannot narrow an org buffer before highlights are added to the entire buffer because I use "global tracking". How do you get to this situation? |
@nobiot Hello, sorry I got busy with responsibilities and couldn't get back to this then. Lets say we are working on a buffer and we have remarks here and there - but now we narrow to a headline - we work there, and save - without widening - the current implementation causes remarks outside the narrowed region to lose track of their position markers. Does it make sense? The problem arises when we save from a narrowed situation and remarks are out of the range of the narrow. It should be trivial to reproduce the problem. Go to a buffer where there exists remarks |
untitled.mp4Attaching a screen record to show the issue - the problem is very simple.. |
@nobiot Interestingly - the position markers are being correctly being registered now that I test it again - I almost feel stupid now. I swear they were reporting nil before, but now that I test them, they record the delta correctly - the error is normal, but my issue was that the position markers
Were not being recorded correctly. I have no idea how it got resolved automatically? Currently nothing seems to be needed to be done. Will be closing this issue unless I can reproduce the issue of the markers being misrepresented again. Sorry.. ? |
Okay I have caused it again - but it seems only the untitled.mp4Focus on the :org-remark-link: when I am saving - |
Thanks for additional detail... I will look, but let me have some time. On vacation in a remote place :) |
Looks like I should have used a PR to send this commit d37ec06 but it is meant to fix the issue of Thank you @akashpal-21 for staying with me on this one. I believe it's fixed. Please open it again if it is not with the commit. |
Much thanks for the fix Nobiot :) |
Got time to update today, fix confirmed for both the problems, thanks. |
During save - if the source-buffer in question is narrowed - then the
org-remark-highlights-adjust-positions
function which runs during this time -- probably re initiating all the highlights - fails to check thewhen
condition that is there to evaluate whether "original text exists AND it is different to the current text" .Two ways to avoid the problem
Approach one
Since the error occurs during
(buffer-substring-no-properties (overlay-start ov) (overlay-end ov))
we may run this within(org-with-wide-buffer
The second approach that I have discovered is changing the after-save-hook
The error in question is as follows
Thank you.
The text was updated successfully, but these errors were encountered: