Implement layer for developing in the Forth language

This commit is contained in:
Tim Jaeger 2017-01-29 16:00:32 +01:00 committed by syl20bnr
parent cbab7cac59
commit acaf0e31f5
2 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#+TITLE: Forth layer
* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#install][Install]]
- [[#key-bindings][Key bindings]]
* Description
This layer supports developing in the Forth family of languages. It provides
shortcuts to a basic set of commands for interactive development.
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =forth= to the existing =dotspacemacs-configuration-layers= list in this
file.
A local installation of Forth needs to be present as well. /GNU Forth/ is
commonly available on Unix systems via the package manager. To bypass the query
when calling ~run-forth~, the default Forth can be configured by setting the
appropriate variable.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((forth :variables forth-executable "gforth")))
#+END_SRC
* Key bindings
All Forth specific bindings are prefixed with the major-mode leader
~SPC m~.
| Key Binding | Description |
|-------------+-------------------------------------------------------------------|
| ~SPC m d s~ | See definition (show decompiled body) |
| ~SPC m e E~ | Evaluate expression in minibuffer |
| ~SPC m e e~ | Evaluate last expression |
| ~SPC m e r~ | Evaluate region |
| ~SPC m s b~ | Load file in interactive Forth |
| ~SPC m s i~ | Start interactive Forth (prompts for Forth executable if not set) |
| ~SPC m s k~ | Kill interactive Forth |

View File

@ -0,0 +1,25 @@
;;; packages.el --- forth layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Tim Jaeger <jger.tm@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defconst forth-packages
'(forth-mode))
(defun forth/init-forth-mode ()
(use-package forth-mode
:defer t
:init (spacemacs/set-leader-keys-for-major-mode 'forth-mode
"ds" 'forth-see
"eE" 'forth-eval
"ee" 'forth-eval-last-expression
"er" 'forth-eval-region
"sb" 'forth-load-file
"si" 'run-forth
"sk" 'forth-kill)))