2014-08-07 17:37:25 +00:00
|
|
|
Emacs mode for [lean theorem prover][lean]
|
|
|
|
|
|
|
|
[lean]: https://github.com/leanprover/lean
|
|
|
|
|
2015-01-30 08:05:35 +00:00
|
|
|
|
2014-08-07 15:03:49 +00:00
|
|
|
Requirement
|
2014-10-08 17:43:58 +00:00
|
|
|
===========
|
2014-08-07 15:03:49 +00:00
|
|
|
|
2014-09-09 22:11:24 +00:00
|
|
|
``lean-mode`` requires [Emacs 24][emacs24] and following
|
2014-08-14 00:02:49 +00:00
|
|
|
packages which can be installed via <kbd>M-x package-install</kbd>.
|
2014-08-07 17:37:25 +00:00
|
|
|
|
2014-08-25 23:51:23 +00:00
|
|
|
- [dash][dash]
|
|
|
|
- [dash-functional][dash]
|
2014-09-14 06:35:38 +00:00
|
|
|
- [f][f]
|
2014-09-09 22:11:24 +00:00
|
|
|
- [s][s]
|
|
|
|
|
|
|
|
[emacs24]: http://www.gnu.org/software/emacs
|
|
|
|
[dash]: https://github.com/magnars/dash.el
|
2014-09-14 06:35:38 +00:00
|
|
|
[f]: https://github.com/rejeep/f.el
|
2014-09-09 22:11:24 +00:00
|
|
|
[s]: https://github.com/magnars/s.el
|
|
|
|
|
|
|
|
The following packages are *optional* but we recommend to install them
|
|
|
|
to use full features of ``lean-mode``.
|
|
|
|
|
|
|
|
- [company][company]
|
2014-08-26 16:26:29 +00:00
|
|
|
- [flycheck][flycheck]
|
2014-09-09 22:11:24 +00:00
|
|
|
- [fill-column-indicator][fci]
|
|
|
|
- [lua-mode][lua-mode]
|
|
|
|
- [mmm-mode][mmm-mode]
|
2014-08-07 17:37:25 +00:00
|
|
|
|
2014-09-09 22:11:24 +00:00
|
|
|
[company]: http://company-mode.github.io/
|
2014-08-25 23:51:23 +00:00
|
|
|
[flycheck]: http://flycheck.readthedocs.org/en/latest
|
2014-08-07 15:03:49 +00:00
|
|
|
[fci]: https://github.com/alpaker/Fill-Column-Indicator
|
2014-09-09 22:11:24 +00:00
|
|
|
[lua-mode]: http://immerrr.github.io/lua-mode/
|
|
|
|
[mmm-mode]: https://github.com/purcell/mmm-mode
|
2014-08-07 15:03:49 +00:00
|
|
|
|
2015-01-30 08:05:35 +00:00
|
|
|
|
2014-08-29 22:22:06 +00:00
|
|
|
Install
|
2014-10-08 17:43:58 +00:00
|
|
|
=======
|
2014-08-29 22:22:06 +00:00
|
|
|
|
2014-11-09 05:21:43 +00:00
|
|
|
Put the following elisp code on your emacs setup
|
2014-10-31 16:58:15 +00:00
|
|
|
(e.g. ``.emacs.d/init.el`` [GNU Emacs], ``~/Library/Preferences/Aquamacs Emacs/Preferences.el`` [Aquamacs]) :
|
2014-08-07 17:37:25 +00:00
|
|
|
|
2014-08-07 15:03:49 +00:00
|
|
|
```elisp
|
2014-08-26 16:26:29 +00:00
|
|
|
(require 'package)
|
2015-01-30 21:10:21 +00:00
|
|
|
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t)
|
|
|
|
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
|
2014-08-26 16:26:29 +00:00
|
|
|
(package-initialize)
|
|
|
|
|
2014-09-09 22:11:24 +00:00
|
|
|
;; Install required/optional packages for lean-mode
|
2014-08-26 16:26:29 +00:00
|
|
|
(defvar lean-mode-required-packages
|
2014-11-09 05:21:43 +00:00
|
|
|
'(company dash dash-functional flycheck f
|
|
|
|
fill-column-indicator s lua-mode mmm-mode))
|
2014-10-08 17:41:52 +00:00
|
|
|
(let ((need-to-refresh t))
|
|
|
|
(dolist (p lean-mode-required-packages)
|
|
|
|
(when (not (package-installed-p p))
|
|
|
|
(when need-to-refresh
|
|
|
|
(package-refresh-contents)
|
2014-10-23 21:32:36 +00:00
|
|
|
(setq need-to-refresh nil))
|
2014-10-08 17:41:52 +00:00
|
|
|
(package-install p))))
|
2015-01-30 08:05:35 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Please choose your installation method from the following scenarios, and add the elisp code to your emacs setup:
|
2014-08-26 16:26:29 +00:00
|
|
|
|
2015-01-30 08:08:11 +00:00
|
|
|
Case 1: Build lean from source
|
|
|
|
-----------------------------
|
2015-01-30 08:05:35 +00:00
|
|
|
|
|
|
|
```elisp
|
2014-08-26 16:26:29 +00:00
|
|
|
;; Set up lean-root path
|
2014-10-31 16:58:15 +00:00
|
|
|
(setq lean-rootdir "~/projects/lean") ;; <=== YOU NEED TO MODIFY THIS
|
2014-08-07 15:03:49 +00:00
|
|
|
(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)
|
2015-01-30 08:05:35 +00:00
|
|
|
```
|
|
|
|
|
2015-01-30 08:08:11 +00:00
|
|
|
Case 2: Install lean via apt-get on Ubuntu
|
|
|
|
-------------------------------------------
|
2015-01-30 08:05:35 +00:00
|
|
|
|
|
|
|
```elisp
|
|
|
|
;; 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)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2015-01-30 08:08:11 +00:00
|
|
|
Case 3: Install lean via homebrew on OS X
|
|
|
|
-----------------------------------------
|
2015-01-30 08:05:35 +00:00
|
|
|
|
|
|
|
```elisp
|
|
|
|
;; Set up lean-root path
|
2015-01-30 21:10:21 +00:00
|
|
|
(setq lean-rootdir "/usr/local")
|
2015-01-30 08:05:35 +00:00
|
|
|
(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 not in the default location but a custom
|
|
|
|
location, please run `brew info lean` and it will tell you where
|
|
|
|
lean-mode files are located. With that information, update
|
|
|
|
`lean-emacs-path` variable accordingly.
|
2014-08-07 15:03:49 +00:00
|
|
|
|
2015-01-30 08:08:11 +00:00
|
|
|
Case 4: Install lean in Windows
|
|
|
|
-------------------------------
|
2014-08-07 15:03:49 +00:00
|
|
|
```
|
2015-01-30 08:05:35 +00:00
|
|
|
;; 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)
|
|
|
|
```
|
|
|
|
|
2014-08-15 00:10:58 +00:00
|
|
|
|
|
|
|
Key Bindings
|
2014-10-08 17:43:58 +00:00
|
|
|
============
|
2014-08-15 00:10:58 +00:00
|
|
|
|
|
|
|
|Key | Function |
|
|
|
|
|-------------------|-----------------------------------|
|
|
|
|
|<kbd>C-c C-x</kbd> | lean-std-exe |
|
|
|
|
|<kbd>C-c C-l</kbd> | lean-std-exe |
|
|
|
|
|<kbd>C-c C-t</kbd> | lean-eldoc-documentation-function |
|
|
|
|
|<kbd>C-c C-f</kbd> | lean-fill-placeholder |
|
2014-08-16 03:48:30 +00:00
|
|
|
|<kbd>M-.</kbd> | lean-find-tag |
|
2014-09-09 22:11:24 +00:00
|
|
|
|<kbd>TAB</kbd> | lean-tab-indent-or-complete |
|
2014-08-25 23:51:23 +00:00
|
|
|
|<kbd>C-c C-o</kbd> | lean-set-option |
|
|
|
|
|<kbd>C-c C-e</kbd> | lean-eval-cmd |
|
2014-09-11 19:29:00 +00:00
|
|
|
|
2014-10-08 17:43:58 +00:00
|
|
|
|
|
|
|
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`:
|
|
|
|
|
|
|
|
```elisp
|
|
|
|
(when (member "DejaVu Sans Mono" (font-family-list))
|
|
|
|
(set-face-attribute 'default nil :font "DejaVu Sans Mono-11"))
|
|
|
|
```
|
|
|
|
|
|
|
|
If you still experience rendering problem. Please consider trying
|
|
|
|
[emacs-unicode-fonts](https://github.com/rolandwalker/unicode-fonts).
|
|
|
|
|
2015-01-30 08:05:35 +00:00
|
|
|
|
2014-09-11 19:29:00 +00:00
|
|
|
Contribution
|
2014-10-08 17:43:58 +00:00
|
|
|
============
|
2014-09-11 19:29:00 +00:00
|
|
|
|
|
|
|
Contribution is 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](https://github.com/cask/cask) if you haven't already,
|
|
|
|
then:
|
|
|
|
|
|
|
|
$ cd /path/to/lean/src/emacs
|
|
|
|
$ cask
|
|
|
|
|
|
|
|
Run all tests with:
|
|
|
|
|
|
|
|
$ make
|