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/README.org

67 lines
2.3 KiB
Org Mode
Raw Normal View History

2015-06-10 16:44:30 +00:00
#+TITLE: Chrome contribution layer for Spacemacs
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../css/readtheorg.css" />
2015-06-10 16:44:30 +00:00
[[file:img/chrome.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Feature:][Feature:]]
- [[Install][Install]]
- [[Layer][Layer]]
- [[Chrome extension][Chrome extension]]
- [[Configuration][Configuration]]
2015-06-10 16:44:30 +00:00
* Description
This layer provides some integration with the Google Chrome browser.
** Feature:
2015-06-10 16:44:30 +00:00
- Edit text boxes with Emacs using [[http://melpa.org/#/edit-server][edit-server]]
* Install
** Layer
To use this contribution add it to your =~/.spacemacs=
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(chrome))
#+END_SRC
** Chrome extension
[[http://melpa.org/#/edit-server][edit-server]] is a server that responds to edit requests sent Chrome via the
Google Chrome extension [[https://chrome.google.com/webstore/detail/edit-with-emacs/ljobjlafonikaiipfkggjbhkghgicgoh][Edit with Emacs]]. You have to install this extension.
More information can be found on [[http://www.emacswiki.org/emacs/Edit_with_Emacs][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=.
#+BEGIN_SRC emacs-lisp
(defun dotspacemacs/user-config ()
2015-06-10 16:44:30 +00:00
;; Open github text areas as org buffers
;; currently they are opened as markdown
(setq edit-server-url-major-mode-alist
'(("github\\.com" . org-mode))))
2015-06-10 16:44:30 +00:00
#+END_SRC
To change frame defaults (width, height, etc. use =edit-server-new-frame-alist=)
#+BEGIN_SRC emacs-lisp
(add-to-list 'edit-server-new-frame-alist '(width . 140))
(add-to-list 'edit-server-new-frame-alist '(height . 60))
#+END_SRC
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:
#+BEGIN_SRC emacs-lisp
(add-hook 'edit-server-done-hook (lambda () (shell-command "open -a \"Google Chrome\"")))
#+END_SRC