emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@redhat.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87bkh8k3at.fsf@alphaville.usersys.redhat.com> (raw)



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	other threads:[~2023-06-21 19:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 19:45 Nick Dokos [this message]
2023-06-22  9:55 ` [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/)] Ihor Radchenko
2023-06-24  3:19   ` Nick Dokos
2023-06-24 12:37     ` Ihor Radchenko
2023-06-27  3:25       ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkh8k3at.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@redhat.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).