This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/scheme/packages.el
Eivind Fonn 928983da47 Refactor jump to definition
This commit defines:

- spacemacs-default-jump-handlers: a list of functions that can jump to
  definition in ALL modes.

- spacemacs-jump-handlers-MODE: a list of functions that can jump to
  definition in MODE.

- spacemacs-jump-handlers: a buffer-local list of functions that can
  jump to definition. This is made up of the values of the two previous
  variables whenever a given major mode is activated.

- spacemacs/jump-to-definition: a function that tries each function in
  spacemacs-jump-handlers in order, and stops when one of them takes us
  somewhere new.

- spacemacs|define-jump-handlers: a macro that
  * defines spacemacs-jump-handlers-MODE, possibly filled with initial
    functions
  * defines a function that is added to the hook of the given MODE
  * binds “SPC m g g” of that MODE to spacemacs/jump-to-definition

This is an attempt to harmonize all the different approaches to jumping.
Specifically,

- Existing intelligent jump packages that work for only a single mode
  should go to the beginning of spacemacs-jump-handlers-MODE. E.g.
  anaconda for python, ensime for scala, etc.

- Packages like gtags that work for several modes (but potentially not
  all) and which is dumber than the intelligent jumpers should go the
  the END of spacemacs-jump-handlers-MODE.

- Packages like dumb-jump that work for all modes should go to
  spacemacs-default-jump-handlers.

In all cases the order of the jump handlers in each list should be from
most to least intelligent.

Fixes #6619
2016-08-22 15:08:25 +02:00

84 lines
2.6 KiB
EmacsLisp

;;; packages.el --- Scheme Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq scheme-packages
'(
company
geiser
ggtags
helm-gtags
))
(defun scheme/post-init-company ()
;; Geiser provides completion as long as company mode is loaded.
(spacemacs|add-company-hook scheme-mode))
(defun scheme/init-geiser ()
(use-package geiser
:commands run-geiser
:init
(progn
(spacemacs|define-jump-handlers scheme-mode geiser-edit-symbol-at-point)
(spacemacs/register-repl 'geiser 'geiser-mode-switch-to-repl "geiser"))
:config
(progn
(spacemacs/declare-prefix-for-mode 'scheme-mode "mc" "compiling")
(spacemacs/declare-prefix-for-mode 'scheme-mode "mg" "navigation")
(spacemacs/declare-prefix-for-mode 'scheme-mode "mh" "documentation")
(spacemacs/declare-prefix-for-mode 'scheme-mode "mi" "insertion")
(spacemacs/declare-prefix-for-mode 'scheme-mode "mm" "macroexpansion")
(spacemacs/declare-prefix-for-mode 'scheme-mode "ms" "repl")
(spacemacs/set-leader-keys-for-major-mode 'scheme-mode
"'" 'geiser-mode-switch-to-repl
"," 'lisp-state-toggle-lisp-state
"cc" 'geiser-compile-current-buffer
"cp" 'geiser-add-to-load-path
"eb" 'geiser-eval-buffer
"ee" 'geiser-eval-last-sexp
"ef" 'geiser-eval-definition
"el" 'lisp-state-eval-sexp-end-of-line
"er" 'geiser-eval-region
"gb" 'geiser-pop-symbol-stack
"gm" 'geiser-edit-module
"gn" 'next-error
"gN" 'previous-error
"hh" 'geiser-doc-symbol-at-point
"hd" 'geiser-doc-look-up-manual
"hm" 'geiser-doc-module
"h<" 'geiser-xref-callers
"h>" 'geiser-xref-callees
"il" 'geiser-insert-lambda
"me" 'geiser-expand-last-sexp
"mf" 'geiser-expand-definition
"mx" 'geiser-expand-region
"si" 'geiser-mode-switch-to-repl
"sb" 'geiser-eval-buffer
"sB" 'geiser-eval-buffer-and-go
"sf" 'geiser-eval-definition
"sF" 'geiser-eval-definition-and-go
"se" 'geiser-eval-last-sexp
"sr" 'geiser-eval-region
"sR" 'geiser-eval-region-and-go
"ss" 'geiser-set-scheme))))
(defun scheme/post-init-ggtags ()
(add-hook 'scheme-mode-hook #'spacemacs/ggtags-mode-enable))
(defun scheme/post-init-helm-gtags ()
(spacemacs/helm-gtags-define-keys-for-mode 'scheme-mode))