[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] org-babel-demarcate-block: split using element API
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] org-babel-demarcate-block: split using element API |
Date: |
Tue, 16 Jan 2024 13:34:20 +0000 |
gerard.vermeulen@posteo.net writes:
>>> 1 unexpected results:
>>> FAILED test-ob/demarcate-block ((should (string= region-text
>>> (org-trim (nth 1 info)))) :form (string= "mark this line as region"
>>> "") :value nil :explanation (arrays-of-different-length 24 0 "mark
>>> this line as region" "" first-mismatch-at 0))
>>
>> This is a tough lesson: the tests pass always on my system.
>>
>> I think the failure you see is related to a problem marking a region
>> in my test code (wish: support in `org-test-with-temp-text' for
>> "<mark>" besides "<point>", but maybe that depends on ERT), else
>> the problem would have shown up while testing the patch interactively.
>>
>> I think that I have improved my region marking code by using "<point>"
>> in the temp-text as a start. Then, I only have to find where to set
>> mark,
>> and eventually exchange point and mark.
Still failing on my side (when running tests non-interactively from
command line). To fix the problem, please use the approach from
`test-org-list/indent-item':
(transient-mark-mode 1)
(push-mark (point) t t)
Instead of (set-mark-command nil)
> + ;; Map positions to columns for white-space padding.
> + (setq pads (mapcar (lambda (p) (save-excursion
> + (goto-char p)
> + (current-column)))
> + pads))
This will break when the region does not start near the beginning of
line or does not end there:
#+begin_src emacs-lisp
<mark>'(1 2 3)
'(1 2 <point>3)
#+end_src
Also, the indentation of source code inside src block should not be used
to indent the whole block. This is because it may be additionally
indented according to `org-edit-src-content-indentation'. If you want to
preserve the original indentation, just use
`org-current-text-indentation' at the beginning of the src block.
--
Ihor Radchenko // yantar92,
Org mode contributor,
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>
- Re: [PATCH] org-babel-demarcate-block: split using element API, (continued)
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, Ihor Radchenko, 2024/01/09
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/13
- Re: [PATCH] org-babel-demarcate-block: split using element API, Ihor Radchenko, 2024/01/13
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/13
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/14
- Re: [PATCH] org-babel-demarcate-block: split using element API, Ihor Radchenko, 2024/01/14
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/14
- Re: [PATCH] org-babel-demarcate-block: split using element API, gerard . vermeulen, 2024/01/15
- Re: [PATCH] org-babel-demarcate-block: split using element API,
Ihor Radchenko <=