* coderef does not provide file path for org-insert-link when not in original buffre @ 2018-05-14 1:52 stardiviner 2018-06-23 22:02 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: stardiviner @ 2018-05-14 1:52 UTC (permalink / raw) To: org-mode 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-05-14 1:52 coderef does not provide file path for org-insert-link when not in original buffre stardiviner @ 2018-06-23 22:02 ` Nicolas Goaziou 2018-06-24 9:10 ` stardiviner 2018-09-23 8:46 ` stardiviner 0 siblings, 2 replies; 14+ messages in thread From: Nicolas Goaziou @ 2018-06-23 22:02 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > `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? It sounds like a good idea. Do you want to implement it? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-06-23 22:02 ` Nicolas Goaziou @ 2018-06-24 9:10 ` stardiviner 2018-09-23 8:46 ` stardiviner 1 sibling, 0 replies; 14+ messages in thread From: stardiviner @ 2018-06-24 9:10 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode I just toke a look at the source code of `org-store-link'. I think it's possible to implement it. I will take a try. Might need to add support in `org-open-at-point` [C-c C-o]. Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> `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? > > It sounds like a good idea. Do you want to implement it? > > Regards, -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-06-23 22:02 ` Nicolas Goaziou 2018-06-24 9:10 ` stardiviner @ 2018-09-23 8:46 ` stardiviner [not found] ` <875zysr0bb.fsf@nicolasgoaziou.fr> 1 sibling, 1 reply; 14+ messages in thread From: stardiviner @ 2018-09-23 8:46 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> `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? > > It sounds like a good idea. Do you want to implement it? > > Regards, I take a look at the org.el code of functions `org-store-link`, `org-insert-link`, they can't inherit the original buffer file name `buffer-file-name`. So can't use `org-link-file-path-type 'adaptive` case. But I found `org-insert-link` function definition has this snippet of code: ``` (defun org-insert-link ... ... (cond ((or (eq org-link-file-path-type 'absolute) (equal complete-file '(16))) (setq path (abbreviate-file-name (expand-file-name path)))) ((eq org-link-file-path-type 'noabbrev) (setq path (expand-file-name path))) ((eq org-link-file-path-type 'relative) (setq path (file-relative-name path))) ;; I tried to add this, but failed. because `coderef` is executed in `org-edit-src-code` which invokes `org-src--edit-element`, it create a dedicated buffer which does not have `buffer-file-name`. I don't know how to archive what I want now. ;; ((eq org-link-file-path-type 'adaptive) ;; (setq path (file-relative-name path))) (t (save-match-data (if (string-match (concat "^" (regexp-quote (expand-file-name (file-name-as-directory default-directory)))) (expand-file-name path)) ;; We are linking a file with relative path name. (setq path (substring (expand-file-name path) (match-end 0))) (setq path (abbreviate-file-name (expand-file-name path))))))) ..... ``` I don't know which function should I change to let `org-insert-link` and `org-store-link` can inherit the original buffer filename info. Because 'adaptive org-link-file-path-type need compare two pathes like this: ``` (let ((coderef-path PATH) ; TODO: (org-unbracket-string "<" ">" ( (org-link-prettify (first (reverse org-stored-links))))) (same-directory? (not (string= (expand-file-name default-directory) (expand-file-name (file-name-directory (or coderef-path ""))))))) (if (and default-directory same-directory?) (if (eq org-link-file-path-type 'adaptive) (format "[[file:%s::%s][%s]]" (file-relative-name (expand-file-name (or coderef-path "") default-directory) (file-name-directory buffer-file-name)) label ; (format coderef-format label) label ; (format coderef-format label) ) (expand-file-name coderef-path default-directory)))) ``` This is a snippet of code I adapted from my original commit: "49a8de4ffd2d0fc50c975ff3edac15d2bb37a809" Can you help me on this? Thanks :) :) -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <875zysr0bb.fsf@nicolasgoaziou.fr>]
* Re: coderef does not provide file path for org-insert-link when not in original buffre [not found] ` <875zysr0bb.fsf@nicolasgoaziou.fr> @ 2018-10-24 2:51 ` stardiviner 2018-10-26 16:08 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: stardiviner @ 2018-10-24 2:51 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode [-- Attachment #1: Type: text/plain, Size: 643 bytes --] Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: >> ;; I tried to add this, but failed. because `coderef` is executed in `org-edit-src-code` which invokes `org-src--edit-element`, it create a dedicated buffer which does not have `buffer-file-name`. I don't know how to archive what I want now. >> ;; ((eq org-link-file-path-type 'adaptive) > > In "org-src.el", we create local variables to store information from > original buffer. See, e.g., `org-src--src-type' or `org-src--tab-width'. > Anyway, see my first question. Thanks for this hint, I added a new entry in org-src--babel-info list to pass the original parent file path. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org.el-fix-org-coderef-does-not-support-adaptive-fil.patch --] [-- Type: text/x-patch, Size: 2644 bytes --] From 6e8469545185a41d22b8046ebb367c3c742f0ff4 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Wed, 24 Oct 2018 10:45:40 +0800 Subject: [PATCH] org.el: fix org-coderef does not support adaptive file path link type. * org.el (org-insert-link): support option org-link-file-path-type 'adaptive value. * ob-core.el (org-babel-get-src-block-info): add an new entry into src block info list to pass parent file path. --- lisp/ob-core.el | 5 +++-- lisp/org.el | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 42360d618..73117f1a7 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -578,7 +578,7 @@ object instead. Return nil if point is not on a source block. Otherwise, return a list with the following pattern: - (language body arguments switches name start coderef)" + (language body arguments switches name start coderef parent-file-path)" (let* ((datum (or datum (org-element-context))) (type (org-element-type datum)) (inline (eq type 'inline-src-block))) @@ -609,7 +609,8 @@ a list with the following pattern: name (org-element-property (if inline :begin :post-affiliated) datum) - (and (not inline) (org-src-coderef-format datum))))) + (and (not inline) (org-src-coderef-format datum)) + buffer-file-name))) (unless light (setf (nth 2 info) (org-babel-process-params (nth 2 info)))) (setf (nth 2 info) (org-babel-generate-file-param name (nth 2 info))) diff --git a/lisp/org.el b/lisp/org.el index 0b5e8d739..37524bce0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9249,13 +9249,14 @@ non-nil." (interactive? (let ((label (read-string "Code line label: "))) (end-of-line) - (setq link (format coderef-format label)) (let ((gc (- 79 (length link)))) (if (< (current-column) gc) (org-move-to-column gc t) (insert " "))) - (insert link) - (setq link (concat "(" label ")")) + (insert (format coderef-format label)) + (setq link (format "file:%s::%s" + (car (last org-src--babel-info)) + (concat "(" label ")"))) (setq desc nil))) (t (setq link nil))))) @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq path (expand-file-name path))) ((eq org-link-file-path-type 'relative) (setq path (file-relative-name path))) + ((eq org-link-file-path-type 'adaptive) + (setq path (file-relative-name path))) (t (save-match-data (if (string-match (concat "^" (regexp-quote -- 2.19.1 [-- Attachment #3: Type: text/plain, Size: 224 bytes --] -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-10-24 2:51 ` stardiviner @ 2018-10-26 16:08 ` Nicolas Goaziou 2018-10-27 2:55 ` stardiviner 2018-10-31 5:16 ` stardiviner 0 siblings, 2 replies; 14+ messages in thread From: Nicolas Goaziou @ 2018-10-26 16:08 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > Thanks for this hint, I added a new entry in org-src--babel-info list to > pass the original parent file path. Thank you. Some comments follow. > - (language body arguments switches name start coderef)" > + (language body arguments switches name start coderef parent-file-path)" This is not needed. It would be better to create a new variable, e.g. `org-src-source-file', get the file name at the beginning of the function `org-src--edit-element', and set it from its INITIALIZE argument. > + (insert (format coderef-format label)) > + (setq link (format "file:%s::%s" > + (car (last org-src--babel-info)) > + (concat "(" label ")"))) You can get the file name by reading `org-src-source-file' value. Does that make sense? Could you also provide some tests? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-10-26 16:08 ` Nicolas Goaziou @ 2018-10-27 2:55 ` stardiviner 2018-11-01 17:39 ` Nicolas Goaziou 2018-10-31 5:16 ` stardiviner 1 sibling, 1 reply; 14+ messages in thread From: stardiviner @ 2018-10-27 2:55 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode [-- Attachment #1: Type: text/plain, Size: 975 bytes --] Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> Thanks for this hint, I added a new entry in org-src--babel-info list to >> pass the original parent file path. > > Thank you. Some comments follow. > >> - (language body arguments switches name start coderef)" >> + (language body arguments switches name start coderef parent-file-path)" > > This is not needed. It would be better to create a new variable, e.g. > `org-src-source-file', get the file name at the beginning of the > function `org-src--edit-element', and set it from its INITIALIZE > argument. > >> + (insert (format coderef-format label)) >> + (setq link (format "file:%s::%s" >> + (car (last org-src--babel-info)) >> + (concat "(" label ")"))) > > You can get the file name by reading `org-src-source-file' value. > > Does that make sense? > > Could you also provide some tests? > > Regards, I regenerated the patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org.el-fix-org-coderef-does-not-support-adaptive-fil.patch --] [-- Type: text/x-patch, Size: 2802 bytes --] From da491e12fcbf75d9b016f58fbcdeb74d601a1b91 Mon Sep 17 00:00:00 2001 From: stardiviner <numbchild@gmail.com> Date: Wed, 24 Oct 2018 10:45:40 +0800 Subject: [PATCH] org.el: fix org-coderef does not support adaptive file path link type. * org-src.el (org-src-source-file): Add a variable to get the file path at the beginning of the function `org-src--edit-element'. * org.el (org-insert-link): support option org-link-file-path-type 'adaptive value. --- lisp/org-src.el | 9 ++++++++- lisp/org.el | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 42e1225ed..0426ff96a 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -277,6 +277,11 @@ issued in the language major mode buffer." "Type of element being edited, as a symbol.") (put 'org-src--source-type 'permanent-local t) +(defvar org-src--source-file nil + "A variable used to store the source file path before entering + source block dedicated buffer.") +(put 'org-src--source-file 'permanent-local t) + (defvar-local org-src--tab-width nil "Contains `tab-width' value from Org source buffer. However, if `indent-tabs-mode' is nil in that buffer, its value @@ -995,7 +1000,9 @@ name of the sub-editing buffer." (let* ((lang (if (eq type 'src-block) (org-element-property :language element) "example")) - (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang))) + (lang-f (progn + (setq-local org-src--source-file (buffer-file-name)) + (and (eq type 'src-block) (org-src--get-lang-mode lang)))) (babel-info (and (eq type 'src-block) (org-babel-get-src-block-info 'light))) deactivate-mark) diff --git a/lisp/org.el b/lisp/org.el index 0b5e8d739..ab86345bf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9249,13 +9249,14 @@ non-nil." (interactive? (let ((label (read-string "Code line label: "))) (end-of-line) - (setq link (format coderef-format label)) (let ((gc (- 79 (length link)))) (if (< (current-column) gc) (org-move-to-column gc t) (insert " "))) - (insert link) - (setq link (concat "(" label ")")) + (insert (format coderef-format label)) + (setq link (format "file:%s::%s" + org-src--source-file + (concat "(" label ")"))) (setq desc nil))) (t (setq link nil))))) @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (setq path (expand-file-name path))) ((eq org-link-file-path-type 'relative) (setq path (file-relative-name path))) + ((eq org-link-file-path-type 'adaptive) + (setq path (file-relative-name path))) (t (save-match-data (if (string-match (concat "^" (regexp-quote -- 2.19.1 [-- Attachment #3: Type: text/plain, Size: 224 bytes --] -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-10-27 2:55 ` stardiviner @ 2018-11-01 17:39 ` Nicolas Goaziou 2018-11-02 6:15 ` stardiviner 0 siblings, 1 reply; 14+ messages in thread From: Nicolas Goaziou @ 2018-11-01 17:39 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > I regenerated the patch. Thank you. Some more comments. > * org-src.el (org-src-source-file): Add a variable to get the file path > at the beginning of the function `org-src--edit-element'. > * org.el (org-insert-link): support option org-link-file-path-type > 'adaptive value. > --- > lisp/org-src.el | 9 ++++++++- > lisp/org.el | 9 ++++++--- > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/lisp/org-src.el b/lisp/org-src.el > index 42e1225ed..0426ff96a 100644 > --- a/lisp/org-src.el > +++ b/lisp/org-src.el > @@ -277,6 +277,11 @@ issued in the language major mode buffer." > "Type of element being edited, as a symbol.") > (put 'org-src--source-type 'permanent-local t) > > +(defvar org-src--source-file nil > + "A variable used to store the source file path before entering > + source block dedicated buffer.") > +(put 'org-src--source-file 'permanent-local t) The first sentence of a docstring needs to be one or more complete sentences. Why not using `defvar-local' instead? Also, since it is meant to be used in other libraries, it should be `org-src-source-file'. > + (lang-f (progn > + (setq-local org-src--source-file (buffer-file-name)) > + (and (eq type 'src-block) (org-src--get-lang-mode lang)))) I don't think this is the right place to set `org-src--source-file': it is unrelated to LANG-F. Also, the value comes from the source buffer, but the variable needs to be set in the edit buffer. AFAIU, here you set it in the source buffer, not in the edit buffer. > + (insert (format coderef-format label)) > + (setq link (format "file:%s::%s" > + org-src--source-file > + (concat "(" label ")"))) Should we check if `org-src-source-file' is the same as the current file, and offer a simplified link in this case? > (setq desc nil))) > (t (setq link nil))))) > > @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support > (setq path (expand-file-name path))) > ((eq org-link-file-path-type 'relative) > (setq path (file-relative-name path))) > + ((eq org-link-file-path-type 'adaptive) > + (setq path (file-relative-name path))) > (t > (save-match-data > (if (string-match (concat "^" (regexp-quote Would you writing a few tests? Thank you. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-11-01 17:39 ` Nicolas Goaziou @ 2018-11-02 6:15 ` stardiviner 2018-11-04 15:47 ` Nicolas Goaziou 0 siblings, 1 reply; 14+ messages in thread From: stardiviner @ 2018-11-02 6:15 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: >> --- >> lisp/org-src.el | 9 ++++++++- >> lisp/org.el | 9 ++++++--- >> 2 files changed, 14 insertions(+), 4 deletions(-) >> >> diff --git a/lisp/org-src.el b/lisp/org-src.el >> index 42e1225ed..0426ff96a 100644 >> --- a/lisp/org-src.el >> +++ b/lisp/org-src.el > > Why not using `defvar-local' instead? Also, since it is meant to be used > in other libraries, it should be `org-src-source-file'. Because the variable `org-src-source-file' is a bridge to pass info between two buffers "source buffer" and source block opened "dedicated buffer". So this variable must be global. Otherwise the "dedicated buffer" can't read it. > >> + (lang-f (progn >> + (setq-local org-src--source-file (buffer-file-name)) >> + (and (eq type 'src-block) (org-src--get-lang-mode lang)))) > > I don't think this is the right place to set `org-src--source-file': it > is unrelated to LANG-F. > I tried this: #+begin_src diff @@ -1000,9 +1000,11 @@ name of the sub-editing buffer." (let* ((lang (if (eq type 'src-block) (org-element-property :language element) "example")) - (lang-f (progn - (setq-local org-src--source-file (buffer-file-name)) - (and (eq type 'src-block) (org-src--get-lang-mode lang)))) + (lang-f (and (eq type 'src-block) (org-src--get-lang-mode lang))) + (org-src-source-file (buffer-file-name)) + (initialize (lambda () + (setq org-src-source-file (buffer-file-name)) + (funcall lang-f))) (babel-info (and (eq type 'src-block) (org-babel-get-src-block-info 'light))) deactivate-mark) #+end_src Put it into initialize function. This is the best way I can come up with. > Also, the value comes from the source buffer, but the variable needs to > be set in the edit buffer. AFAIU, here you set it in the source buffer, > not in the edit buffer. > >> + (insert (format coderef-format label)) >> + (setq link (format "file:%s::%s" >> + org-src--source-file >> + (concat "(" label ")"))) > > Should we check if `org-src-source-file' is the same as the current > file, and offer a simplified link in this case? Don't know which part you mean, I just insert the source file path into the link. About the final link is modified by bellowing `org-link-file-path-type' variable. > >> (setq desc nil))) >> (t (setq link nil))))) >> >> @@ -9852,6 +9853,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support >> (setq path (expand-file-name path))) >> ((eq org-link-file-path-type 'relative) >> (setq path (file-relative-name path))) >> + ((eq org-link-file-path-type 'adaptive) >> + (setq path (file-relative-name path))) >> (t >> (save-match-data >> (if (string-match (concat "^" (regexp-quote > > Would you writing a few tests? > > Thank you. > > Regards, -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 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 0 siblings, 2 replies; 14+ messages in thread From: Nicolas Goaziou @ 2018-11-04 15:47 UTC (permalink / raw) To: stardiviner; +Cc: org-mode Hello, stardiviner <numbchild@gmail.com> writes: > Because the variable `org-src-source-file' is a bridge to pass info > between two buffers "source buffer" and source block opened "dedicated > buffer". So this variable must be global. Otherwise the "dedicated > buffer" can't read it. The variable is set in the "dedicated buffer", and is local to it. OTOH, the source buffer doesn't need to read it, ever. I committed a change in "master" branch. Could you tell me if it fixes your issue? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-11-04 15:47 ` Nicolas Goaziou @ 2018-11-06 4:48 ` stardiviner 2018-11-06 4:48 ` [SOLVED] " stardiviner 1 sibling, 0 replies; 14+ messages in thread From: stardiviner @ 2018-11-06 4:48 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbchild@gmail.com> writes: > >> Because the variable `org-src-source-file' is a bridge to pass info >> between two buffers "source buffer" and source block opened "dedicated >> buffer". So this variable must be global. Otherwise the "dedicated >> buffer" can't read it. > > The variable is set in the "dedicated buffer", and is local to it. OTOH, > the source buffer doesn't need to read it, ever. > > I committed a change in "master" branch. Could you tell me if it fixes > your issue? > > Regards, I tested, confirm that it works. -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [SOLVED] Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-11-04 15:47 ` Nicolas Goaziou 2018-11-06 4:48 ` stardiviner @ 2018-11-06 4:48 ` stardiviner 1 sibling, 0 replies; 14+ messages in thread From: stardiviner @ 2018-11-06 4:48 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Thanks, Nicolas. -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre 2018-10-26 16:08 ` Nicolas Goaziou 2018-10-27 2:55 ` stardiviner @ 2018-10-31 5:16 ` stardiviner 1 sibling, 0 replies; 14+ messages in thread From: stardiviner @ 2018-10-31 5:16 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: org-mode Hi, Nicolas, just a remind that have you reviewed my patch? Is it what you said in `INITIALIZE` argument? Is it fine to merge? -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: coderef does not provide file path for org-insert-link when not in original buffre @ 2018-09-26 13:18 Nicolas Goaziou 0 siblings, 0 replies; 14+ messages in thread From: Nicolas Goaziou @ 2018-09-26 13:18 UTC (permalink / raw) To: Org Mode List Hello, stardiviner <numbchild@gmail.com> writes: > I take a look at the org.el code of functions `org-store-link`, > `org-insert-link`, they can't inherit the original buffer file name > `buffer-file-name`. Why can't they? > So can't use `org-link-file-path-type 'adaptive` case. But I found > `org-insert-link` function definition has this snippet of code: [...] > ;; I tried to add this, but failed. because `coderef` is executed in `org-edit-src-code` which invokes `org-src--edit-element`, it create a dedicated buffer which does not have `buffer-file-name`. I don't know how to archive what I want now. > ;; ((eq org-link-file-path-type 'adaptive) In "org-src.el", we create local variables to store information from original buffer. See, e.g., `org-src--src-type' or `org-src--tab-width'. Anyway, see my first question. Regards, -- Nicolas Goaziou 0x80A93738 ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-11-06 4:52 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-05-14 1:52 coderef does not provide file path for org-insert-link when not in original buffre stardiviner 2018-06-23 22:02 ` 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.