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

[PATCH] w3m-input-url

The attached patch corrects a nuisance I've had with the package since
I started using it. I hope it or an equivalent can be accepted.

The issue occurs when using command 'g', 'G', or 'U' to open a new url
or perform a search. When one enters something of the form xxx.xxx
without a protocol prefix xxxx://, the package interprets the input as
a search request.

My expectation was that inputing:

  https://google.com    go there, and it does
  google.com            go there, and it doesn't
  google                peform a google search on the word

The patch also interprets any input containing a space as a search
request, so the following will perform searches:

  what is google.com

CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
--- w3m.el	2017-05-30 02:44:36.532523239 -0400
+++ w3m-new.el	2017-05-30 02:44:58.824734061 -0400
@@ -4756,6 +4756,10 @@
 	(if (stringp url)
 	      ;; remove duplication
+          (when (and (not (string-match ":" url))
+                     (not (string-match " " url))
+                     (string-match ".\\.." url))
+            (setq url (concat "https://"; url)))
 	      (setq w3m-input-url-history
 		    (cons url (delete url w3m-input-url-history)))
 	      (w3m-canonicalize-url url feeling-lucky))