Suppose you have many customizations and you want to dump that into a new binary so that emacs can be started quickly. You might choose dumping new emacs. Here is a simple way to dump without the burden of separate configuration file management. Write your ~/.emacs.el as follows:
(require 'cl) (defmacro eval-when-dump (&rest body) (when (boundp 'eval-when-dump) `(progn ,@body (makunbound 'eval-when-dump)))) (defmacro eval-after-dump (&rest body) (unless (boundp 'eval-when-dump) `(progn ,@body))) (eval-when-dump ...) (eval-after-dump ...)The actual dumping process goes like this:
$ $EMACS --batch --execute "(setq eval-when-dump t)" -f batch-byte-compile ~/.emacs.el $ $EMACS --batch -l ~/.emacs.elc --execute "(dump-emacs \"$HOME/xe\" \"$EMACS\")" $ $EMACS --batch -f batch-byte-compile ~/.emacs.elThen byte compile ~/.emacs.el then the newly created binary will read only the
(eval-afater-dump ..) part and dump process only reads
(eval-when-dump ....).
A few commands should not be called while dumping. These includes
(display-time), (setenv ...), and so on. Gnus
needs some hack to be loaded while dumping.
Randum note:
inhibit-startup-message is reseted to its
default while startup.
-xO5 option.
Here's a emacs binary replacement to do automatic re-dumping if .emacs.el changes. Save it to emacs and make it an executable and make sure this emacs comes before the real emacs binary(check with type -a in your shell).
#! /bin/sh
DUMPUP=~/.emacs.el
EMACSDIR=/home/jay/build/emacs
PATH=$EMACSDIR/src:$EMACSDIR/lib-src:$PATH
export PATH
if test -n $DUMPUP -a -f $DUMPUP -a $DUMPUP -nt $EMACSDIR/src/xe; then
pushd $EMACSDIR/src &&
./emacs -batch -eval "(setq eval-when-dump t)" -f batch-byte-compile $DUMPUP &&
./emacs -batch -l ${DUMPUP}c -eval "(dump-emacs \"xe\" \"emacs\")" &&
./emacs -batch -f batch-byte-compile $DUMPUP &&
popd
fi
exec xe "$@"
Here's a list of small emacs lisp scripts I've written.
If you have a slow input device, you may need this crude hack. I don't know if there's any way to differentiate the repeated key input from hold the key press, but this quick and dirty hack with suitable interval for disabling the timer will do.
In M$ IE, there is something called, "web accessories" in which you can customize your search engine with one keystroke. (e.g., In your address bar, you can type "g Emacs" for searching Emacs in google.)
Copy qs.el to your emacs load-path, put in your
emacs:
(load "qs" nil t)
(define-key mode-specific-map "d" 'qs-search)
Now, try "C-c d" and then "g Emacs". That's all!
Actually, it's not my work. It's done by "Kim
F.Storm
Load it in your emacs, and then C-SPC works an before,
but now you can type C-u C-SPC C-SPC ... instead of
C-u C-SPC C-u C-SPC C-u C-SPC ... . It will be the
default behavior in emacs 21.4
Once you type M-., you can repeated tag search via
C-u M-.. But this hack will teach emacs such that
repeated M-. will repeat last tag search.
Load it in your emacs, and eval:
(define-key mode-specific-map "/" 'gdb-keymap-mode)
By typing C-c /, you can type n, b, t... like
command without any ESC, Meta, Alt, Ctrl, Super key.
Typing C-c / again, will make your emacs as normal.