Note that there are some explanatory texts on larger screens.

plurals
  1. POManage firefox tabs in emacs with org-mode
    primarykey
    data
    text
    <p>I recently find a way to manage firefox tab in emacs. This sounds a little crazy. I use tree style tabs(firefox addon), Moz Repl, emacs, org-mode to do it. </p> <p>For 10-15 tabs, my plan works fine. But 20+ tabs, My firefox hangs randomly. Maybe javascript stack overflow or something else? I don't know what's wrong with my code. I post the most import code here. Somesone help me to find some bugs?</p> <p>It's a basic firefox chrome code below, you can run it in firefox without emacs and MozPepl.</p> <p>I use tree style tabs api to get tabs and set each tab a cetain level. The output will be used in emacs with org-mode. tree style tabs api: <a href="http://piro.sakura.ne.jp/xul/_treestyletab.html.en#api" rel="noreferrer">http://piro.sakura.ne.jp/xul/_treestyletab.html.en#api</a></p> <p>The Code can run in many ways. I recommend "workspace addon". Copy My code, choose chrome context to run it. <a href="https://addons.mozilla.org/en-US/firefox/addon/workspace/" rel="noreferrer">https://addons.mozilla.org/en-US/firefox/addon/workspace/</a></p> <pre><code>// two helper function to get title and url of tab function getTitle(tab) { var brower = gBrowser.getBrowserForTab(tab) var url = brower.currentURI.spec var title = brower.contentTitle return title } function getUrl(tab) { var brower = gBrowser.getBrowserForTab(tab) var url = brower.currentURI.spec var title = brower.contentTitle return ":PROPERTIES:\n:URL:"+url+"\n:END:\n" } var L = gBrowser.tabContainer.childNodes.length //firefox tabs length var str = "" //global string for output //parse tabs. If tab has child, parse it. It tab has no child, just output. for(i = 0; i &lt; L; i++){ level = "*" tab = gBrowser.tabContainer.childNodes[i] if ('TreeStyleTabService' in window){ if(TreeStyleTabService.hasChildTabs(tab)) { str = [str, level, " [+] ", getTitle(tab), "\n", getUrl(tab)].join("") //output title and url. level used in org-mode treeparse(TreeStyleTabService.getChildTabs(tab), "**") //if a tab has child tabs. parse it and level up } str = [str, level, " ", getTitle(tab), "\n", getUrl(tab)].join("") } function treeparse(tablist,level) //parse a list of tabs. If tab has not a child, output. If it has childs, parse again { for(i=0 ; i &lt; tablist.length;i++) { tab = tablist[i] if ('TreeStyleTabService' in window){ if(TreeStyleTabService.hasChildTabs(tab)) { str = [str, level, " [+] ", getTitle(tab), "\n", getUrl(tab)].join("") newlevel = level + "*" treeparse(TreeStyleTabService.getChildTabs(tab),newlevel) } } } str = [str, level, " ", getTitle(tab), "\n", getUrl(tab)].join("") } } alert(str) //alert to view result. You can also write the result into a file. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload