Move Google-specific strings to customize options or special variables
I presume from the closure of #16 that outright support for other search engines is no longer being considered. Would you consider moving more of the strings that are fixed in various functions that are fixed in various functions to customize options or special variables (defined with defvar) instead?
This would make it easier for others to either replace Google with another search engine or build other commands that use dynamic binding to change the behavior at one point. This would have considerably less support burden than building your own interface to enable this.
For example, I built a pubmed-this command to search PubMed instead of Google on top of google-this:
(defun pubmed-this-url ()
"Return URL for PubMed search."
"https://www.ncbi.nlm.nih.gov/pubmed/?term=%s")
(defun pubmed-this (&rest args)
"Decide what the user wants to PubMed (always something under point).
Inserts the query in the minibuffer to be edited.
Passes ARGS to `google-this'."
(interactive "P")
(cl-letf (((symbol-function #'google-this-url)
(symbol-function #'pubmed-this-url)))
(apply #'google-this args)))
This requires using cl-letf to temporarily rebind a function, which is clunky. It also does not replace things like the "Googling" prompt from google-this-pick-term, which would be considerably more involved to replace.
Ideally, with special variables google-this-url-filename and google-this-prompt, one would be able to do it like this instead:
(defun pubmed-this (&rest args)
"Decide what the user wants to PubMed (always something under point).
Inserts the query in the minibuffer to be edited.
Passes ARGS to `google-this'."
(interactive "P")
(let ((google-this-base-url "https://www.ncbi.nlm.nih.")
(google-this-location-suffix "gov")
(google-this-url-filename "/pubmed/?term=%s")
(google-this-prompt "PubMedding"))
(apply #'google-this args)))