emacs-orgmode
[Top][All Lists]
Advanced

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

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


From: Hraban Luyat
Subject: Re: [PATCH] ob-tangle.el: fix ‘:comments noweb’ double linking
Date: Wed, 10 Aug 2022 20:54:55 +0000


On 8/3/22 11:55 AM, Max Nikulin wrote:
>> +      (when bare
>> +        (if (and org-babel-tangle-use-relative-file-links
>> +                 (string-match org-link-types-re bare)
>> +                 (string= (match-string 1 bare) "file"))
>> +            (concat "file:"
>> +                    (file-relative-name (substring bare (match-end 0))
>> +                                        (file-name-directory
>> +                                         (cdr (assq :tangle params)))))
>
> Is there any problem with the following?
>
>        (alist-get :tangle params)

This bit of code was moved, I didn't write it. The original code uses a
variable `src-tfile' which isn't available here, so I reused the
definition of that variable (which is (cdr (assq yada yada))). When
creating this patch, I tried to change as little as possible, to keep
everything the same as much as I can. Don't write new code, just move
existing code around.

The (cdr (assq ..)) is used in some other places, too; maybe it's worth
a separate refactor if we want to change that? I'd rather keep this
patch as isolated as possible.

>> +          bare)))))
>
> I have not read the patch care carefully, so I may miss something. It
> seems that (when bare (if (and other...) (action) bare)) may be
> simplified to
>
>       (and bare other... (action))
>
>

Do you mean to rewrite

     (when bare (if x y bare))

to this?

     (and bare x y)

If that's what you meant, I think it would evaluate differently if bare
= truthy and x = falsy, right? Form 1 evaluates to `bare', form 2
evaluates to x (i.e. NIL). Or did I misunderstand the suggestion?

@Ihor: I have rebased the patch and attached it.

Attachment: 0001-ob-tangle.el-fix-comments-noweb-double-linking.patch
Description: Text document


reply via email to

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