Add check for display list equals nil

Emacs returns either a sequence of availbale displays or nil. Checking
nil fixes this script to work as expected.
Merge pull request #2651 from jehrhardt/fix-emacs

Fix Emacs plugin