[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] ob-tangle.el: New value 'ascii' for the header argument ':co
From: |
Juan Manuel Macías |
Subject: |
Re: [Patch] ob-tangle.el: New value 'ascii' for the header argument ':comments' |
Date: |
Sat, 11 Jun 2022 11:20:02 +0000 |
Hi, Ihor, thanks for your comments,
Ihor Radchenko writes:
> Wouldn't it be better to supply a customization for
> org-babel-process-comment-text instead?
>
> I do not feel that per-src-block control on the comment type makes much
> sense here.
My first approach was actually to define some options for
org-babel-process-comment. But I noticed that a header with properties,
for example:
* Header
:PROPERTIES:
:FOO: var
:END:
is interpreted as:
;; Header
;; :FOO: var
I think the culprit is the '(match-end 0)' in
org-babel-tangle-single-block:
...
(comment
(when (or (string= "both" (cdr (assq :comments params)))
(string= "org" (cdr (assq :comments params))))
;; From the previous heading or code-block end
(funcall
org-babel-process-comment-text
(buffer-substring
(max (condition-case nil
(save-excursion
(org-back-to-heading t) ; Sets match data
(match-end 0)) ;; <=========
(error (point-min)))
(save-excursion
(if (re-search-backward
org-babel-src-block-regexp nil t)
(match-end 0) ;; <=========
(point-min))))
(point)))))
...
So I couldn't think of any other solution than to put the change there,
so as not to break backwards compatibility. But it is a somewhat tricky
solution...
Best regards,
Juan Manuel
Re: [Patch] ob-tangle.el: New value 'ascii' for the header argument ':comments', Rudolf Adamkovič, 2022/06/12