Skip to content

peek-mode is a minor mode that publishes live Emacs buffers through an elnode server

Notifications You must be signed in to change notification settings

erikriverson/peek-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

peek-mode

Introduction

peek-mode is a minor mode that publishes live Emacs buffers through an elnode server. This means you can view your emacs buffers in a web browser as they change. To view buffers, you must publish them. Toggling on peek-mode in a buffer will publish it to the server. To unpublish a buffer, toggle peek-mode off. (`M-x peek-mode` does the toggle.)

This behavior is currently most interesting when the buffer you are peeking at is an HTML buffer. The browser will render the html in real time as you make changes.

peek-mode is (very very!) largely based on Brian Taylor’s <[email protected]> impatient-mode . However, impatient-mode does not use elnode, but rather a different emacs httpd backend https://github.com/skeeto/emacs-http-server. I consider peek-mode as “impatient-mode ported to elnode”.

Installation

How to install elnode in less than a minute!

Assuming you’re running GNU Emacs 24+, evaluate the following code in your scratch buffer.

(require 'package)
(add-to-list 'package-archives 
    '("marmalade" .
      "http://marmalade-repo.org/packages/"))
(package-initialize)

Now, `M-x package-refresh-contents`. Finally, `M-x package-install RET elnode RET`.

Elnode should be installed, and your load-path automatically modified so that it is accessible. Yay for package managers!

peek-mode

Simply clone this repository, make sure peek-mode.el is in your load-path, and then:

(require 'peek-mode)

Usage

To use peek-mode, two things have to be in place. `peek-mode` must be enabled in the buffer(s) you want to peek at, and the elnode server has to be running.

To start the elnode server on port 8008 on your local machine:

(elnode-start 'peek-mode-dispatcher-handler :port 8008 :host "localhost")

To test, try enabling peek-mode in any buffer you have open (see note in `Limitations` below though). Just visit a buffer and type `M-x peek-mode`.

Then launch a web browser, and visit http://localhost:8008/peek/. There will be a listing of all the buffers that currently have peek-mode enabled. Click on one to view it, then go back to emacs and make some changes in that buffer. You should see the changes immediately reflected in the browser.

Limitations

Currently, this only seems to work if your buffer has a file extension (i.e., a ‘.’ in the buffer name). I’m looking into why. For example, peek-mode will not work on your \*scratch\* buffer, but it would work on a buffer called scratch.txt.

About

peek-mode is a minor mode that publishes live Emacs buffers through an elnode server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published