To determine if you are currently running GNU Emacs 18, GNU Emacs 19, XEmacs 19, or Epoch, and use appropriate code, check out the example given in `etc/sample.emacs'. There are other nifty things in there as well! Alternatively, there is a package, `emacs-vers.el', available at an Emacs-Lisp archive near you; try searching
archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/misc/
You can test the return value of the function
(device-class)
, as in:
(if (eq (device-class) 'color) (progn (set-face-foreground 'font-lock-comment-face "Grey") (set-face-foreground 'font-lock-string-face "Red") .... ))
(put 'eval-expression 'disabled nil)
This sets it so that hitting ESC ESC lets you type a single expression to be evaluated. This line can also be put into your `.emacs'.
Use setq-default, since tab-width is all-buffer-local.
Here are two ways to do that, one that puts your directories at the front of the load-path, the other at the end:
;;; Add things at the beginning of the load-path (setq load-path (cons "bar" load-path)) (setq load-path (cons "foo" load-path)) ;;; Add things at the end (setq load-path (append load-path '("foo" "bar")))
Use the following elisp:
(fboundp 'foo)
It's always a mistake, under all circumstances, to test `emacs-version' or any similar variables, in case they are not bound, unless you do the above.
Instead, use feature-tests, such as featurep or boundp or fboundp, or even simple behavioural tests, eg (defvar foo-old-losing-code? (condition-case nil (progn (losing-code t) nil) (wrong-number-of-arguments t)))
There is an incredible amount of broken code out there which could work much better more often in more places if it did the above instead of trying to divine its environment from the value of one variable.
Evaluate the expression in the "*scratch*" buffer with point on the rightmost paren and typing C-j.