unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH][BUG]: eww doesnt trim whitespace from address
@ 2014-03-21  9:27 Vibhav Pant
  2014-11-03 13:46 ` Ted Zlatanov
  0 siblings, 1 reply; 4+ messages in thread
From: Vibhav Pant @ 2014-03-21  9:27 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

As of now, eww does not rim the user specified address, this often
leads to problems especially if the address is from the clipboard (eww
reports that the service isnt known). Most browsers automatically do
this, so I have included a patch to solve this problem.

This patch simply setq's url to a "trimmed" version of it.
The change is pretty non trivial, so I think it can be included in this release.

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e8eb09c..aa3e245 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -153,6 +153,10 @@ See also `eww-form-checkbox-selected-symbol'."
 If the input doesn't look like an URL or a domain name, the
 word(s) will be searched for via `eww-search-prefix'."
   (interactive "sEnter URL or keywords: ")
+  (setq url (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
+                                             (: (* (any " \t\n")) eos)))
+                                     ""
+                                     url))
   (cond ((string-match-p "\\`file://" url))
         ((string-match-p "\\`ftp://" url)
          (user-error "FTP is not supported."))

-- 
Vibhav Pant
vibhavp@gmail.com

[-- Attachment #2: ewwtrim.patch --]
[-- Type: text/x-patch, Size: 717 bytes --]

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e8eb09c..aa3e245 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -153,6 +153,10 @@ See also `eww-form-checkbox-selected-symbol'."
 If the input doesn't look like an URL or a domain name, the
 word(s) will be searched for via `eww-search-prefix'."
   (interactive "sEnter URL or keywords: ")
+  (setq url (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
+                                             (: (* (any " \t\n")) eos)))
+                                     ""
+                                     url))
   (cond ((string-match-p "\\`file://" url))
         ((string-match-p "\\`ftp://" url)
          (user-error "FTP is not supported."))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-04 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21  9:27 [PATCH][BUG]: eww doesnt trim whitespace from address Vibhav Pant
2014-11-03 13:46 ` Ted Zlatanov
2014-11-03 14:49   ` Yuri Khan
2014-11-04 16:33     ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).