improve navigation of tags

This commit is contained in:
Jean-Philippe Bernardy 2016-05-02 15:06:30 +02:00
parent 57913e5db4
commit 47e04abf60
3 changed files with 10 additions and 4 deletions

View file

@ -33,7 +33,7 @@
(define-key boon-moves-map "k" 'boon-switch-mark) ; bacK to marK
(define-key boon-moves-map "K" 'pop-global-mark)
(define-key boon-moves-map "K" 'pop-tag-mark)
(define-key boon-moves-map "j" 'boon-find-definition)
(define-key boon-moves-map "J" 'find-function)

View file

@ -64,6 +64,7 @@
(define-key boon-x-map "vv" 'magit-status)
(define-key boon-x-map "g" 'magit-status)
(define-key boon-x-map "x" 'helm-M-x)
(define-key boon-x-map ":" 'eval-expression)
(eval-after-load 'flycheck
'(define-key boon-x-map "y" flycheck-command-map)

View file

@ -31,7 +31,11 @@ Search preferentially for a function, then a variable."
"Find the symbol at point in the current tags table."
(interactive)
(let ((symb (thing-at-point 'symbol)))
(cond (symb (find-tag symb))
(cond (symb
(find-tag symb (when (and current-prefix-arg (bound-and-true-p last-tag))
(if (< (prefix-numeric-value current-prefix-arg) 0)
'-
t))))
(t (call-interactively 'find-tag)))))
(defcustom boon-find-definition-dispatch '()
@ -39,7 +43,7 @@ Search preferentially for a function, then a variable."
:group 'boon
:type '(alist :key-type symbol :value-type function))
(setq boon-find-definition-dispatch
'((c-mode . (lambda () (interactive) (boon-find-tag-at-point)))
'((c-mode . boon-find-tag-at-point)
(emacs-lisp-mode . boon-find-elisp-thing-at-point)
(lisp-interaction-mode . boon-find-elisp-thing-at-point)
(haskell-mode . haskell-mode-jump-to-def-or-tag)))
@ -48,9 +52,10 @@ Search preferentially for a function, then a variable."
"Find a definition, in a way which is adapted to the 'major-mode'.
If possible, prompt the symbol at point."
(interactive)
;; TODO (ring-insert find-tag-marker-ring (point-marker))
(let ((mode-fap (assoc major-mode boon-find-definition-dispatch)))
(if mode-fap (call-interactively (cdr mode-fap))
(error "Finding definitions is not defined for %s. Update the variable 'boon-find-definition-dispatch'."
(error "Finding definitions is not dering-insert fined for %s. Update the variable 'boon-find-definition-dispatch'."
major-mode))))
(defcustom boon-hints-enabled 't "Display hints." :group 'boon)