lean4-htt/lean4-mode
2020-11-07 17:32:13 -08:00
..
.gitignore
lean4-debug.el chore(lean4-mode): rename files 2018-09-08 18:37:58 -07:00
lean4-dev.el chore: factor out and unify common test behavior; retrieve lean from PATH 2020-05-14 14:38:52 +02:00
lean4-eri.el chore(lean4-mode): rename files 2018-09-08 18:37:58 -07:00
lean4-flycheck.el fix(lean4-mode/lean4-flycheck): update lean4-bootstrapped-checker 2019-03-24 20:55:20 +01:00
lean4-hole.el chore: remove references to deleted lean4-server.el 2019-12-09 10:16:22 +01:00
lean4-info.el chore(lean4-mode): rename files 2018-09-08 18:37:58 -07:00
lean4-input.el chore: improve · input method 2019-12-21 15:55:14 -08:00
lean4-leanpkg.el chore(lean4-mode): rename files 2018-09-08 18:37:58 -07:00
lean4-mode.el fix(lean4-mode/lean4-util): (lean4-setup-rootdir) returns the wrong path 2018-09-08 18:37:58 -07:00
lean4-right-click.el chore(lean4-mode): rename files 2018-09-08 18:37:58 -07:00
lean4-settings.el chore: move bin/ and .oleans into build directory 2020-05-14 14:47:54 +02:00
lean4-syntax.el feat: only allow variables declared with mut to be reassigned 2020-11-07 17:32:13 -08:00
lean4-type.el chore: remove references to deleted lean4-server.el 2019-12-09 10:16:22 +01:00
lean4-util.el fix(lean4-mode/lean4-util): (lean4-setup-rootdir) returns the wrong path 2018-09-08 18:37:58 -07:00
LICENSE
README.md doc: further elaborate on elan and Emacs setup 2020-05-18 11:00:29 +02:00

Installation

To use lean4-mode in Emacs, add the following to your init.el:

;; You need to modify the following line
(setq load-path (cons "/path/to/lean4/lean4-mode" load-path))

(setq lean4-mode-required-packages '(dash dash-functional f flycheck s))

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
(let ((need-to-refresh t))
  (dolist (p lean4-mode-required-packages)
    (when (not (package-installed-p p))
      (when need-to-refresh
        (package-refresh-contents)
        (setq need-to-refresh nil))
      (package-install p))))

(require 'lean4-mode)

Trying It Out

If things are working correctly, you should see the word Lean 4 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
C-c C-k shows the keystroke needed to input the symbol under the cursor
C-c C-x execute lean in stand-alone mode (lean-std-exe)
C-c C-n toggle showing next error in dedicated buffer (lean-toggle-next-error)
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.