diff --git a/contrib/lisp/org-element.el b/contrib/lisp/org-element.el index e73c29b25..098c312de 100644 --- a/contrib/lisp/org-element.el +++ b/contrib/lisp/org-element.el @@ -3859,6 +3859,17 @@ modified." ((org-before-first-heading-p) (error "No surrounding element")) (t (org-back-to-heading)))))))))) +(defun org-element-down () + "Move to inner element." + (interactive) + (let ((element (org-element-at-point))) + (cond + ((eq (org-element-type element) 'plain-list) + (forward-char)) + ((memq (org-element-type element) org-element-greater-elements) + (goto-char (org-element-property :contents-begin element))) + (t (error "No inner element"))))) + (provide 'org-element) ;;; org-element.el ends here diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 86be4367d..2af033c6c 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -398,7 +398,7 @@ form (start-line file link source-name params body comment)" (let* ((start-line (nth 0 spec)) (file (nth 1 spec)) - (link (org-link-escape (nth 2 spec))) + (link (nth 2 spec)) (source-name (nth 3 spec)) (body (nth 5 spec)) (comment (nth 6 spec)) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 567540a7b..b321ffa09 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -312,6 +312,21 @@ Outside." (org-element-up) (should (looking-at "\\* Top")))) +(ert-deftest test-org-elemnet/down-element () + "Test `org-element-down' specifications." + ;; 1. Error when the element hasn't got a recursive type. + (org-test-with-temp-text "Paragraph." + (should-error (org-element-down))) + ;; 2. When at a plain-list, move to first item. + (org-test-with-temp-text "- Item 1\n - Item 1.1\n - Item 2.2" + (goto-line 2) + (org-element-down) + (should (looking-at " - Item 1.1"))) + ;; 3. Otherwise, move inside the greater element. + (org-test-with-temp-text "#+BEGIN_CENTER\nParagraph.\n#+END_CENTER" + (org-element-down) + (should (looking-at "Paragraph")))) + (provide 'test-org-element) ;;; test-org-element.el ends here