diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index e63bde89f..0b816a7c1 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -513,6 +513,7 @@ The PARAMS are the 3rd element of the info for the same src block." (cdr (assq :tangle params))))) bare)))))) +(defvar org-outline-regexp) ; defined in lisp/org.el (defun org-babel-tangle-single-block (block-counter &optional only-this-block) "Collect the tangled source for current block. Return the list of block attributes needed by @@ -570,7 +571,7 @@ non-nil, return the full association list to be used by (buffer-substring (max (condition-case nil (save-excursion - (org-back-to-heading t) ; Sets match data + (org-back-to-heading t) (re-search-forward org-outline-regexp)) (error (point-min))) (save-excursion diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el index 6c6d2b6b0..369857884 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -975,7 +975,7 @@ This means, between the beginning of line and the point." (interactive) (org-back-to-heading) (let ((minlevel 1000) - (replace-text (concat (match-string 0) "* "))) + (replace-text (concat (make-string (org-current-level) ?*) "* "))) (beginning-of-line 2) (save-excursion (while (not (or (eobp) (looking-at org-outline-regexp))) diff --git a/lisp/org.el b/lisp/org.el index 46ca26fb9..5451a92b5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20790,7 +20790,7 @@ non-nil it will also look at invisible ones." (if backward? (goto-char (point-min)) (outline-next-heading)) (org-back-to-heading invisible-ok) (unless backward? (end-of-line)) ;do not match current headline - (let ((level (- (match-end 0) (match-beginning 0) 1)) + (let ((level (org-current-level)) (f (if backward? #'re-search-backward #'re-search-forward)) (count (if arg (abs arg) 1)) (result (point))) diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el index 4b7a574cb..b1b0a0a53 100644 --- a/testing/lisp/test-ob-tangle.el +++ b/testing/lisp/test-ob-tangle.el @@ -100,7 +100,7 @@ echo 1 (delete-file "test-ob-tangle.sh")))))) (ert-deftest ob-tangle/comment-org () - "Test :commends org." + "Test :comments org." (should (string-match (regexp-quote ";; Function heading")