Short version: how can I make sure that \% strings are replaced by %, in the url argument of browse-url?
Long version:
In LaTeX, URLs that appear in \url{} macros need to have any % character escaped by \ in many situations (eg when \url is within another macro; see this question). So there could be a LaTeX piece with, say,
\url{http://www.math.cmu.edu/~wn0g/Surface\%20Interactions.pdf}
This is fine, but if I wish to browse that URL from Emacs with browse-url, the escape-character \ causes problems: either
browse-urlrecognizes the url only up to the escape, in this casehttp://www.math.cmu.edu/~wn0g/Surface; or- if I select the full URL as a region, then
browse-urlincludes the escape:http://www.math.cmu.edu/~wn0g/Surface\%20Interactions.pdfso that I have to remove it by hand (laborious if the URL has many%).
So I wonder if someone can help me with some solution. For example:
- (as suggested by @db48x) Wrapping
browse-urlinto a custom function which also takes care of stripping\in front of%. Unfortunately my elisp knowledge is too rudimentary for writing something like this. - Changing
browse-url, for instance withdefadvicein such a way that\%strings in the url argument are always converted to%.
I first checked among Emacs's customizable variables if something like this is already built-in, but didn't find anything relevant. Also checked several questions here for this, for example this one and this one but they seem somewhat overkill.