emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] coderef does not provide file path for org-insert-link when not in o


From: stardiviner
Subject: [O] coderef does not provide file path for org-insert-link when not in original buffre
Date: Mon, 14 May 2018 09:52:36 +0800
User-agent: mu4e 1.1.0; emacs 27.0.50

Suppose I have a src block:

#+begin_src emacs-lisp
(let ((case-fold-search nil)
      (str (prin1-to-string
            (with-temp-buffer
              (set-buffer-multibyte nil) ; (ref:set the temp buffer to unibyte)
              (insert
               (with-current-buffer
                   (url-retrieve-synchronously 
"https://nginx.org/en/docs/dirindex.html";)
                 (buffer-string)))
              (let ((tree (libxml-parse-html-region (point-min) (point-max))))
                tree)))))
  (and (string-match "\"content" str)
       (match-string 0 str)))
;=> "\"content"
#+end_src

On the `(set-buffer-multibyte nil)` line, then I use `org-store-link` to add 
coderef link.

It insert [[(set the temp buffer to unibyte)]] for current buffer.

But when in other file buffer, it still is this link. It suppose contains file 
path like:

[[file:~/Org/elquery.org::(set%20the%20temp%20buffer%20to%20unibyte)][(set the 
temp buffer to unibyte)]]

`org-insert-link` should be smart on decide whether current buffer is the same 
buffer with `org-store-link` source buffer, if yes, use [[(set the temp buffer 
to unibyte)]]. If no, use:

[[file:~/Org/elquery.org::(set%20the%20temp%20buffer%20to%20unibyte)][(set the 
temp buffer to unibyte)]]

WDYT?

-- 
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]