Skip to content
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

Fix source-file-name incorrect issue #38

Merged
merged 1 commit into from
Jul 18, 2022
Merged

Fix source-file-name incorrect issue #38

merged 1 commit into from
Jul 18, 2022

Conversation

nanjj
Copy link

@nanjj nanjj commented Jul 16, 2022

find-file-noselect makes nodes buffer as current buffer, after that,
org-remark-source-get-file-name will get the notes buffer's file
name(marginalia.org) instead of the source file name. So org remark
will report warning message like No highlights or annotations found for marginalia.org

The fix finds source file name first, then set notes-buf.

`find-file-noselect` makes nodes buffer as current buffer, after that,
`org-remark-source-get-file-name` will get the notes buffer's file
name(`marginalia.org`) instead of the source file name. So org remark
will report warning message like `No highlights or annotations found
for marginalia.org`

The fix finds source file name first, then get notes-buf.
@nobiot
Copy link
Owner

nobiot commented Jul 16, 2022

Thank you for your PR. I think I understand what you report, but I have never come across this issue. How can I reproduce it?

@nanjj
Copy link
Author

nanjj commented Jul 17, 2022

Thank you for your PR. I think I understand what you report, but I have never come across this issue. How can I reproduce it

Steps to reproduce:

  1. '(org-remark-global-tracking-mode t)
    '(org-remark-notes-file-name "~/.emacs.d/marginalia.org") ;; absulute path please notice,
    '(org-remark-source-file-name 'abbreviate-file-name)
  2. M-x org-remark-mark a file(not the notes file),
  3. M-x org-remark-open # to write some thing
  4. C-x C-c;; quit emacs,
  5. Start emacs,
  6. Go to the file marked, go the *Message* buffer to find the warning message there.

@nobiot
Copy link
Owner

nobiot commented Jul 18, 2022

Thank you. I can repro this. It's a fundamental issue. Thank you for pointing it out.

Edit:
Initially I thought I would use get-file-buffer or find-buffer-visiting -- this is not good as these two functions return nil if the buffer is already live. It is possible that the notes file has not been visited by any buffer yet. I will keep the original PR by nanjj

One note for FSF copyright assignment:

As noted in the relevant section in README, contirubtion to this project normally requires copyright assignment (paperwork) to FSF:

Org-remark is available on GNU ELPA and thus copyrighted by the Free Software Foundation (FSF). This means that anyone who is making a substantive code contribution will need to “assign the copyright for your contributions to the FSF so that they can be included in GNU Emacs” (Org Mode website).

However, your code contribution is less than 15 lines of code. I will also assume you have not exceeded this limit in total of your entire contributions to FSF -- so you don't need to do the paperwork even if you have not done so.

Thank you.

@nobiot nobiot merged commit 67a8174 into nobiot:main Jul 18, 2022
@nobiot
Copy link
Owner

nobiot commented Jul 18, 2022

Closing #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants