Max Nikulin <maniku...@gmail.com> writes: >>> It looks like (string-prefix-p "file:" bare) but without the complex >>> regexp. I see, such code was used before. By the way, why it is "bare", >>> not e.g. "target"? >> >> match-end is used later in the code. Thus, string-match is justified. > > The matched string is always "file:", so there is no actual point in > `string-match'. It does not really matter however. > > (let ((params '((:tangle . "/home/user/file.el"))) > (type "file:") > (target "file:///dev/null")) > (if (and target > org-babel-tangle-use-relative-file-links > (string-prefix-p type target)) > (concat type > (file-relative-name > (substring target (length type)) > (file-name-directory (alist-get :tangle params)))) > target)) > > In the code existed before and moved by the committed patch I do not > like that "then" branch of the `if' form uses side effect of evaluation > of the condition.
Sounds reasonable. Could you make a patch? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92