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

(org-roam-get-keyword "TITLE" file) would return garbled string when the title contain CJK characters. #1671

Closed
colawithsauce opened this issue Jul 25, 2021 · 1 comment · Fixed by #1672

Comments

@colawithsauce
Copy link

I got this problem in Doom Emacs: doomemacs/doomemacs#5293, and I finally fixed this by modifying the definition of function org-roam-get-keyword

To reproduce:

  1. save this as an org file
:PROPERTIES:
:ID:       2973648b-c6ff-4fe1-92ff-d87754cbc0a3
:END:
#+title: 测试
* 测试 Bug
:PROPERTIES:
:ID:       ba1e6d89-e2c8-4c09-b8cd-1814556c254e
:END:
  1. M-; (org-roam-get-keyword "TITLE" (org-roam-node-file (org-roam-node-at-point))) and get a garbled string.

To fix that problem, I modified the function. And it works for me.

(defun org-roam-get-keyword (name &optional file bound)
  "Return keyword property NAME from an org FILE.
FILE defaults to current file.
Only scans up to BOUND bytes of the document."
  (unless bound
    (setq bound 1024))
  (if file
      (with-temp-buffer
        ;; from insert-file-contents-literally to insert-file-contents
        (insert-file-contents file nil 0 bound) 
        (org-roam--get-keyword name))
    (org-roam--get-keyword name bound)))

I'm wondering if the "literally" function is essential for performance reasons?

@jethrokuan
Copy link
Member

I wouldn't say it's performance-critical, since nothing in the repo calls org-roam-get-keyword. It was a nice-to-have, but now that we know it doesn't work with CJK characters it should definitely be changed.

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 a pull request may close this issue.

2 participants