-
Notifications
You must be signed in to change notification settings - Fork 35
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
Error when inserting link or precise link #93
Comments
actually i think this is related to the recent changes made by the new maintainer of the package. it now lives under this repo.
i think this is related to this particular change, where now the (defun org-noter-pdftools--doc-goto-location (mode location &optional _window)
...) and that should solve the problem for now. i believe some other changes are due given |
If I understand you correctly, you mean to patch the existing function. Doing so results in org-noter--get-precise-info: Wrong number of arguments: (lambda (mode) "Get precise info from MODE." (if (eq mode 'pdf-view-mode) (progn (let ((org-pdftools-free-pointer-icon org-noter-pdftools-free-pointer-icon) (org-pdftools-free-pointer-color org-noter-pdftools-free-pointer-color) (org-pdftools-free-pointer-opacity org-noter-pdftools-free-pointer-opacity) (org-pdftools-markup-pointer-color org-noter-pdftools-markup-pointer-color) (org-pdftools-markup-pointer-opacity org-noter-pdftools-markup-pointer-opacity) (org-pdftools-markup-pointer-function org-noter-pdftools-markup-pointer-function)) (org-noter-pdftools--parse-link (org-pdftools-get-link)))))), 2 |
ok. thanks |
not really patch but actually override it entirely. a better approach, now that i think of it, would be to advise it (which is what i have done and it seemed to have fixed it, but i haven't tested inserting links) like so: (advice-add #'org-noter-pdftools--doc-goto-location :around
(lambda (orig-fn mode location _window)
(apply orig-fn mode location))) but other problems still may arise, so @2e0byo's solution is more robust indeed. i ended up just removing the package altogether since i wasn't really making much use of it. |
I tried this, but I still get the same error message |
Try this: in addition to the fix from @bigodel above: not sure what else this needs, as I'm not a user of this pkg, but those are the changes I see it needs so far. btw, |
@uliw: In case it is simpler, note that it might actually be enough to just install |
I am not sure what this suggested. So this is what I did:
Done
In addition to? I do not understand: the suggestion to change line 198 (which I followed ---see below), if I understand correctly, changes code that the advice suggestion in #93 (comment) would modify via advice. So they seem to do the same. Does, I did not implement @bigodel.
Done (i.e., I changed the code in line 198).
After doing this, it still fails if the area marked spans more than one line. In other words
All of the above three commands work fine (and seem to do the exact same thing) if we only mark one line. |
@rdiaz02, can you One problem I do see is due to the change we made from 1-D to 2-D precise notes. A precise location is now For example, this line will likely fail: org-pdftools/org-noter-pdftools.el Line 134 in 967f48f
The probable fix is to change the cdr to cadr , so you pick up the vertical position instead of a cons pair of (<vertical> . <horizontal>) .
|
another one that needs to be changed to org-pdftools/org-noter-pdftools.el Line 301 in 967f48f
I find no other |
I made those two changes, and I This is what I get when issuing
|
What I can see from the stack trace is that the org-pdftools/org-noter-pdftools.el Lines 111 to 112 in 967f48f
org-noter needs to have this converted into a cons cell probably using org-pdftools/org-noter-pdftools.el Lines 141 to 143 in 967f48f
If you are adept with the debugger, try stopping the code in org-noter--get-location-top (C-u C-M-x when the point is in that defun ) and recording the value of location for 1 and 2 line text selections -- it's good to know what is happening when the code doesn't crash.Take heart -- we will get to the bottom of this! |
That function ( Anyway, if use
and, on continucing ( When on a single-line selection, that function is not called (unless there are other notes in the note already). I mean, the note is inserted without ever going through the function. |
I believe the crux of the problem lies with org-pdftools/org-noter-pdftools.el Lines 235 to 236 in 967f48f
This gets called in org-noter here: https://github.com/org-noter/org-noter/blob/870109330a337751e44042d1b407d90d42ca9130/org-noter-core.el#L2104, and then the crash happens here: https://github.com/org-noter/org-noter/blob/870109330a337751e44042d1b407d90d42ca9130/org-noter-core.el#L2125-L2128, specifically, on line 2127. Next experiment: customize |
I am not sure if I am supposed to use the new (current repo) or the old (1.4.1, as available from melpa) org-noter, and whether or not I should use the changed code in the last iterations. So to be explicit my setup involves the new org-noter (commit 87010) and two versions of org-pdftools:
I then Using
Using
(so same error as for Just for the hell of it, I increased
Starting org-noter gives this error (which seems the same as org-noter/org-noter#8 and which, itself, brings as here).
I then Using
For 2 and 3 lines Using
It works for 2, 3, and 4 lines, though.
Using org-noter-1.4.1 (as available from melpa stable), without any modifications. I mark five lines, and In case it matters, though, and as reported by me somewhere else (#54), the behavior of I should add that I have used the old org-noter for over two years, marking short, long, very short, very long, regions, without trouble. |
Peter (@petermao), I really thank you for your patience. And maybe we are getting closer to something. But then, maybe not: some of the things I write above I am not sure are entirely self-consistent (i.e., they suggest I might have made a mistake), formerly fixed bugs seem to have re-emerged, etc. So despite our patience and best intentions, there are several problems with this "one-step-at-a-time-remote-debugging" we are using here:
So I think solving this requires someone who knows what they are doing with elisp (not my case at the moment) and who is willing to look into the issue running org-noter and org-pdftools/org-noter-pdftools. I think for the time being, and until someone like that (maybe me when I learn enough elisp, which won't be soon) steps into the issue, the solution is to use org-noter 1.4.1. If there is something else I can try, let me know, and I'll try to give it a try (pun kinda intended) but I don't think we'll be able to fix it. Again, I really thank you for your patience. |
@rdiaz02 confirms that the breakage occurs when org-noter treats the text selection as "long" rather than "short," which means that the org-pdftools/org-noter-pdftools.el Line 277 in 967f48f
location is the output of the function in org-noter/modules/org-noter-pdf.el , but that may break other aspects of this package.When I have some time, I may look into why this worked fine for long selections in org-noter 1.4.1. |
Perfect, thanks. I've
The above behavior is using the current development org-noter code (from https://github.com/org-noter/org-noter ---commit 8701093: org-noter/org-noter@8701093) and org-pdftools/org-noter-pdftools with cdr replaced by cadr (as indicated in #93 (comment) and #93 (comment)) and the change in #93 (comment), both available from branch https://github.com/rdiaz02/org-pdftools/tree/cadr_change, commit 51d372d ---rdiaz02@51d372b. As reference this is the behavior using other versions of these packages. org-noter 1.4.1 with org-noter-pdftools 20220320.300, org-pdftools 20220320.301 (i.e., commit 967f48f in this repo)
org-noter 1.4.1 with org-pdftools/org-noter-pdftools with cdr replaced by cadr, as indicated in #93 (comment) and #93 (comment)), available from branch https://github.com/rdiaz02/org-pdftools/tree/cadr_change Same as org-noter 1.4.1 with org-noter-pdftools 20220320.300, org-pdftools 20220320.301. Pull request created |
Fixes #93: error when inserting notes with newer (2023-03) versions of org-noter
@fuxialexander I'm glad to see you're still involved in this package! |
possibly related to earlier reports in Windows, but here it happens on Linux
When inserting a precise link I get
(wrong-number-of-arguments #<subr org-noter-pdftools--doc-goto-location> 3)
Inserting a regular link works as long as it is on a single line, but fails when more than one line is selected with
Inserting with C-i Tab works however.
This happens with
GNU Emacs 28.2 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.35, cairo version 1.17.6)
andFresh install running with -q on minimal init file (attached)
settings-min.zip
The text was updated successfully, but these errors were encountered: