lean2/src/emacs
2015-02-13 19:41:41 -05:00
..
features test(emacs/features): add ecukes template 2014-09-11 12:33:49 -07:00
test test(emacs/lean-info-test): add test cases for goal visualization 2014-10-29 17:09:08 -07:00
.gitignore feat(emacs/Cask): add Cask file 2014-09-09 15:11:57 -07:00
Cask fix(emacs/Cask): add GNU package repository 2015-01-30 02:52:55 -05:00
CMakeLists.txt fix(CMakeLists.txt): rename EMACS_LIB to EMACS_LISP_DIR (default: share/eamcs/site-lisp/lean) 2014-10-07 12:30:39 -07:00
eri.el feat(emacs/eri.el): add eri.el (from agda mode) 2014-08-30 14:57:34 -07:00
lean-changes.el fix(emacs/lean-changes): visit file before process any changes 2014-10-03 10:11:21 -07:00
lean-cmd.el feat(emacs/lean-cmd): add SYNC command 2014-10-02 17:30:03 -07:00
lean-company.el feat(emacs): use lean-mode for .hlean 2014-12-05 14:33:22 -08:00
lean-debug.el feat(emacs/lean-debug): add lean-debug minor-mode 2014-09-15 16:50:35 -07:00
lean-flycheck.el fix(src/emacs/lean-flycheck): do not report 'sorry' warnings to flycheck, this is a temporary workaround since there is an overlap between flycheck and lean-mode type info 2014-11-26 09:35:22 -08:00
lean-info.el chore(emacs): remove unnecessary requires 2014-10-31 16:01:10 -07:00
lean-input.el feat(emacs/lean-input): add lean-input-export-translations 2014-10-29 14:33:05 -07:00
lean-mmm-lua.el feat(emacs): assume lua-mode and mmm-mode are available 2015-01-30 13:05:30 -08:00
lean-mode.el chore(emacs): move lean-choose-minor-mode-based-on-extension to lean-util.el 2015-02-13 19:41:41 -05:00
lean-option.el feat(emacs/lean-flycheck): detect and use flycheck error buffer width 2014-09-30 05:54:46 -07:00
lean-project.el chore(emacs): remove unnecessary requires 2014-10-31 16:01:10 -07:00
lean-require.el fix(emacs/lean-mode): remove whitespace-cleanup-mode dependency 2014-11-09 00:21:43 -05:00
lean-server.el feat(emacs/lean-server): add support for hlean/standard minor-mode 2015-02-13 19:41:41 -05:00
lean-settings.el feat(emacs): allow user to provide extra commands to lean-server 2015-01-15 16:54:55 -08:00
lean-syntax.el fix(src/emacs/lean-syntax.el): add syntax highlighting for [abbreviations] 2015-02-11 22:09:25 -05:00
lean-tags.el refactor: rename ltags => leantags 2015-01-18 13:44:41 +09:00
lean-type.el feat(emacs/lean-info): add goal visualization options 'lean-proofstate-display-style' 2014-10-29 17:08:55 -07:00
lean-util.el chore(emacs): move lean-choose-minor-mode-based-on-extension to lean-util.el 2015-02-13 19:41:41 -05:00
lean-variable.el feat(emacs/lean-server): add support for hlean/standard minor-mode 2015-02-13 19:41:41 -05:00
lean.pgm chore(CMakeLists.txt): move Lean logo to make sure we can test leanemacs without installing Lean 2015-01-31 17:38:49 -08:00
load-lean.el feat(CMakeLists.txt): add alternative image formats 2015-01-30 14:26:46 -08:00
Makefile fix(emacs/Makefile): add missing Makefile 2014-09-14 23:14:42 -07:00
README.md feat(src/emacs/README.md): tell user that packages will be installed automatically. Closes #423. 2015-02-03 13:50:59 -08:00

Emacs mode for lean theorem prover

Requirements

lean-mode requires Emacs 24 and the following packages, which can be installed via M-x package-install.

The following packages are optional, but we recommend installing them to use full features of lean-mode.

Both the optional and required packages will be installed for you automatically the first time you use lean-mode, if you follow the installation instructions below.

Installation

Put the following elisp code in your emacs setup (e.g. .emacs.d/init.el [GNU Emacs], ~/Library/Preferences/Aquamacs Emacs/Preferences.el [Aquamacs]) :

(require 'package)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

;; Install required/optional packages for lean-mode
(defvar lean-mode-required-packages
  '(company dash dash-functional flycheck f
            fill-column-indicator s lua-mode mmm-mode))
(let ((need-to-refresh t))
  (dolist (p lean-mode-required-packages)
    (when (not (package-installed-p p))
      (when need-to-refresh
        (package-refresh-contents)
        (setq need-to-refresh nil))
      (package-install p))))

Please choose your installation method from the following scenarios, and add the elisp code to your emacs setup:

Case 1: Build Lean from source

;; Set up lean-root path
(setq lean-rootdir "~/projects/lean")  ;; <=== YOU NEED TO MODIFY THIS
(setq-local lean-emacs-path
            (concat (file-name-as-directory lean-rootdir)
                    (file-name-as-directory "src")
                    "emacs"))
(add-to-list 'load-path (expand-file-name lean-emacs-path))
(require 'lean-mode)

Case 2: Install Lean via apt-get on Ubuntu

;; Set up lean-root path
(setq lean-rootdir "/usr")
(setq-local lean-emacs-path "/usr/share/emacs/site-lisp/lean")
(add-to-list 'load-path (expand-file-name lean-emacs-path))
(require 'lean-mode)

Case 3: Install Lean via homebrew on OS X

;; Set up lean-root path
(setq lean-rootdir "/usr/local")
(setq-local lean-emacs-path "/usr/local/share/emacs/site-lisp/lean")
(add-to-list 'load-path (expand-file-name lean-emacs-path))
(require 'lean-mode)

Note: if you install homebrew in a custom location that is not the default location, please run brew info lean, and it will tell you where the lean-mode files are located. With that information, update the lean-emacs-path variable accordingly.

Case 4: Install Lean in Windows

;; Set up lean-root path
(setq lean-rootdir "\\lean-0.2.0-windows")
(setq-local lean-emacs-path “\\lean-0.2.0-windows\\share\\emacs\\site-lisp\\lean")
(add-to-list 'load-path (expand-file-name lean-emacs-path))
(require 'lean-mode)

Key Bindings

Key Function
C-c C-x lean-std-exe
C-c C-l lean-std-exe
C-c C-t lean-eldoc-documentation-function
C-c C-f lean-fill-placeholder
M-. lean-find-tag
TAB lean-tab-indent-or-complete
C-c C-o lean-set-option
C-c C-e lean-eval-cmd

Known Issues and Possible Solutions

Unicode

If you experience a problem reading unicode characters on emacs, first consider using a unicode-friendly font such as DejaVu Sans Mono:

(when (member "DejaVu Sans Mono" (font-family-list))
  (set-face-attribute 'default nil :font "DejaVu Sans Mono-11"))

If you still experience a rendering problem, consider trying emacs-unicode-fonts.

Contributions

Contributions are welcome!

If your contribution is a bug fix, create your topic branch from master. If it is a new feature, check if there exists a WIP(work-in-progress) branch (vMAJOR.MINOR-wip). If it does, use that branch, otherwise use master.

Install Cask if you haven't already, then:

$ cd /path/to/lean/src/emacs
$ cask

Run all tests with:

$ make