[Top][All Lists]

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

Re: [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking

From: Ihor Radchenko
Subject: Re: [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking
Date: Sat, 30 Jul 2022 12:56:42 +0800

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

> +(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.


reply via email to

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