A performance-oriented Lisp-like language where I can have my cake, and eat it (too)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.7 KiB

Tools Integration

This document covers how to add Cakelisp support to various different tools/editors.

Counting lines of code

Use the following setup to cloc:

cloc --force-lang="Lisp",cake [dirs]

Github syntax highlighting

Create a .gitattributes file in the project root, then add the following:

*.cake linguist-language=lisp


Open .cake files in lisp-mode

(add-to-list 'auto-mode-alist '("\\.cake?\\'" . lisp-mode))

Specify indentation of various new forms

The number represents how many arguments are expected to the function.

  (put 'defun-local 'lisp-indent-function 'defun)
  (put 'defun-comptime 'lisp-indent-function 'defun)
  (put 'defgenerator 'lisp-indent-function 'defun)

  (put 'defstruct-local 'lisp-indent-function 1)
  (put 'defstruct 'lisp-indent-function 1)

  (put 'var 'lisp-indent-function 2)
  ;;(put 'block 'lisp-indent-function 3) ;; Doesn't work because block is special (always expects 1)

  (put 'tokenize-push 'lisp-indent-function 1)
  (put 'for-in 'lisp-indent-function 3)

  ;; Macros
  (put 'each-in-range 'lisp-indent-function 2)
  (put 'each-in-array 'lisp-indent-function 2)
  (put 'each-char-in-string 'lisp-indent-function 2)
  (put 'each-char-in-string-const 'lisp-indent-function 2)
  (put 'c-for 'lisp-indent-function 3)

  (put 'run-process-sequential-or 'lisp-indent-function 1)

  (put 'if-c-preprocessor-defined 'lisp-indent-function 1)

You will need to add these for your custom macros because I haven't written an Emacs parser to automatically determine indentation from macro/generator signatures.