Browse Source

Merge branch 'master' into max-sticky-agenda

Carsten Dominik 13 years ago
parent
commit
c8aa1d99e1
3 changed files with 27 additions and 1 deletions
  1. 11 0
      contrib/lisp/org-element.el
  2. 1 1
      lisp/ob-tangle.el
  3. 15 0
      testing/lisp/test-org-element.el

+ 11 - 0
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

+ 1 - 1
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))

+ 15 - 0
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