Explorar o código

Merge branch 'maint'

Nicolas Goaziou %!s(int64=9) %!d(string=hai) anos
pai
achega
ba104f3483
Modificáronse 2 ficheiros con 26 adicións e 5 borrados
  1. 9 5
      lisp/ob-tangle.el
  2. 17 0
      testing/lisp/test-ob-tangle.el

+ 9 - 5
lisp/ob-tangle.el

@@ -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

+ 17 - 0
testing/lisp/test-ob-tangle.el

@@ -77,6 +77,23 @@
       (should (string-match (regexp-quote "simple") expanded))
       (should (string-match (regexp-quote "length 14") expanded)))))
 
+(ert-deftest ob-tangle/comment-links-at-left-margin ()
+    "Test commenting of links at left margin."
+  (should
+   (string-match
+    (regexp-quote "# [[http://orgmode.org][Org mode]]")
+    (org-test-with-temp-text-in-file
+	"[[http://orgmode.org][Org mode]]
+#+header: :comments org :tangle \"test-ob-tangle.sh\"
+#+begin_src sh
+echo 1
+#+end_src"
+      (unwind-protect
+	  (progn (org-babel-tangle)
+		 (with-temp-buffer (insert-file-contents "test-ob-tangle.sh")
+				   (buffer-string)))
+	(delete-file "test-ob-tangle.sh"))))))
+
 (provide 'test-ob-tangle)
 
 ;;; test-ob-tangle.el ends here