diff options
-rw-r--r-- | init.el | 17 | ||||
-rw-r--r-- | lisp/km-helm.el | 13 |
2 files changed, 19 insertions, 11 deletions
@@ -1357,7 +1357,12 @@ (after 'helm-buffers (bind-keys :map helm-buffer-map ("C-c b" . km/helm-display-buffer-below) - ("C-c C-o" . km/helm-display-buffer)))) + ("C-c C-o" . km/helm-display-buffer))) + :config + (after 'elisp-mode + (add-hook 'emacs-lisp-mode-hook #'km/helm-maybe-override-xref)) + (after 'python + (add-hook 'python-mode-hook #'km/helm-maybe-override-xref))) (use-package helm-mode :diminish helm-mode @@ -1931,16 +1936,6 @@ (setq outline-level #'km/elisp-outline-level)) (add-hook 'emacs-lisp-mode-hook #'km/elisp-set-outline-vars) - (defun km/elisp-use-xref-etags-inside-git () - (when (and (executable-find "git") - (equal (with-temp-buffer - (call-process "git" nil t nil - "rev-parse" "--is-inside-work-tree") - (buffer-string)) - "true\n")) - (xref-etags-mode 1))) - (add-hook 'emacs-lisp-mode-hook #'km/elisp-use-xref-etags-inside-git) - ;; Modified from usepackage's issue #80. (defun km/imenu-add-use-package () (when (string= (buffer-file-name (buffer-base-buffer)) diff --git a/lisp/km-helm.el b/lisp/km-helm.el index 5295e2a..eda178b 100644 --- a/lisp/km-helm.el +++ b/lisp/km-helm.el @@ -68,5 +68,18 @@ (display-buffer (find-file-noselect f) '(display-buffer-below-selected))))))) +(defvar km/helm-etags-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "M-.") #'helm-etags-select) + map)) + +(define-minor-mode km/helm-etags-mode + "Override `xref-find-definitions' with `helm-etags-select'." + :keymap km/helm-etags-mode-map) + +(defun km/helm-maybe-override-xref () + (when (helm-etags-find-tag-file-directory default-directory) + (km/helm-etags-mode 1))) + (provide 'km-helm) ;;; km-helm.el ends here |