lean4-htt/src/emacs
2016-12-18 23:48:15 -08:00
..
features
test chore(emacs): remove unused code 2016-10-21 15:42:29 -07:00
.gitignore chore(emacs): fix cask warnings 2016-10-21 15:42:29 -07:00
Cask refactor(src/emacs/*): remove dependence on fill-column-indicator 2016-12-08 14:53:09 -08:00
CMakeLists.txt fix(CMakeLists.txt): quote CMake variables 2015-03-28 22:38:11 -04:00
eri.el
lean-company.el feat(shell,emacs): new lean server protocol 2016-12-06 17:14:29 -08:00
lean-debug.el feat(shell,emacs): new lean server protocol 2016-12-06 17:14:29 -08:00
lean-flycheck.el feat(shell/server,emacs): show currently executing task if even from another file 2016-12-12 12:40:40 -08:00
lean-info.el feat(shell,emacs): new lean server protocol 2016-12-06 17:14:29 -08:00
lean-input.el chore(emacs/lean-input): add shortcuts for alpha, beta and gamma 2016-11-17 11:46:26 -08:00
lean-mode.el fix(emacs/lean-server): try to reduce flickering of error list 2016-12-18 13:44:06 -08:00
lean-project.el chore(*): remove legacy flycheck support 2016-10-13 18:49:10 -07:00
lean-require.el refactor(src/emacs/*): remove dependence on fill-column-indicator 2016-12-08 14:53:09 -08:00
lean-server.el fix(emacs): make sure lean-server-sync is executed in the correct buffer 2016-12-18 23:48:15 -08:00
lean-settings.el refactor(src/emacs/*): remove dependence on fill-column-indicator 2016-12-08 14:53:09 -08:00
lean-syntax.el feat(kernel/declaration,*): all theorems are delayed, and are revealed on delta-reduction 2016-11-29 11:12:43 -08:00
lean-type.el feat(emacs): implement show-goal-at-pos using faster info manager 2016-11-10 15:17:15 -08:00
lean-util.el feat(emacs, frontends/lean/info_manager): implement 'go to definition' 2016-11-08 08:37:41 -08: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 refactor(src/emacs/*): remove dependence on fill-column-indicator 2016-12-08 14:53:09 -08:00
Makefile fix(emacs/Makefile): add missing Makefile 2014-09-14 23:14:42 -07:00
README.md refactor(src/emacs/*): remove dependence on fill-column-indicator 2016-12-08 14:53:09 -08:00

This is the emacs mode for the Lean theorem prover.

Quick-start

If you have built lean from source, all that is necessary is to call the leanemacs_build script which automatically installs all the dependencies and opens up emacs with lean-mode loaded:

~/projects/lean/bin/leanemacs_build

If you have installed lean from a binary package, you can run leanemacs.

Trying It Out

If things are working correctly, you should see the word Lean in the Emacs mode line when you open a file with extension .lean. If you type

check id

the word check will be underlined, and hovering over it will show you the type of id. The mode line will show FlyC:0/1, indicating that there are no errors and one piece of information displayed.

Key Bindings and Commands

Key Function
M-. jump to definition in source file (lean-find-definition)
TAB tab complete identifier, option, filename, etc. (lean-tab-indent-or-complete)
C-c C-k shows the keystroke needed to input the symbol under the cursor
C-c C-g show goal in tactic proof (lean-show-goal-at-pos)
C-c C-x execute lean in stand-alone mode (lean-std-exe)
C-c C-n toggle next-error-mode: shows next error in dedicated lean-info buffer
C-c C-r restart the lean server
C-c ! n flycheck: go to next error
C-c ! p flycheck: go to previous error
C-c ! l flycheck: show list of errors

In the default configuration, the Flycheck annotation FlyC:n/n indicates the number of errors / responses from Lean; clicking on FlyC opens the Flycheck menu.

Requirements

lean-mode requires Emacs 24 or later and the following packages, which can be installed via M-x package-install: dash, dash-functional, f, s, company, flycheck, and fill-column-indicator.

Installation

You can also include lean-mode permanently in your emacs init file. In this case, just put the following code in your Emacs init file:

;; You need to modify the following two lines:
(setq lean-rootdir "~/projects/lean")
(setq lean-emacs-path "~/projects/lean/src/emacs")

(setq lean-required-packages '(company dash dash-functional f
                               flycheck let-alist s seq))

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
(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))))

(setq load-path (cons lean-emacs-path load-path))

(require 'lean-mode)

If you already have the dependencies installed, the following three lines suffice:

;; You need to modify the following two lines:
(setq lean-rootdir "~/projects/lean")
(setq load-path (cons "~/projects/lean/src/emacs" load-path))
(require 'lean-mode)

Known Issues and Possible Solutions

Unicode

If you experience a problem rendering unicode symbols on emacs, please download the following fonts and install them on your machine:

Then, have the following lines in your emacs setup to use DejaVu Sans Mono font:

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

You may also need to install emacs-unicode-fonts package.

  • Run M-x package-refresh-contents, M-x package-install, and type unicode-fonts.

  • Add the following lines in your emacs setup:

(require 'unicode-fonts) (unicode-fonts-setup)


"Variable binding depth exceeds max-specpdl-size" Error
---------------------------------------------------------

See [Issue 906](https://github.com/leanprover/lean/issues/906) for details.
[Moritz Kiefer](https://github.com/cocreature) reported that `proofgeneral`
comes with an old version of `mmm-mode` (0.4.8, released in 2004) on ArchLinux
and it caused this problem. Either removing `proofgeneral` or upgrading
`mmm-mode` to the latest version (0.5.1 as of 2015 Dec) resolves this issue.

Contributions
=============

Contributions are welcome!

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