diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2020-05-31 13:57:05 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2020-05-31 13:57:05 +0200 |
commit | fe7830b4f31c772400d4a99f62208d53372f9fa3 (patch) | |
tree | 2d69df8fffcdbb89e483a657943d78856399df72 | |
parent | 1596113512550b0d9b5aa9e1700e59c243e1bd5a (diff) | |
parent | 65fdf2be16c82df78fe533a022e1e233ae66d7a8 (diff) | |
download | org-mode-fe7830b4f31c772400d4a99f62208d53372f9fa3.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lisp/org.el | 5 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 21 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el index c1ef888..7ff7ec6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20830,10 +20830,11 @@ ones already marked." (set-mark (save-excursion (goto-char (mark)) - (goto-char (org-element-property :end (org-element-at-point))))) + (goto-char (org-element-property :end (org-element-at-point))) + (point))) (let ((element (org-element-at-point))) (end-of-line) - (push-mark (org-element-property :end element) t t) + (push-mark (min (point-max) (org-element-property :end element)) t t) (goto-char (org-element-property :begin element)))))) (defun org-narrow-to-element () diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index e0e4c5d..f58a874 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -2787,6 +2787,27 @@ Foo Bar ;;; Mark Region +(ert-deftest test-org/mark-element () + "Test `org-mark-element' specifications." + ;; Mark beginning and end of element. + (should + (equal '(t t) + (org-test-with-temp-text "Para<point>graph" + (org-mark-element) + (list (bobp) (= (mark) (point-max)))))) + (should + (equal '(t t) + (org-test-with-temp-text "P1\n\nPara<point>graph\n\nP2" + (org-mark-element) + (list (looking-at "Paragraph") + (org-with-point-at (mark) (looking-at "P2")))))) + ;; Do not set mark past (point-max). + (should + (org-test-with-temp-text "Para<point>graph" + (narrow-to-region 2 6) + (org-mark-element) + (= 6 (mark))))) + (ert-deftest test-org/mark-subtree () "Test `org-mark-subtree' specifications." ;; Error when point is before first headline. |