HighlightDynamicVariables

This page is about library dyna-show.el, which provides highlighting of occurrences of dynamically scoped variables in an EmacsLisp buffer, using minor mode ‘dyna-show-mode’.

The variables are highlighted using faces ‘dyna-options’ for user options and ‘dyna-variables’ for other dynamic variables.

It uses predicate ‘special-variable-p’, which is limited. From the screenshot, you can see another limitation: occurrences of a function, e.g. ‘font-lock-mode’, that has the same name as a dynamic variable, are also highlighted.

Note: Library hi-var.el supersedes library dyna-show.el. Library hi-var.el highlights what dyna-show.el does, but it can also highlight file-local and other buffer-local variables. See HighlightElispVariables.

DynaShow

Put this in your init file, after adding dyna-show.el to your ‘load-path’:

   (require 'dyna-show)

If you want to turn on this highlighting automatically whenever you enter EmacsLisp mode then you can do this in your InitFile:

  (require 'dyna-show)
  (add-hook 'emacs-lisp-mode-hook 'dyna-show-mode 'APPEND)

You can use library dyna-show.el together with library hl-defined.el, which highlight symbols that are known to be defined functions and/or variables. When used together, the highlighting of dynamic variables overrides the variable highlighting of hl-defined.el.


CategoryHelp CategoryEditing CategoryDisplay CategoryLisp CategoryFaces CategoryCode