You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see it simply linked to Heading A instead. It does seem to work when you link headings within the current file, but for anything outside the current file, this happens instead.
The text was updated successfully, but these errors were encountered:
OK, the problem is that my org directory is a symlink. The org-super-links-get-location function contains the following line for getting the buffer to be linked to:
(get-file-buffer (car (cdr target)))))))
According to the documentation for get-file-buffer:
The buffer's buffer-file-name must match exactly the expansion of FILENAME.
If there is no such live buffer, return nil.
See also find-buffer-visiting.
It was returning nil because the "canonical" version of the file is somewhere else. By returning nil, it was always operating in the current buffer.
Changing "get-file-buffer" to "find-buffer-visiting" in the implementation of the org-super-links-get-location function fixes the problem. In my case I've simply made my own version of the function:
(defun my-org-super-links-get-location ()
"My fixed version of org-super-links-get-location. Works with symlinks."
(let ((target (org-refile-get-location "Super Link")))
(org-super-links--insert-link (set-marker (make-marker) (car (cdddr target))
(find-buffer-visiting (car (cdr target)))))))
(setq org-super-links-search-function #'my-org-super-links-get-location)
Will leave this open in case the fix can get merged in.
It's just as the title says... suppose I have a file named "Test1.org":
And a file named "Test2.org":
When I use "org-super-links-link" under "Heading B" in Test1.org and attempt to create a link to "Heading C", this happens instead:
Test1.org:
As you can see it simply linked to Heading A instead. It does seem to work when you link headings within the current file, but for anything outside the current file, this happens instead.
The text was updated successfully, but these errors were encountered: