Git Product home page Git Product logo

stan-mode's Introduction

Emacs support for Stan

Build Status License GPL 3

Example Stan file with font-lock

This repository contains several Emacs packages and tools to make editing Stan files easier.

  • stan-mode is a major mode for editing Stan files. Its current features include:

    • syntax highlighting
    • indentation
    • imenu support for blocks, variables, and user-defined functions.
  • stan-snippets: Adds Stan support for yasnippet. Yasnippet is a template system for Emacs. Snippets are defined for blocks, control structures, and all the built-in functions and distributions.

  • indent-stan-files: A shell script that uses stan-mode to indent a file. See its README.

  • stan-lang: The file stan_lang.json contains all keywords, functions (with their signatures and documentation) in the Stan modeling language. This is used to generate the keyword lists and snippets used by the modes. It could also be useful for developers designing tools for Stan, e.g. other editor modes.

Installing

package.el

The recommended way to install these packages is using the built-in package manager: package.el. These packages are available from MELPA. If you're not already using MELPA, follow its installation instructions.

You can then install the packages using the following commands:

M-x package-install [RET] stan-mode [RET]

M-x package-install [RET] stan-snippets [RET]

If the installation does not work, try refreshing the package list:

M-x package-refresh-contents [RET]

Or add the following to you init.el:

(package-refresh-contents)
(mapc
 (lambda (p)
   (unless (package-installed-p p)
     (package-install p)))
 '(stan-mode stan-snippets))

Cask

Another way to manage dependencies is to to use Cask. See its docs for an argument as to why to use Cask to manage your configuration.

Simply add the following to your Cask file:

(source melpa)
(depends-on "stan-mode")
(depends-on "stan-snippets")

and from the command line in the same directory as the Cask file use cask to install the packages,

$ cask install

See the Cask documentation for more information.

stan-mode

MELPA MELPA Stable

To use, add the following to your init.el file:

(require 'stan-mode)

stan-snippets

MELPA MELPA Stable

To use, add the following to your init.el file:

(require 'stan-snippets)

To use yasnippet globally:

(yas-global-mode 1)

Else, to use yasnippet only for stan-mode:

(add-hook 'stan-mode-hook '(lambda () (yas-minor-mode)))

See the documenation for yasnippet for more information on using yasnippet-mode.

Auto Complete mode

stan-mode does not directly support autocomplete. However a dictionary compatible with autocomplete-mode is available for stan-mode. To use autocomplete with stan, download the stan-mode, and follow the autocomplete directions for using a major-mode dictionary.

Updating packages

To update stan-mode when a version of the Stan language comes out:

  1. Replace stan-lang/stan-functions-*.txt with the newest version from CmdStan.
  2. Build the emacs files
$ make
  1. Save and commit the changes
  2. Bump the version number of the emacs packages. For example, to bump to 8.0.0. This is different than the Stan language version.
$ ./update-versions.sh 8.0.0
  1. Tag the commit and push the tag
$ git tag v8.0.0
$ git push --tags

License

All packages are free software under the GPL v3.

stan-mode's People

Contributors

jrnold avatar syclik avatar kyleam avatar

Stargazers

Kazuki Yoshida avatar

Watchers

James Cloos avatar Lionel Henry 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.