When I started to use emacs as Java IDE, I have installed CEDET and JDEE. This make start time of emacs longer, even when I am not opening any Java file.
Therefore, it is required to start Emacs in daemon mode. So that only one time startup is longer, and subsequent startup of emacs (emacs client to be precise)
will be much faster.
I have written the following shell script (em, please place it in your $PATH), which starts the emacs daemon on first time only, and connects emacsclient to it.
First Run:
Second and Subsequent Runs:
I have written the following shell script (em, please place it in your $PATH), which starts the emacs daemon on first time only, and connects emacsclient to it.
#!/bin/bash usr=$(whoami) emacs_daemon="emacs --daemon" cmd="ps auxww | grep \"$usr.*$emacs_daemon\" | grep -v grep" #echo "$cmd" is_running=$(eval "$cmd") if [ -z "$is_running" ] then echo "Starting emacs daemon" eval "$emacs_daemon" if [ $? -ne 0 ] then echo "$0: Cannot start $emacs_daemon" >&2 exit fi fi emacsclient -a "" -t "$@" exit $?
First Run:
$ em Hello.java Starting emacs daemon Warning: due to a long standing Gtk+ bug http://bugzilla.gnome.org/show_bug.cgi?id=85715 Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost. Using an Emacs configured with --with-x-toolkit=lucid does not have this problem. ("emacs") Loading /usr/share/emacs/site-lisp/site-start.d/auto-complete-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/auto-complete-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/emacs-color-theme-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/emacs-color-theme-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/emacs-goodies-loaddefs.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/emacs-goodies-loaddefs.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/gnuplot-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/gnuplot-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/gnus-bonus-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/gnus-bonus-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)... Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...done Loading /usr/share/emacs/site-lisp/cedet-1.1/common/cedet.el (source)... Setting up CEDET packages... Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Setting up CEDET packages...done Loading /usr/share/emacs/site-lisp/cedet-1.1/common/cedet.el (source)...done Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 jde-java-font-lock: building names cache... jde-java-font-lock: building names cache...empty Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Warning: cedet-called-interactively-p called with 0 arguments, but requires 1 Starting Emacs daemon.
Second and Subsequent Runs:
$ em Hello.java