From: Johannes Weiner <hannes@saeurebad.de>
To: Emacs development discussions <emacs-devel@gnu.org>
Subject: [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (improved resend)
Date: Mon, 17 Sep 2007 14:48:43 +0200 [thread overview]
Message-ID: <20070917124843.GA26157@saeurebad.de> (raw)
In-Reply-To: <20070914105143.GA5686@saeurebad.de>
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Hi,
here is an improved revision of the patch that fixes several tiny mistakes in
lisp/net/browse-url.el regarding the new Elinks support.
The current browse-url-elinks function is broken!
Patch including ChangeLog entry attached.
Hannes
[-- Attachment #2: emacs-browse-url-elinks-fixes-r1.patch --]
[-- Type: text/x-diff, Size: 3923 bytes --]
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11766
diff -u -r1.11766 ChangeLog
--- lisp/ChangeLog 17 Sep 2007 07:02:35 -0000 1.11766
+++ lisp/ChangeLog 17 Sep 2007 12:43:49 -0000
@@ -1,3 +1,11 @@
+2007-09-17 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'. Fix typo in doc-string.
+ (browse-url-elinks-sentinel): Use browse-url-elinks-new-window.
+ Improved error message.
+
2007-09-17 Glenn Morris <rgm@gnu.org>
* textmodes/tex-mode.el (tex-compilation-parse-errors): Prefer the
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 17 Sep 2007 12:43:50 -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.
@@ -1521,36 +1529,34 @@
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)))
- ;; 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 #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-09-17 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 10:51 [PATCH] lisp/browse-url.el: Revisiting my elinks addition Johannes Weiner
2007-09-17 12:48 ` Johannes Weiner [this message]
[not found] ` <87zlzjj7ta.fsf@cadilhac.name>
2007-09-19 11:13 ` [PATCH] lisp/net/browse-url.el: Bugfixes regarding Elinks support (improved resend) 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070917124843.GA26157@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 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).