emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Hraban Luyat <hraban@0brg.net>, Bastien <bzg@gnu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking
Date: Sat, 30 Jul 2022 12:56:42 +0800	[thread overview]
Message-ID: <87wnbvtcz9.fsf@localhost> (raw)
In-Reply-To: <01070182484e44f3-f0fd271a-def3-4c86-961f-9a4bb63949d5-000000@eu-central-1.amazonses.com>

Hraban Luyat <hraban@0brg.net> writes:

> This is my first org-mode patch, all comments welcome :). I signed a
> copyright assignment to the FSF 2021-07-12.

Thanks for the contribution!

Bastien, could you please check the FSF records?

The patch looks good in general. Few minor comments below.

> * lisp/ob-tangle.el: Refactor the double implementation to a single
> helper function. This avoids the double link wrapping.

> * testing/lisp/test-ob-tangle.el: Add unit tests.
>
> Babel tangle allows inserting comments at the tangled site which link
> back to the source in the org file. This linking was implemented
> twice, to handle separate cases, but when using ‘:comments noweb’ it
> ended up going through both codepaths. This resulted in doubly wrapped
> links.

Please use double space "  " between sentences. See
https://orgmode.org/worg/org-contribute.html#commit-messages

> +(defun org-babel-tangle--unbracketed-link (params)
> +  "Get a raw link to the src block at point, without brackets.
> +
> +The PARAMS are the 3rd element of the info for the same src block.
> +"

No newline at the end of the docstring, please.
See D.6 Tips for Documentation Strings in Elisp manual:

   • Do not start or end a documentation string with whitespace.

> +  (let* (;; The created link is transient.  Using ID is not necessary,
> +         ;; but could have side-effects if used.  An ID property may
> +         ;; be added to existing entries thus creatin unexpected file
> +         ;; modifications.

Can as well fix the "creatin" typo here.

> +         (org-id-link-to-org-use-id nil)
> +         (l (org-no-properties (org-store-link nil)))
> +         (bare (and (string-match org-link-bracket-re l)
> +                    (match-string 1 l))))

For safety, please wrap the matching into save-match-data.
This is often annoying when calling some random function unexpectedly
changes match-data.

> +(ert-deftest ob-tangle/comment-noweb-relative ()
> +  "Test :comments noweb tangling with relative file paths"

> +(ert-deftest ob-tangle/comment-noweb-absolute ()
> +  "Test :comments noweb tangling with absolute file path"

Full stop at the end of sentence, please.

Best,
Ihor


  reply	other threads:[~2022-07-30  4:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  4:54 [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking Hraban Luyat
2022-07-30  4:56 ` Ihor Radchenko [this message]
2022-07-30 23:42   ` Hraban Luyat
2022-08-03 11:40     ` Ihor Radchenko
2022-08-03 15:55     ` Max Nikulin
2022-08-10 20:54       ` Hraban Luyat
2022-08-11  4:26         ` Ihor Radchenko
2022-08-12  2:21           ` Hraban Luyat
2022-08-12 13:16             ` Max Nikulin
2022-08-13  6:42               ` Ihor Radchenko
2022-08-13  8:06                 ` Max Nikulin
2022-08-14  3:20                   ` Ihor Radchenko
2022-08-13  6:40             ` Ihor Radchenko
2022-08-11 15:00         ` Max Nikulin
2022-08-03 11:31   ` Bastien Guerry

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=87wnbvtcz9.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=hraban@0brg.net \
    /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).