From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Why Emacs should have a good web-browser Date: Thu, 13 Aug 2009 18:54:33 -0400 Message-ID: <2154954C-8DB3-42DA-8CAA-A297B16E250A@merrillpress.com> References: <87r5wqvqsn.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250204112 6991 80.91.229.12 (13 Aug 2009 22:55:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Aug 2009 22:55:12 +0000 (UTC) Cc: Chong Yidong , ferkiwi+a@gmail.com, joakim@verona.se, emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 14 00:55:04 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MbjCH-0002WA-C6 for ged-emacs-devel@m.gmane.org; Fri, 14 Aug 2009 00:55:01 +0200 Original-Received: from localhost ([127.0.0.1]:52683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbjCG-0004kJ-MC for ged-emacs-devel@m.gmane.org; Thu, 13 Aug 2009 18:55:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbjCB-0004kE-W0 for emacs-devel@gnu.org; Thu, 13 Aug 2009 18:54:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbjC7-0004jW-62 for emacs-devel@gnu.org; Thu, 13 Aug 2009 18:54:55 -0400 Original-Received: from [199.232.76.173] (port=50680 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbjC7-0004jT-0a for emacs-devel@gnu.org; Thu, 13 Aug 2009 18:54:51 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:6120) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbjC6-0007JN-Fu for emacs-devel@gnu.org; Thu, 13 Aug 2009 18:54:50 -0400 Original-Received: from vpn.merrillpress.com ([64.61.107.78]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbjC4-0006Jq-IU for emacs-devel@gnu.org; Thu, 13 Aug 2009 18:54:49 -0400 Original-Received: from cpe-67-246-181-235.buffalo.res.rr.com ([67.246.181.235] helo=[192.168.1.103]) by mars.merrillpress.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1MbjBq-0003Bu-GC; Thu, 13 Aug 2009 18:54:34 -0400 In-Reply-To: X-Mailer: Apple Mail (2.936) X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114200 Archived-At: On Jul 8, 2009, at 6:42 PM, Lennart Borgman wrote: > BTW, I have heard that espresso offers even better interaction than > MozRepl but I am not sure. Is there anyone who knows more about this? > Some examples of how to interact from Espresso/MozRepl? Here is an example of some code from espresso (after the rename to js- mode). I hope the JS interaction is self-explanatory, at least for the purpose of discussion. (FWIW, maybe the elisp<->js bridge really should be moved to moz.el?) (defun js--get-tabs () "Enumerate all the contexts available. Each one is a list: The list is (TITLE URL BROWSER TAB TABBROWSER) for content documents The list is (TITLE URL WINDOW) for windows All tabs of a given window are grouped together. The most recent window is first. Within each window, the tabs are returned left-to-right. " (with-js (let (windows) (loop with window-mediator = (js! ("Components" "classes" "@mozilla.org/appshell/window- mediator;1" "getService") (js< "Components" "interfaces" "nsIWindowMediator")) with enumerator = (js! (window-mediator "getEnumerator") nil) while (js? (js! (enumerator "hasMoreElements"))) for window = (js! (enumerator "getNext")) for window-info = (js-list window (js< window "document" "title") (js! (window "location" "toString")) (js< window "closed") (js< window "windowState")) unless (or (js? (fourth window-info)) (eq (fifth window-info) 2)) do (push window-info windows)) (loop for window-info in windows for window = (first window-info) collect (list (second window-info) (third window-info) window) for gbrowser = (js< window "gBrowser") if (js-handle? gbrowser) nconc (loop for x below (js< gbrowser "browsers" "length") collect (js-list (js< gbrowser "browsers" x "contentDocument" "title") (js! (gbrowser "browsers" x "contentWindow" "location" "toString")) (js< gbrowser "browsers" x) (js! (gbrowser "tabContainer" "childNodes" "item") x) gbrowser))))))