emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] org-babel-tangle: Header arg `:comments org' produces no comment i


From: Nick Dokos
Subject: [BUG] org-babel-tangle: Header arg `:comments org' produces no comment in the output [9.7-pre (release_9.6.6-418-g294a4d @ /home/nick/src/emacs/org/org-mode/lisp/)]
Date: Wed, 21 Jun 2023 15:45:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13)


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Here's an ECM:

--8<---------------cut here---------------start------------->8---
* Function heading

  #+begin_src elisp :tangle "file.el" :comments org
    (message "FOO")
  #+end_src
--8<---------------cut here---------------end--------------->8---

Tangling it with `C-c C-v C-t' produces the following:

--8<---------------cut here---------------start------------->8---
(message "FOO")
--8<---------------cut here---------------end--------------->8---

with no comment added.

In 9.5.5, the output is correct:

--8<---------------cut here---------------start------------->8---
;; Function heading


(message "FOO")
--8<---------------cut here---------------end--------------->8---

I narrowed it down to this snippet of code in `org-babel-tangle-single-block':

,----
|           ;; 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)))))
`----

and bisecting fingered this commit:

--8<---------------cut here---------------start------------->8---
2737128aa778297f41971cc93c464faf17718e34 is the first bad commit
commit 2737128aa778297f41971cc93c464faf17718e34
Author: Ihor Radchenko <yantar92@gmail.com>
Date:   Tue Sep 13 20:59:13 2022 +0800

    org-back-to-heading: Use cache
    
    * lisp/org.el (org-back-to-heading): Use element cache when cache is
    active.

 lisp/org.el | 63 ++++++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 41 insertions(+), 22 deletions(-)
--8<---------------cut here---------------end--------------->8---

Apparently, `org-back-to-heading' sets match data differently now: `(match-end 
0)' gets the end of the line,
Before the patch, it got the beginning of the line.

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, 
cairo version 1.17.6)
 of 2023-06-21
Package: Org mode version 9.7-pre (release_9.6.6-418-g294a4d @ 
/home/nick/src/emacs/org/org-mode/lisp/)
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




reply via email to

[Prev in Thread] Current Thread [Next in Thread]