unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] lisp/browse-url.el: Revisiting my elinks addition
@ 2007-09-14 10:51 Johannes Weiner
  2007-09-17 12:48 ` [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (improved resend) Johannes Weiner
  2007-09-17 12:50 ` [PATCH] lisp/browse-url.el: Revisiting my elinks addition Michaël Cadilhac
  0 siblings, 2 replies; 6+ messages in thread
From: Johannes Weiner @ 2007-09-14 10:51 UTC (permalink / raw)
  To: Emacs development discussions


[-- Attachment #1.1.1: Type: text/plain, Size: 162 bytes --]

Hi,

attached is a patch that fixes some issues with the new elinks support in
browse-url.el.  Please see the patch, it includes a lisp/ChangeLog entry.

	Hannes

[-- Attachment #1.1.2: emacs-browse-url-elinks-fixes.patch --]
[-- Type: text/x-diff, Size: 3842 bytes --]

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11743
diff -u -r1.11743 ChangeLog
--- lisp/ChangeLog	14 Sep 2007 08:10:15 -0000	1.11743
+++ lisp/ChangeLog	14 Sep 2007 10:50:15 -0000
@@ -1,3 +1,11 @@
+2007-09-14  Johannes Weiner <hannes@saeurebad.de>
+
+	* 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'.
+	(browse-url-elinks-sentinel): Use browse-url-elinks-new-window.
+	Improved error message.
+
 2007-09-14  Glenn Morris  <rgm@gnu.org>
 
 	* startup.el (fancy-startup-text, fancy-about-text): Fix face
Index: lisp/net/browse-url.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/browse-url.el,v
retrieving revision 1.62
diff -u -r1.62 browse-url.el
--- lisp/net/browse-url.el	12 Sep 2007 11:48:22 -0000	1.62
+++ lisp/net/browse-url.el	14 Sep 2007 10:50:15 -0000
@@ -1512,8 +1512,16 @@
   (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.
 
@@ -1524,33 +1532,31 @@
 from `elinks-browse-url-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)))
-    ;; Try to determine if an instance is running or if we have to
-    ;; create a new one.
+  (let ((exit-status (process-exit-status process)))
     (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)
 

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

end of thread, other threads:[~2007-09-19 11:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-14 10:51 [PATCH] lisp/browse-url.el: Revisiting my elinks addition Johannes Weiner
2007-09-17 12:48 ` [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (improved resend) Johannes Weiner
     [not found]   ` <87zlzjj7ta.fsf@cadilhac.name>
2007-09-19 11:13     ` Johannes Weiner
2007-09-19 11:32       ` Michaël Cadilhac
2007-09-17 12:50 ` [PATCH] lisp/browse-url.el: Revisiting my elinks addition Michaël Cadilhac
2007-09-17 12:54   ` Johannes Weiner

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).