From: Johannes Weiner <hannes@saeurebad.de>
To: Emacs development discussions <emacs-devel@gnu.org>
Subject: [PATCH] lisp/browse-url.el: Revisiting my elinks addition
Date: Fri, 14 Sep 2007 12:51:43 +0200 [thread overview]
Message-ID: <20070914105143.GA5686@saeurebad.de> (raw)
[-- 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
next reply other threads:[~2007-09-14 10:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 10:51 Johannes Weiner [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070914105143.GA5686@saeurebad.de \
--to=hannes@saeurebad.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.