feat(emacs/lean-tags): use full-name to look up tags

This commit is contained in:
Soonho Kong 2014-08-26 15:07:08 -07:00
parent fa8e610d4f
commit 1f0bfb67b0
3 changed files with 17 additions and 10 deletions

View file

@ -522,4 +522,11 @@ Take out \"BEGININFO\" and \"ENDINFO\" and Use \"ACK\" as a delim."
(setq column (1- column)))
(lean-get-info-record file-name line-number column)))
(defun lean-get-full-name-at-point ()
"Return the full-name at point (if any)"
(let* ((info-record (lean-get-info-record-at-point))
(id (cl-first (lean-info-record-identifier info-record))))
(when id
(lean-info-identifier-body-str id))))
(provide 'lean-info)

View file

@ -188,6 +188,7 @@ enabled and disabled respectively.")
(set (make-local-variable 'comment-padding) 1)
(set (make-local-variable 'comment-use-syntax) t)
(set (make-local-variable 'font-lock-defaults) lean-font-lock-defaults)
(set (make-local-variable 'tags-revert-without-query) t)
(set (make-local-variable 'indent-tabs-mode) nil)
(set-input-method "Lean")
(set (make-local-variable 'lisp-indent-function)

View file

@ -4,25 +4,24 @@
;; Author: Soonho Kong
;;
(defun lean-run-lmake-tag ()
(require 'dash)
(defun lean-generate-tags ()
"Run lmake TAGS."
(interactive)
(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 ((bounds (bounds-of-thing-at-point 'symbol))
symbol-name)
(when bounds
(setq symbol-name (buffer-substring-no-properties (car bounds) (cdr bounds)))
(lean-run-lmake-tag)
(find-tag symbol-name))))
(let ((full-name (lean-get-full-name-at-point)))
(when full-name
(find-tag full-name))))
(defun lean-complete-tag ()
"complete with tag"
(interactive)
(lean-run-lmake-tag)
(lean-generate-tags)
(complete-tag))
(setq tags-revert-without-query t)
(provide 'lean-tags)