bug#81552: [PATCH] Fix handling of spaces for webjump's Wikipedia query
Perry Fraser <[email protected]> Wed, 05 Aug 2026 10:33:41 -0400
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Sean Whitton <[email protected]> writes: > 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. Interesting—that definitely goes against my normal instinct. For example, the note about changing to using `Special:Search', it wouldn't make sense to leave that as a comment. In my mind that belongs in the commit message. For something like "Wikipedia expects spaces [...]", you're saying it's better to /just/ be as a code comment? >> @@ -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? Probably... the other site specific functions are all single-hyphens, though. > And conventionally if a function ignores all its arguments it's > usually more readable to write "(&rest _ignore)". Got it! Thanks, ― Perry