From 6317a989117284458380d1dfcb8969f4d00dc94f Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Fri, 10 Jul 2015 21:32:10 -0400 Subject: [PATCH] Initial support for Geiser. Resolves Issue #1002. --- contrib/!lang/common-lisp/README.org | 34 ++++++++--- contrib/!lang/common-lisp/packages.el | 60 ++++++++++++------- contrib/!lang/scheme/README.org | 84 +++++++++++++++++++++++++++ contrib/!lang/scheme/packages.el | 56 ++++++++++++++++++ 4 files changed, 205 insertions(+), 29 deletions(-) create mode 100644 contrib/!lang/scheme/README.org create mode 100644 contrib/!lang/scheme/packages.el diff --git a/contrib/!lang/common-lisp/README.org b/contrib/!lang/common-lisp/README.org index ac6926bf7600..80ba52fa0ecf 100644 --- a/contrib/!lang/common-lisp/README.org +++ b/contrib/!lang/common-lisp/README.org @@ -11,6 +11,7 @@ - [[#repl][REPL]] - [[#compile][Compile]] - [[#navigation][Navigation]] + - [[#macroexpansion][Macroexpansion]] * Description @@ -41,20 +42,29 @@ of Common Lisp, you can specify it in your =~/.spacemacs= ** Help -| Key Binding | Description | -|-------------+--------------------| -| ~SPC m h a~ | SLIME apropos | -| ~SPC m h d~ | Disassemble symbol | -| ~SPC m h h~ | Describe function | -| ~SPC m h H~ | Hyperspec lookup | +| Key Binding | Description | +|-------------+---------------------------------------------------------| +| ~SPC m h a~ | SLIME apropos | +| ~SPC m h d~ | Disassemble symbol at point | +| ~SPC m h h~ | Describe symbol at point | +| ~SPC m h H~ | Hyperspec lookup symbol at point | +| ~SPC m h p~ | Browse apropos results for a package's exported symbols | +| ~SPC m h t~ | Toggle tracing of the function at point | +| ~SPC m h T~ | Untrace all functions | +| ~SPC m h <~ | Show all known callers | +| ~SPC m h >~ | Show all known callees | +| ~SPC m h m~ | Show all usages of a macro | +| ~SPC m h r~ | Show references to global variable | +| ~SPC m h s~ | Show all methods specialized on a class | ** Evaluation | Key Binding | Description | |-------------+---------------------------------| | ~SPC m e b~ | Evaluate buffer | -| ~SPC m e f~ | Evaluate top level s-expression | | ~SPC m e e~ | Evaluate last expression | +| ~SPC m e f~ | Evaluate top level s-expression | +| ~SPC m e F~ | Undefine the function at point | | ~SPC m e r~ | Evaluate region | ** REPL @@ -71,13 +81,23 @@ of Common Lisp, you can specify it in your =~/.spacemacs= |-------------+--------------------------| | ~SPC m c c~ | Compile file | | ~SPC m c C~ | Compile file and load it | +| ~SPC m c l~ | Load file | +| ~SPC m c n~ | Remove compilation notes | | ~SPC m c f~ | Compile function | | ~SPC m c r~ | Compile region | ** Navigation + | Key Binding | Description | |---------------------------+--------------------| | ~SPC m g g~ | Inspect definition | +| ~SPC m g b~ | Go back | | ~SPC m g n~ | Next note | | ~SPC m g N~ or ~SPC m g p | Previous note | +** Macroexpansion + +| Key Binding | Description | +|-------------+-----------------------------------------------| +| ~SPC m m a~ | Macroexpand the expression at point completly | +| ~SPC m m o~ | Macroexpand the expression at point once | diff --git a/contrib/!lang/common-lisp/packages.el b/contrib/!lang/common-lisp/packages.el index 306c93269e75..d3b944ba9db8 100644 --- a/contrib/!lang/common-lisp/packages.el +++ b/contrib/!lang/common-lisp/packages.el @@ -38,30 +38,46 @@ (slime-setup) (dolist (m `(,slime-mode-map ,slime-repl-mode-map)) (define-key m [(tab)] 'slime-fuzzy-complete-symbol)) - (dolist (m '(lisp-mode)) - (evil-leader/set-key-for-mode m - "mcc" 'slime-compile-file - "mcC" 'slime-compile-and-load-file - "mcf" 'slime-compile-defun - "mcr" 'slime-compile-region + ;; TODO: Add bindings for the SLIME debugger? + (evil-leader/set-key-for-mode 'lisp-mode + "mcc" 'slime-compile-file + "mcC" 'slime-compile-and-load-file + "mcl" 'slime-load-file + "mcf" 'slime-compile-defun + "mcr" 'slime-compile-region + "mcn" 'slime-remove-notes - "meb" 'slime-eval-buffer - "mef" 'slime-eval-defun - "mee" 'slime-eval-last-sexp - "mer" 'slime-eval-region + "meb" 'slime-eval-buffer + "mef" 'slime-eval-defun + "meF" 'slime-undefine-function + "mee" 'slime-eval-last-sexp + "mer" 'slime-eval-region - "mgg" 'slime-inspect-definition - "mgn" 'slime-next-note - "mgN" 'slime-previous-note - "mgp" 'slime-previous-note + "mgg" 'slime-inspect-definition + "mgb" 'slime-pop-find-definition-stack + "mgn" 'slime-next-note + "mgN" 'slime-previous-note - "mha" 'slime-apropos - "mhd" 'slime-disassemble-symbol - "mhh" 'slime-describe-function - "mhH" 'slime-hyperspec-lookup + "mha" 'slime-apropos + "mhA" 'slime-apropos-all + "mhd" 'slime-disassemble-symbol + "mhh" 'slime-describe-symbol + "mhH" 'slime-hyperspec-lookup + "mhp" 'slime-apropos-package + "mht" 'slime-toggle-trace-fdefinition + "mhT" 'slime-untrace-all + "mh<" 'slime-who-calls + "mh>" 'slime-calls-who + ;; TODO: Add key bindings for who binds/sets globals? + "mhr" 'slime-who-references + "mhm" 'slime-who-macroexpands + "mhs" 'slime-who-specializes - "mse" 'slime-eval-last-expression-in-repl - "msi" 'slime - "msq" 'slime-quit-lisp + "mma" 'slime-macroexpand-all + "mmo" 'slime-macroexpand-1 - "mtf" 'slime-toggle-fancy-trace))))) + "mse" 'slime-eval-last-expression-in-repl + "msi" 'slime + "msq" 'slime-quit-lisp + + "mtf" 'slime-toggle-fancy-trace)))) diff --git a/contrib/!lang/scheme/README.org b/contrib/!lang/scheme/README.org new file mode 100644 index 000000000000..78079a0a0ea5 --- /dev/null +++ b/contrib/!lang/scheme/README.org @@ -0,0 +1,84 @@ +#+TITLE: Scheme contribution layer for Spacemacs + +* Table of Contents +- [[#description][Description]] +- [[#install][Install]] +- [[#key-bindings][Key Bindings]] +* Description + +A spacemacs contribution layer providing Scheme support via [[http://www.nongnu.org/geiser/][Geiser]]. + +* Install + +The scheme layer currently supports: Chicken and Guile. Combined usage of racket-mode +and geiser has not been tested. + +To use this layer, simply add it to =~/.spacemacs=: + +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-configuration-layers '(scheme)) +#+END_SRC + +For full Chicken support, the following commands should be run: + +#+BEGIN_SRC shell + $ chicken-install -s apropos chicken-doc + $ cd `csi -p '(chicken-home)'` + $ curl http://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx +#+END_SRC + +* Key Bindings + +** Compiling + +| Key Binding | Description | +|-------------+----------------------------| +| ~SPC m c c~ | Compile current buffer | +| ~SPC m c p~ | Add directory to load path | + +** Navigation + +| Key Binding | Description | +|-------------+---------------------| +| ~SPC m g g~ | Goto Definition | +| ~SPC m g b~ | Go Back | +| ~SPC m g m~ | Goto Module | +| ~SPC m g n~ | Goto next error | +| ~SPC m g N~ | Goto previous error | + +** Documentation + +| Key Binding | Description | +|-------------+------------------------------------------| +| ~SPC m h h~ | Docs for symbol at point | +| ~SPC m h d~ | Look up manual entry for symbol at point | +| ~SPC m h m~ | Display exports for module | +| ~SPC m h <~ | Display callers | +| ~SPC m h >~ | Display callees | + +** Insertion + +| Key Binding | Description | +|-------------+---------------| +| ~SPC m i l~ | Insert Lambda | + +** Macroexpansion + +| Key Binding | Description | +|-------------+------------------------------| +| ~SPC m m e~ | Macroexpand last sexp | +| ~SPC m m f~ | Macroexpand surrounding sexp | +| ~SPC m m r~ | Macroexpand region | + +** REPL + +| Key Binding | Description | +|-------------+------------------------------------------| +| ~SPC m s i~ | Start or switch to the REPL | +| ~SPC m s b~ | Send buffer to the REPL | +| ~SPC m s B~ | Send buffer to the REPL and focus it | +| ~SPC m s f~ | Send definition to the REPL | +| ~SPC m s F~ | Send definition to the REPL and focus it | +| ~SPC m s e~ | Send last sexp to the REPL | +| ~SPC m s r~ | Send region to the REPL | +| ~SPC m s R~ | Send region to the REPL and focus it | diff --git a/contrib/!lang/scheme/packages.el b/contrib/!lang/scheme/packages.el new file mode 100644 index 000000000000..ab038f4ee33d --- /dev/null +++ b/contrib/!lang/scheme/packages.el @@ -0,0 +1,56 @@ +;;; packages.el --- Scheme Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(setq scheme-packages + '(geiser)) + +(defun scheme/init-geiser () + (use-package geiser + :commands run-geiser + :config + (progn + (evil-leader/set-key-for-mode 'scheme-mode + "mcc" 'geiser-compile-current-buffer + "mcp" 'geiser-add-to-load-path + + "mgg" 'geiser-edit-symbol-at-point + "mgb" 'geiser-pop-symbol-stack + "mgm" 'geiser-edit-module + "mgn" 'next-error + "mgN" 'previous-error + + "mhh" 'geiser-doc-symbol-at-point + "mhd" 'geiser-doc-look-up-manual + "mhm" 'geiser-doc-module + "mh<" 'geiser-xref-callers + "mh>" 'geiser-xref-callees + + "mil" 'geiser-insert-lambda + + "mme" 'geiser-expand-last-sexp + "mmf" 'geiser-expand-definition + "mmx" 'geiser-expand-region + + "msi" 'geiser-mode-switch-to-repl + "msb" 'geiser-eval-buffer + "msB" 'geiser-eval-buffer-and-go + "msf" 'geiser-eval-definition + "msF" 'geiser-eval-definition-and-go + "mse" 'geiser-eval-last-sexp + "msr" 'geiser-eval-region + "msR" 'geiser-eval-region-and-go)))) + +(when (configuration-layer/layer-usedp 'auto-completion) + + (defun scheme/post-init-company () + ;; Geiser provides completion as long as company mode is loaded. + (spacemacs|add-company-hook scheme-mode)))