Rens Oliemans <[email protected]> writes:

> Ihor Radchenko <[email protected]> writes:
>
>> See 43.17 Batch Mode section of Elisp manual. It is Emacs default to
>> print message output to stderr.
>
> OK, thanks for the information. This means that the warnings are finding a
> needle in a haystack, though one can always grep for "Warning" in the stderr.
>
> About warnings: I now issue a warning if a link description refers to the full
> domain being replaced, like so:
>
>     Warning (emacs): Link description "Org-mode discussions on reddit.com" in 
> /home/rens/Projects/org/worg/index.org:87 refers to the full domain 
> "reddit.com", which we change. This is confusing, please change the 
> description.

Maybe it can simply be error?

>>> I can't get (load "...") to work, unless I do (push "./" load-path)
>>> beforehand. From the docs of `load':
>>>
>>>     ...
>>>     This function searches the directories in ‘load-path’.
>>>
>>> Am I missing something?
>>
>> Yeah. Need (load "./rewrite-urls") - path, not just file name.
>
> This still does not work for me.
>
> (load "./worg-urls-rewrite") gives the error

Right.
(load-file "./worg-urls-rewrite.el") works.
(This time, I tested myself)

>> Side note: gmane is down, so all links it gmane are broken.
>
> I have ignored this for now since it's somewhat orthogonal to this, but I can
> fix this up later.

That was a comment for Christian.

>> Here and in other places, should use prefix worg-urls-get-libredirect-data.
>> Also, try M-x checkdoc on the file. You will see a lot of stylistic 
>> suggestions.
>
> Have done so, see attached patch for the updated version. Again, you can see
> the changes on https://files.rensoliemans.nl/worg, though the new changes have
> been mostly internal.

Thanks!
Looks mostly good. A few comments below.

> +++ b/rewrite-websites.js

This file is not used by anything.

> +;;; worg-urls-rewrite.el --- Rewrite URLs that refer to pages containing 
> non-free JS to free alternatives
> +
> +;;; Commentary:
> ...

Here, and in rewrite-websites.js, we need to put a GPLv3 license notice.
It is not "a part of Emacs" and not copyrighted by FSF, but we need to
add a header for GPLv3.

> +(defun worg-urls--find-replacement (path)
> +  "Take PATH and return an alternative link if known and nil otherwise."
> +  (and worg-urls-libredirect-data
> ...
> +      ;; redirect reddit.com to old.reddit.com
> +      ((rx "//" (? "www\.")
> +           "reddit.com"
> +           "/"
> +           (group (+ not-newline)))
> +       (let* ((url (match-string 1 path))
> +              (host "https://old.reddit.com";))
> +         (concat host "/" url))))))

We can do reddit redirects even when libredirect data is not available.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>

Reply via email to