[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (i
From: |
Johannes Weiner |
Subject: |
Re: [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (improved resend) |
Date: |
Wed, 19 Sep 2007 13:13:02 +0200 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
Hi Micha,
On Wed, Sep 19, 2007 at 11:58:09AM +0200, Michaël Cadilhac wrote:
> Johannes Weiner <address@hidden> writes:
> > The current browse-url-elinks function is broken!
> >
> > Patch including ChangeLog entry attached.
>
> Can you please send me this patch updated against the current CVS
> repository?
Yes. Patch attached.
Hannes
PS: You renamed the first argument in browse-url-url-encode-chars to `text'
but the function body still refers to `url'. It works thanks to dynamic
scoping, but I think this is not what you intended (since `text' is never used
at all in the body).
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11774
diff -u -r1.11774 ChangeLog
--- lisp/ChangeLog 19 Sep 2007 07:52:19 -0000 1.11774
+++ lisp/ChangeLog 19 Sep 2007 11:09:20 -0000
@@ -1,3 +1,11 @@
+2007-09-19 Johannes Weiner <address@hidden>
+
+ * net/browse-url.el (browse-url-elinks-new-window): New function.
+ (browse-url-elinks): Use browse-url-elinks-new-window. Accept
+ optional second argument `new-window'. Fix typo in doc-string.
+ (browse-url-elinks-sentinel): Use browse-url-elinks-new-window.
+ Improved error message.
+
2007-09-19 Glenn Morris <address@hidden>
* net/socks.el (socks-open-network-stream): Signal an explicit
Index: lisp/net/browse-url.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/browse-url.el,v
retrieving revision 1.63
diff -u -r1.63 browse-url.el
--- lisp/net/browse-url.el 17 Sep 2007 15:59:41 -0000 1.63
+++ lisp/net/browse-url.el 19 Sep 2007 11:09:20 -0000
@@ -1517,8 +1517,17 @@
(apply #'start-process (concat "KDE " url) nil browse-url-kde-program
(append browse-url-kde-args (list url))))
+(defun browse-url-elinks-new-window (url)
+ "Ask the Elinks WWW browser to load URL in a new window."
+ (let ((process-environment (browse-url-process-environment)))
+ (apply #'start-process
+ (append (list (concat "elinks:" url)
+ nil)
+ browse-url-elinks-wrapper
+ (list "elinks" url)))))
+
;;;###autoload
-(defun browse-url-elinks (url)
+(defun browse-url-elinks (url &optional new-window)
"Ask the Elinks WWW browser to load URL.
Default to the URL around the point.
@@ -1526,36 +1535,36 @@
none yet running, a newly started instance.
The Elinks command will be prepended by the program+arguments
-from `elinks-browse-url-wrapper'."
+from `browse-url-elinks-wrapper'."
(interactive (browse-url-interactive-arg "URL: "))
(setq url (browse-url-encode-url url))
- (let ((process-environment (browse-url-process-environment))
- (elinks-ping-process (start-process "elinks-ping" nil
- "elinks" "-remote" "ping()")))
- (set-process-sentinel elinks-ping-process
- `(lambda (process change)
- (browse-url-elinks-sentinel process ,url)))))
+ (if new-window
+ (browse-url-elinks-new-window url)
+ (let ((process-environment (browse-url-process-environment))
+ (elinks-ping-process (start-process "elinks-ping" nil
+ "elinks" "-remote" "ping()")))
+ (set-process-sentinel elinks-ping-process
+ `(lambda (process change)
+ (browse-url-elinks-sentinel process ,url))))))
(defun browse-url-elinks-sentinel (process url)
"Determines if Elinks is running or a new one has to be started."
- (let ((exit-status (process-exit-status process))
- (process-environment (browse-url-process-environment)))
+ (let ((exit-status (process-exit-status process)))
;; Try to determine if an instance is running or if we have to
;; create a new one.
(case exit-status
(5
;; No instance, start a new one.
- (apply #'start-process
- (append (list (concat "elinks:" url) nil)
- browse-url-elinks-wrapper
- (list "elinks" url))))
+ (browse-url-elinks-new-window url))
(0
;; Found an instance, open URL in new tab.
- (start-process (concat "elinks:" url) nil
- "elinks" "-remote"
- (concat "openURL(\"" url "\",new-tab)")))
+ (let ((process-environment (browse-url-process-environment)))
+ (start-process (concat "elinks:" url) nil
+ "elinks" "-remote"
+ (concat "openURL(\"" url "\",new-tab)"))))
(otherwise
- (error "Undefined exit-code of process `elinks'")))))
+ (error "Unrecognized exit-code %d of process `elinks'"
+ exit-status)))))
(provide 'browse-url)
signature.asc
Description: Digital signature