feat(emacs/lean-tags): use full-name to look up tags
This commit is contained in:
parent
fa8e610d4f
commit
1f0bfb67b0
3 changed files with 17 additions and 10 deletions
|
@ -522,4 +522,11 @@ Take out \"BEGININFO\" and \"ENDINFO\" and Use \"ACK\" as a delim."
|
||||||
(setq column (1- column)))
|
(setq column (1- column)))
|
||||||
(lean-get-info-record file-name line-number 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)
|
(provide 'lean-info)
|
||||||
|
|
|
@ -188,6 +188,7 @@ enabled and disabled respectively.")
|
||||||
(set (make-local-variable 'comment-padding) 1)
|
(set (make-local-variable 'comment-padding) 1)
|
||||||
(set (make-local-variable 'comment-use-syntax) t)
|
(set (make-local-variable 'comment-use-syntax) t)
|
||||||
(set (make-local-variable 'font-lock-defaults) lean-font-lock-defaults)
|
(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 (make-local-variable 'indent-tabs-mode) nil)
|
||||||
(set-input-method "Lean")
|
(set-input-method "Lean")
|
||||||
(set (make-local-variable 'lisp-indent-function)
|
(set (make-local-variable 'lisp-indent-function)
|
||||||
|
|
|
@ -4,25 +4,24 @@
|
||||||
;; Author: Soonho Kong
|
;; 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")))
|
(let ((ltags-file-name (lean-get-executable "lmake")))
|
||||||
(call-process ltags-file-name nil nil nil "TAGS" "--jobs" "--keep-going" "--permissive")))
|
(call-process ltags-file-name nil nil nil "TAGS" "--jobs" "--keep-going" "--permissive")))
|
||||||
|
|
||||||
(defun lean-find-tag ()
|
(defun lean-find-tag ()
|
||||||
"lean-find-tag"
|
"lean-find-tag"
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((bounds (bounds-of-thing-at-point 'symbol))
|
(let ((full-name (lean-get-full-name-at-point)))
|
||||||
symbol-name)
|
(when full-name
|
||||||
(when bounds
|
(find-tag full-name))))
|
||||||
(setq symbol-name (buffer-substring-no-properties (car bounds) (cdr bounds)))
|
|
||||||
(lean-run-lmake-tag)
|
|
||||||
(find-tag symbol-name))))
|
|
||||||
|
|
||||||
(defun lean-complete-tag ()
|
(defun lean-complete-tag ()
|
||||||
"complete with tag"
|
"complete with tag"
|
||||||
(interactive)
|
(interactive)
|
||||||
(lean-run-lmake-tag)
|
(lean-generate-tags)
|
||||||
(complete-tag))
|
(complete-tag))
|
||||||
(setq tags-revert-without-query t)
|
|
||||||
|
|
||||||
(provide 'lean-tags)
|
(provide 'lean-tags)
|
||||||
|
|
Loading…
Reference in a new issue