From 09600666ecbbebe86830a937658465d046e13d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Fri, 27 Nov 2015 17:40:16 +0100 Subject: Imported Upstream version 8.3.2 --- lisp/ob-tangle.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lisp/ob-tangle.el') diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 385d8e2..f822e3f 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -1,6 +1,6 @@ ;;; ob-tangle.el --- extract source code from org-mode files -;; Copyright (C) 2009-2014 Free Software Foundation, Inc. +;; Copyright (C) 2009-2015 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research @@ -242,7 +242,7 @@ used to limit the exported source code blocks by language." (base-name (cond ((string= "yes" tangle) (file-name-sans-extension - (buffer-file-name))) + (nth 1 spec))) ((string= "no" tangle) nil) ((> (length tangle) 0) tangle))) (file-name (when base-name @@ -332,7 +332,7 @@ Insert the source-code specified by SPEC into the current source code file. This function uses `comment-region' which assumes that the appropriate major-mode is set. SPEC has the form: - \(start-line file link source-name params body comment)" + (start-line file link source-name params body comment)" (let* ((start-line (nth 0 spec)) (file (if org-babel-tangle-use-relative-file-links (file-relative-name (nth 1 spec)) @@ -362,13 +362,17 @@ that the appropriate major-mode is set. SPEC has the form: (when (and comments (not (string= comments "no")) (> (length text) 0)) (if org-babel-tangle-uncomment-comments - ;; just plain comments with no processing + ;; Plain comments: no processing. (insert text) - ;; ensure comments are made to be - ;; comments, and add a trailing newline + ;; Ensure comments are made to be + ;; comments, and add a trailing + ;; newline. Also ignore invisible + ;; characters when commenting. (comment-region - (point) (progn (insert text) (point))) - (end-of-line nil) + (point) + (progn (insert (org-no-properties text)) + (point))) + (end-of-line) (insert "\n")))))) (when comment (funcall insert-comment comment)) (when link-p @@ -427,7 +431,7 @@ list to be used by `org-babel-tangle' directly." (start-line (save-restriction (widen) (+ 1 (line-number-at-pos (point))))) - (file (buffer-file-name)) + (file (buffer-file-name (buffer-base-buffer))) (src-lang (nth 0 info)) (params (nth 2 info)) (extra (nth 3 info)) -- cgit v1.2.3