feat(emacs): add lean-complete-tag (tab)

This commit is contained in:
Soonho Kong 2014-08-15 21:23:36 -07:00
parent 483bae0b97
commit 030eec1d06
3 changed files with 16 additions and 6 deletions

View file

@ -62,3 +62,4 @@ Key Bindings
|<kbd>C-c C-t</kbd> | lean-eldoc-documentation-function |
|<kbd>C-c C-f</kbd> | lean-fill-placeholder |
|<kbd>M-.</kbd> | lean-find-tag |
|<kbd>TAB</kbd> | lean-complete-tag |

View file

@ -50,7 +50,8 @@
(local-set-key "\C-c\C-k" 'lean-hott-exe)
(local-set-key "\C-c\C-t" 'lean-eldoc-documentation-function)
(local-set-key "\C-c\C-f" 'lean-fill-placeholder)
(local-set-key "\M-." 'lean-find-tag))
(local-set-key "\M-." 'lean-find-tag)
(local-set-key [tab] 'lean-complete-tag))
(define-abbrev-table 'lean-mode-abbrev-table '(
("var" "variable")

View file

@ -4,17 +4,25 @@
;; Author: Soonho Kong
;;
(defun lean-run-lmake-tag ()
(let ((ltags-file-name (lean-get-executable "lmake")))
(call-process ltags-file-name nil nil nil "TAGS" "--jobs" "--keep-going" "--permissive")))
(defun lean-find-tag ()
"lean-find-tag"
(interactive)
(let ((ltags-file-name (lean-get-executable "lmake"))
(bounds (bounds-of-thing-at-point 'symbol))
(let ((bounds (bounds-of-thing-at-point 'symbol))
symbol-name)
(when bounds
(setq symbol-name (buffer-substring-no-properties (car bounds) (cdr bounds)))
;; run ltags
(message ltags-file-name)
(call-process ltags-file-name nil nil nil "TAGS" "--jobs" "--keep-going" "--permissive")
(lean-run-lmake-tag)
(find-tag symbol-name))))
(defun lean-complete-tag ()
"complete with tag"
(interactive)
(lean-run-lmake-tag)
(complete-tag))
(setq tags-revert-without-query t)
(provide 'lean-tags)