emacs-devel
[Top][All Lists]
Advanced

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

Re: eww


From: joakim
Subject: Re: eww
Date: Tue, 18 Jun 2013 13:32:19 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> eww probably has a lot of stuff that could still be fixed up, but the
> basics are working now.  That is, you can search for stuff on Google and
> visit Wikipedia.  :-)
>
> I wrote it up a bit here:
>
> http://lars.ingebrigtsen.no/2013/06/eww.html


While you are at it, could you implement something like the patch below?

I use it in the xwidget branch for simplifying browsing in emacs.


diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 695b7a1..1fa52ce 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -667,7 +667,7 @@ regarding its parameter treatment."
 ;; functions allows them to be stand-alone commands, making it easier
 ;; to switch between browsers.
 
-(defun browse-url-interactive-arg (prompt)
+(defun browse-url-interactive-arg (prompt &optional default-url)
   "Read a URL from the minibuffer, prompting with PROMPT.
 If `transient-mark-mode' is non-nil and the mark is active,
 it defaults to the current region, else to the URL at or before
@@ -684,7 +684,8 @@ for use in `interactive'."
                                      "[\t\r\f\n ]+" ""
                                      (buffer-substring-no-properties
                                       (region-beginning) (region-end))))
-                               (browse-url-url-at-point)))
+                               (browse-url-url-at-point)
+                                default-url))
        (not (eq (null browse-url-new-window-flag)
                 (null current-prefix-arg)))))
 
@@ -791,6 +792,13 @@ narrowed."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Browser-independent commands
 
+(defun url-tidy (url)
+  "Tidy up URL as much as possible."
+  (if (equal 0 (string-match ".*://" url))
+      url
+    (concat "http://"; url) ;;TODO guess more url forms, like mailto
+    ))
+
 ;; A generic command to call the current browse-url-browser-function
 
 ;;;###autoload
@@ -803,6 +811,7 @@ first, if that exists."
   (interactive (browse-url-interactive-arg "URL: "))
   (unless (called-interactively-p 'interactive)
     (setq args (or args (list browse-url-new-window-flag))))
+  (setq url (url-tidy url))
   (let ((process-environment (copy-sequence process-environment))
        (function (or (and (string-match "\\`mailto:"; url)
                           browse-url-mailto-function)

-- 
Joakim Verona



reply via email to

[Prev in Thread] Current Thread [Next in Thread]