2d7480f677
We probably want to update the `markdown` layer to be able to do this directly with `firefox`; having to kill and restart all of your `chrome` processes before using `flymd` is a little clunky! It's nice that we have the upstream workaround inlined in spacemacs, though.
77 lines
2.7 KiB
Org Mode
77 lines
2.7 KiB
Org Mode
#+TITLE: Chrome layer
|
|
|
|
#+TAGS: layer|tool
|
|
|
|
[[file:img/chrome.png]]
|
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
|
- [[#description][Description]]
|
|
- [[#features][Features:]]
|
|
- [[#install][Install]]
|
|
- [[#layer][Layer]]
|
|
- [[#chrome-extension][Chrome extension]]
|
|
- [[#configuration][Configuration]]
|
|
- [[#key-bindings][Key bindings]]
|
|
|
|
* Description
|
|
This layer provides some integration with the Google Chrome browser.
|
|
|
|
** Features:
|
|
- Edit text boxes with Emacs using [[https://github.com/stsquad/emacs_chrome][edit-server]]
|
|
- Write markdown in Emacs and realtime show in chrome using [[https://github.com/mola-T/flymd][flymd]]
|
|
- gmail message mode uses standard markdown key bindings
|
|
|
|
* Install
|
|
** Layer
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
add =chrome= to the existing =dotspacemacs-configuration-layers= list in this
|
|
file.
|
|
|
|
** Chrome extension
|
|
[[https://github.com/stsquad/emacs_chrome][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 ()
|
|
;; Open github text areas as org buffers
|
|
;; currently they are opened as markdown
|
|
(setq edit-server-url-major-mode-alist
|
|
'(("github\\.com" . org-mode))))
|
|
#+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 macOS:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(add-hook 'edit-server-done-hook (lambda () (shell-command "open -a \"Google Chrome\"")))
|
|
#+END_SRC
|
|
|
|
* Key bindings
|
|
|
|
| Key binding | Description |
|
|
|-------------+-------------|
|
|
| ~SPC a F~ | flymd-flyit |
|
|
|
|
*Note:* You need to kill all google chrome process before using =flymd-flyit=.
|
|
For details, see the upstream [[https://github.com/mola-T/flymd/blob/master/browser.md][flymd browser compatibility notes]].
|