This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/chrome
syl20bnr 6b33031dc5 core: dotspacemacs-distribution, spacemacs-core layer and rename contrib
- Rename contrib directory to layers
- Add new variable dotspacemacs-distribution
- Move spacemacs layer to layers/!distribution
- New layer spacemacs-core in layers/!distribution
- User can now set dotspacemacs-distribution to spacemacs or
  spacemacs-core (default spacemacs)

spacemacs-core is very lightweight layer sufficient to build upon
spacemacs.
2015-09-07 23:44:43 -04:00
..
img core: dotspacemacs-distribution, spacemacs-core layer and rename contrib 2015-09-07 23:44:43 -04:00
packages.el core: dotspacemacs-distribution, spacemacs-core layer and rename contrib 2015-09-07 23:44:43 -04:00
README.org core: dotspacemacs-distribution, spacemacs-core layer and rename contrib 2015-09-07 23:44:43 -04:00

Chrome contribution layer for Spacemacs

/TakeV/spacemacs/media/commit/9bc754c50cbb699cdc6a34949ea6a2f0a26c8049/layers/chrome/img/chrome.png

Description

This layer provides some integration with the Google Chrome browser.

Feature:

Install

Layer

To use this contribution add it to your ~/.spacemacs

  (setq-default dotspacemacs-configuration-layers '(chrome))

Chrome extension

edit-server is a server that responds to edit requests sent Chrome via the Google Chrome extension Edit with Emacs. You have to install this extension.

More information can be found on Emacs Wiki. The edit server is configured to start automatically when Spacemacs starts.

Configuration

Use edit-server-url-major-mode-alist to choose a major mode initialization function based on edit-server-url, or fall back to edit-server-default-major-mode that has a current value of markdown-mode.

  (defun dotspacemacs/config ()
  ;; Open github text areas as org buffers
  ;; currently they are opened as markdown
    (setq edit-server-url-major-mode-alist
        '(("github\\.com" . org-mode))))

To change frame defaults (width, height, etc. use edit-server-new-frame-alist)

  (add-to-list 'edit-server-new-frame-alist '(width  . 140))
  (add-to-list 'edit-server-new-frame-alist '(height . 60))

If you want Emacs to switch focus to Chrome after done editing, you can utilize edit-server-done-hook. Emacs cannot control focus of windows for external apps, so you need to use some sort of command line window manager like wmctrl. The following example works on OS X:

  (add-hook 'edit-server-done-hook (lambda () (shell-command "open -a \"Google Chrome\"")))