Skip to content

alphapapa/highlight-function-calls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

highlight-function-calls

https://melpa.org/packages/highlight-function-calls-badge.svg

This package highlights function symbols in function calls. This makes them stand out from other symbols, which makes it easy to see where calls to other functions are. It also helps to reduce typos, as when you’re typing a function name, it becomes underlined when typed correctly. Optionally, macros and special forms can be highlighted as well. Also, a list of symbols can be excluded from highlighting; by default, ones like + / -, < / >, error, require, etc. are excluded. Finally, the not function can be highlighted specially.

Since Elisp is a Lisp-2, a symbol can be a variable or a function, and regular expression-matching is not a perfect solution for determining which. So every matched symbol is run against a few checks, and this works correctly most of the time. However, in a situation like:

(defsubst internal--listify (elt)
  "Wrap ELT in a list if it is not one."
  (if (not (listp elt))
      (list elt)
    elt))

…the elt in the argument list is highlighted as a function, even though it isn’t a function call, because it’s the first symbol in a list and the name of a function.

The default face just underlines the function name, but you can customize the face however you like.

Screenshots

Here’s a plain Emacs configuration:

screenshots/plain.png

Here’s one with some other highlighting modes, like rainbow-delimiters and rainbow-identifiers:

screenshots/rainbow.png

Installation

Install the package from MELPA and you’re all set!

If you want to install it manually, put highlight-function-calls.el in your load-path, then add this to your init file:

(require 'highlight-function-calls)

Usage

Run highlight-function-calls-mode to activate. Maybe you want to add it to your emacs-lisp-mode-hook like this:

(use-package highlight-function-calls
  :config
  (add-hook 'emacs-lisp-mode-hook 'highlight-function-calls-mode))

Note: You should probably activate this mode last, after any other highlighting modes, such as rainbow-identifiers-mode, otherwise the highlight-function-calls faces may not be visible. You might need to use a custom function to activate modes like this in the right order, and add that function to your emacs-lisp-mode-hook instead.

Tips

You can customize options and faces in the highlight-function-calls customization group.

Changelog

v0.2-pre

Additions

  • Sharp-quoted function symbols are highlighted.

v0.1

First tagged release (after several years of no changes).

Contributions

Bug reports, feature requests, pull requests, oh my!

License

GPLv3

About

Highlight function/macro calls in Emacs

Resources

License

Stars

Watchers

Forks

Packages

No packages published