Giter Club home page Giter Club logo

polymode's Introduction

Overview

Polymode is an emacs package that offers generic support for multiple major modes inside a single emacs buffer. It is lightweight, object oriented and highly extensible. Creating new polymodes typically takes a few lines of code.

Polymode also provides extensible facilities for external literate programming tools for exporting, weaving and tangling.

Installation

From MELPA

M-x package-install polymode.

Manually

git clone https://github.com/vitoshka/polymode.git

Add "polymode" directory and "polymode/modes" to your emacs path:

(setq load-path
      (append '("path/to/polymode/"  "path/to/polymode/modes")
              load-path))

Require any polymode bundles that you are interested in. For example:

(require 'poly-R)
(require 'poly-markdown)

Activation of Polymodes

Polymodes are functions, just like ordinary emacs modes. The can be used in place of emacs major or minor modes alike. There are two main ways to automatically activate emacs (poly)modes:

  1. By registering a file extension by adding modes to auto-mode-alist:

    ;;; MARKDOWN
    (add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
    
    ;;; R modes
    (add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
    (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
    (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

    See polymode-configuration.el for more examples.

  2. By setting local mode variable in you file:

// -*- mode: poly-C++R -*-
or
## -*- mode: poly-brew+R; -*-

Basic Usage

All polymode keys start with the prefix defined by polymode-prefix-key, default is M-n. The polymode-mode-map is the parent of all polymodes' maps:

  • BACKENDS

    e polymode-export

    E polymode-set-exporter

    w polymode-weave

    W polymode-set-weaver

    t polymode-tangle ;; not implemented yet

    T polymode-set-tangler ;; not implemented yet

    $ polymode-show-process-buffer

  • NAVIGATION

    C-n polymode-next-chunk

    C-p polymode-previous-chunk

    C-M-n polymode-next-chunk-same-type

    C-M-p polymode-previous-chunk-same-type

  • MANIPULATION

    M-k polymode-kill-chunk

    M-m polymode-mark-or-extend-chunk

    C-t polymode-toggle-chunk-narrowing

    M-i polymode-insert-new-chunk

Warnings

  • Tested with Emacs 24.3.1 and 24.4.5.

Some things still don't work as expected. For example:

  • To kill a polymode buffer you will have position the cursor in the host mode buffer.
  • Customization interface is not working as expected (an eieio bug) and is not even tested.
  • Indentation and font-lock is not always right and requires some more tweaking. This is especially true for complex modes like c-mode.

Developing with Polymode

For the relevant terminology and development info see these docs.

Screenshots

markdown+R

markdown+R+YAML

org mode

Ess-help buffer

C++R

polymode's People

Contributors

daroczig avatar nrnrnr avatar vspinu avatar zenspider avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.