adding rules to prevent crashing when emacs start without X (daemon).