Subject: bug#41133: 28.0.50; Respect browse-url user options in shr/eww

From: "Basil L. Contovounesios" <[email-masked]>
Date: Sat, 09 May 2020 14:32:29 +0100

Tassilo Horn <[email-masked]> writes:

> "Basil L. Contovounesios" <[email-masked]> writes:
>
>> X-Debbugs-Cc: Lars Ingebrigtsen <[email-masked]>, Tassilo Horn <[email-masked]>
>> Severity: wishlist
>> Tags: patch
>>
>> The commands shr-browse-url and eww-follow-link currently pass mailto
>> URLs directly to browse-url-mail, which doesn't respect the user options
>> browse-url-handlers and browse-url-mailto-function.
>>
>> Can't/shouldn't the commands call browse-url instead?
>> WDYT of the attached patch that does this?
>
> Looks good to me (I just looked at the parts calling browse-url), and I
> think it won't change any behavior unless the user customizes
> browse-url-handlers to catch mailto links with his own function instead
> of the default one in browse-url-default-handlers (which in turn just
> calls browse-url-mailto-function).

Thanks.

> BTW: I didn't know about function-put.  Should that be preferred to put?
> I've tested that put/get also work with #'function, so where's the
> difference?

function-put is currently identical to put, but this may change in the
future.  Quoth (info "(elisp) Symbol Plists"):

 -- Function: function-put function property value
     This function sets PROPERTY of FUNCTION to VALUE.  FUNCTION should
     be a symbol.  This function is preferred to calling ‘put’ for
     setting properties of a function, because it will allow us some day
     to implement remapping of old properties to new ones.

See also the commentary in its definition:

  (defalias 'function-put
    ;; We don't want people to just use `put' because we can't conveniently
    ;; hook into `put' to remap old properties to new ones.  But for now, there's
    ;; no such remapping, so we just call `put'.
    #'(lambda (function prop value)
        "Set FUNCTION's property PROP to VALUE.
  The namespace for PROP is shared with symbols.
  So far, FUNCTION can only be a symbol, not a lambda expression."
        (put function prop value)))

-- 
Basil