emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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/)]
@ 2023-06-21 19:45 Nick Dokos
  2023-06-22  9:55 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2023-06-21 19:45 UTC (permalink / raw)
  To: emacs-orgmode



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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-27  3:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 19:45 [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/)] Nick Dokos
2023-06-22  9:55 ` Ihor Radchenko
2023-06-24  3:19   ` Nick Dokos
2023-06-24 12:37     ` Ihor Radchenko
2023-06-27  3:25       ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).