emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: org-mode <emacs-orgmode@gnu.org>
Subject: coderef does not provide file path for org-insert-link when not in original buffre
Date: Mon, 14 May 2018 09:52:36 +0800	[thread overview]
Message-ID: <87po1zvw9n.fsf@gmail.com> (raw)

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	other threads:[~2018-05-14  6:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  1:52 stardiviner [this message]
2018-06-23 22:02 ` coderef does not provide file path for org-insert-link when not in original buffre Nicolas Goaziou
2018-06-24  9:10   ` stardiviner
2018-09-23  8:46   ` stardiviner
     [not found]     ` <875zysr0bb.fsf@nicolasgoaziou.fr>
2018-10-24  2:51       ` stardiviner
2018-10-26 16:08         ` Nicolas Goaziou
2018-10-27  2:55           ` stardiviner
2018-11-01 17:39             ` Nicolas Goaziou
2018-11-02  6:15               ` stardiviner
2018-11-04 15:47                 ` Nicolas Goaziou
2018-11-06  4:48                   ` stardiviner
2018-11-06  4:48                   ` [SOLVED] " stardiviner
2018-10-31  5:16           ` stardiviner
  -- strict thread matches above, loose matches on Subject: below --
2018-09-26 13:18 Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87po1zvw9n.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).