dmg <d...@turingmachine.org> writes: > In the first, the point is left after the asterisks of the heading. > In the subsequent calls, the point is correctly set to the first > asterisk of the headline (this is done by outline-next-heading). > > Make sure the first header is processed the same way as the rest. > > * lisp/org.el (org-map-region): Add a call to goto-char to go > to the beginning of the match after the first search. > > * testing/lisp/test-org.el (test-org/map-region): add tests > for org-map-region
Thanks for the patch! Please fix the commit message to follow the format as described in https://orgmode.org/worg/org-contribute.html#commit-messages In particular, make sure to put changelog entries at the beginning and `quote' Elisp symbols. > +(ert-deftest test-org/map-region () > + "Test `org-map-region'." When I run make test, the test is failing: Test test-org/map-region condition: (void-function org-map-region-with-results) FAILED 1256/1364 test-org/map-region (0.000828 sec) at ../lisp/test-org.el:3164 > + (let > + ;; org-map-region does not return anything so we need to `org-map-region' > + (equal (list 1 11) > + (org-test-with-temp-text "* Level 1\n** Level 2" > + (org-map-region-with-results #'point)))) > + (should > + (equal (list 3 23) > + (org-test-with-temp-text "\n\n* Level 1\nSome text\n** Level 2" > + (org-map-region-with-results #'point)))) > + (should > + (equal (list 2 45 88 127 166) This is awkward to test this kind of test - one will need to count characters if the test is failing. I suggest not using `point' and instead going for something like (buffer-substring-no-properties (point) (line-end-position)) It will be much easier to test. Also, you probably need to add TINYCHANGE cookie as you do not seem to have copyright assignment. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>