Lindydancer / lisp-extra-font-lock

Highlight bound variables and quoted expressions in lisp
56 stars 5 forks source link

lisp-extra-font-lock - Highlight bound variables and quoted exprs

Author: Anders Lindgren
Version: 0.0.6
URL: https://github.com/Lindydancer/lisp-extra-font-lock

This package highlight the location where local variables is created (bound, for example by let) as well as quoted and backquoted constant expressions.

Example

Below, ^ is used indicate highlighted normal variables and constant expressions. * is used to show highlighting of special variables (i.e. those defined by defvar) and of the backquote and comma operators.

(defun my-function (next)
                    ^^^^             <- Parameters
  (let ((numbers '(one two three))
         ^^^^^^^  ^^^^^^^^^^^^^^^    <- Var bound by `let` and quoted expr.
        (buffer-read-only t))
         ****************            <- Special variable (different color)
    `(,@numbers and ,next)))
    *^**        ^^^ *    ^           <- Backquote and comma

Screenshot

See doc/demo.png for screenshot

What is highlighted

Installation

Place this package in a directory in the load-path. To activate it, use customize or place the following lines in a suitable init file:

   (require 'lisp-extra-font-lock)
   (lisp-extra-font-lock-global-mode 1)

Customization

You can modify the following lists to add more functions that are recognized:

The following faces are used when highlighting. You can either redefine the face (e.g. using a theme), or you can rebind the corresponding variable.

Example

To set the face used to highlight quoted expressions to a gray color, you can use:

    (custom-set-faces
      '(lisp-extra-font-lock-quoted ((t :foreground "grey50"))))

Converted from lisp-extra-font-lock.el by el2markdown.