diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-08-24 22:44:18 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-08-24 22:44:18 +0200 |
commit | ed048fa83d72fc359996dd4f9793d375464dae4a (patch) | |
tree | a90c35d430d38f11d43fbc85326d5984d49bb056 | |
parent | d64f7a2c9bcc25b5c0e5e4e5ecd64862bd49a49b (diff) | |
download | org-mode-ed048fa83d72fc359996dd4f9793d375464dae4a.tar.gz |
Fix %start-line in `org-babel-tangle-comment-links'
* lisp/ob-tangle.el (org-babel-tangle-comment-links): %start-line
reports the line number, not the buffer position at the beginning of
line.
Reported-by: immanuel <immanuel.litzroth@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00267.html>
-rw-r--r-- | lisp/ob-tangle.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 7dbd618..ad22127 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -494,14 +494,16 @@ non-nil, return the full association list to be used by result))) (defun org-babel-tangle-comment-links (&optional info) - "Return a list of begin and end link comments for the code block at point." - (let ((link-data - `(("start-line" . ,(number-to-string - (org-babel-where-is-src-block-head))) - ("file" . ,(buffer-file-name)) - ("link" . ,(org-no-properties (org-store-link nil))) - ("source-name" . - ,(nth 4 (or info (org-babel-get-src-block-info 'light))))))) + "Return a list of begin and end link comments for the code block at point. +INFO, when non nil, is the source block information, as returned +by `org-babel-get-src-block-info'." + (let ((link-data (pcase (or info (org-babel-get-src-block-info 'light)) + (`(,_ ,_ ,_ ,_ ,name ,start ,_) + `(("start-line" . ,(org-with-point-at start + (line-beginning-position))) + ("file" . ,(buffer-file-name)) + ("link" . ,(org-no-properties (org-store-link nil))) + ("source-name" . ,name)))))) (list (org-fill-template org-babel-tangle-comment-format-beg link-data) (org-fill-template org-babel-tangle-comment-format-end link-data)))) |