bug#81552: [PATCH] Fix handling of spaces for webjump's Wikipedia query

Sean Whitton <[email protected]> Wed, 05 Aug 2026 13:39:16 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Perry Fraser [04/Aug  5:02pm -04] wrote:
> From 1a0e57c09514f1469ebf858e649d8ceb27477543 Mon Sep 17 00:00:00 2001
> From: Perry Fraser <[email protected]>
> Date: Tue, 4 Aug 2026 16:29:27 -0400
> Subject: [PATCH] Fix webjump's encoding of spaces for Wikipedia
>
> Wikipedia expects spaces to be encoded as underscores rather
> than pluses, so give it a site function that wraps
> `webjump-do-simple-query' and makes that replacement. Also
> adjust its URL to use Special:Search which will redirect to a
> search page if the query doesn't match an existing article.

We prefer things like this to be in code comments instead of in the
commit message.

> @@ -228,6 +228,13 @@ webjump-to-risks
>  	(format "catless.ncl.ac.uk/Risks/%d.%02d.html" volume issue)
>        "catless.ncl.ac.uk/Risks/")))
>
> +(defun webjump-to-wikipedia (_)
> +  ;; Wikipedia expects spaces to be encoded as underscores, not pluses.
> +  (string-replace "+" "_" (webjump-do-simple-query
> +                           "Wikipedia"
> +                           "https://wikipedia.org"
> +                           "https://wikipedia.org/wiki/Special:Search/" "")))
> +

Perhaps we should call this webjump--to-wikipedia since it's an internal
function?  And conventionally if a function ignores all its arguments
it's usually more readable to write "(&rest _ignore)".

-- 
Sean Whitton