Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;;; Commentary
;; Select and activate google chrome tabs by anything interface
;;; Requirements
;;; Usage
;; (require 'anything-chrome-tabs)
;; (crxel/start 9649)
;; (define-key global-map "C-t" 'anything-chrome-tabs)
(provide 'anything-chrome-tabs)
(require 'crxel)
(require 'anything-config)
(defun chrome-tab-url (tab)
(cdr-safe (assq 'url tab)))
(defun chrome-tab-title (tab)
(cdr-safe (assq 'title tab)))
(defun chrome-tab-id (tab)
(cdr-safe (assq 'id tab)))
(defun chrome-activate-tab (tab)
(crxel/eval (format "chrome.tabs.update(%s, { active: true });"
(chrome-tab-id tab))
:fail 'error))
(defun anything-chrome-tabs ()
(crxel/eval "var callback = window.crxel.callback;
chrome.tabs.query({}, function(tabs) {
:async t
:success (lambda (data)
(json-read-from-string data) nil)))
:fail 'error))
(defun anything-chrome-tabs-0 (tabs)
`((name . "Chrome Tabs")
(candidates . ,tabs)
(action . (("Activate" . chrome-activate-tab)))
(candidate-transformer . (lambda (tabs)
(mapcar (lambda (tab)
(chrome-tab-url tab)
(chrome-tab-title tab))
tab)) tabs)))
"*anything chrome tabs*"))

This comment has been minimized.

Copy link

tmaeda commented Mar 9, 2014


quote が足りないようです。

;;  (define-key global-map "C-t" 'anything-chrome-tabs)

This comment has been minimized.

Copy link
Owner Author

mechairoi commented Jul 3, 2014


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.