[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Improved duckduckgo performance



My experience using the duckduckgo search engine with emacs-w3m has been
frustrating, possibly be due to how redirects are handled. I'm
considering making a pull request for the following simple solution, but
would first like any feedback from the list.

The code is:

#+BEGIN_SRC emacs-lisp
(defun w3m-pattern-uri-readable-replace (uri format)
  "Create a \"readable\" uri based upon a regexp.
Converts URI according to FORMAT, based upon a prior regexp
search.

This is sensible because the function is meant to be used as a
parameter within variable `w3m-uri-replace-alist', for which a
prior regexp search will always be performed."
  (w3m-url-readable-string
    (replace-match format nil nil uri)))

(add-to-list 'w3m-uri-replace-alist
'("^https://duckduckgo.com/.*&uddg=\\([^&]+\\)" w3m-pattern-uri-readable-replace "\\1"))
#+END_SRC

This is the conservative version of the patch. A more aggressive version
would alter the pre-existing function `w3m-pattern-uri-replace' to
perform `w3m-url-readable-string' which from my reading of the code
seems safe.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0