feat(emacs): add short-cuts \C-c\C-l and \C-c\C-x to execute Lean files in Emacs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
84e211b81b
commit
7a1ee92507
1 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,18 @@
|
||||||
(require 'generic-x)
|
(require 'generic-x)
|
||||||
(require 'lean-input)
|
(require 'lean-input)
|
||||||
|
(require 'compile)
|
||||||
|
|
||||||
|
(defvar lean-exe "lean"
|
||||||
|
"Path for the Lean executable")
|
||||||
|
|
||||||
|
(defun lean-execute ()
|
||||||
|
"Execute Lean in the current buffer"
|
||||||
|
(interactive)
|
||||||
|
(compile (format "%s %s" lean-exe (buffer-file-name))))
|
||||||
|
|
||||||
|
(defun lean-set-keys ()
|
||||||
|
(local-set-key "\C-c\C-x" 'lean-execute)
|
||||||
|
(local-set-key "\C-c\C-l" 'lean-execute))
|
||||||
|
|
||||||
(define-generic-mode
|
(define-generic-mode
|
||||||
'lean-mode ;; name of the mode to create
|
'lean-mode ;; name of the mode to create
|
||||||
|
@ -14,6 +27,7 @@
|
||||||
(set-input-method "Lean")
|
(set-input-method "Lean")
|
||||||
(set (make-local-variable 'lisp-indent-function)
|
(set (make-local-variable 'lisp-indent-function)
|
||||||
'common-lisp-indent-function)
|
'common-lisp-indent-function)
|
||||||
|
(lean-set-keys)
|
||||||
))
|
))
|
||||||
"A mode for Lean files" ;; doc string for this mode
|
"A mode for Lean files" ;; doc string for this mode
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue