Config variables
The config variables section (shown below) allows for the easy enabling and
disabling of packages within the configuration file. Enabling an option
is accomplished by setting its value to t (true). Disabling is
accomplished by assigning the variable a value of nil (false). For
descriptions of the individual packages view the remainder of my emacs
configuration file.
;;_____________________________________________________________________________
;;
;; Modify the config variables below to turn on and off sections of this emacs
;; configuration file. This saves me from having to find a section of this
;; configuration file when I want to turn something on or off. An assignment
;; of the variable to nil means false or no, while an assignment to t means
;; true or yes.
;;
(defvar config-enable-ange-ftp t)
(defvar config-enable-avoid nil)
(defvar config-enable-ms-windows-bash nil)
(defvar config-enable-blinking-cursor nil)
(defvar config-enable-calculator t)
(defvar config-enable-comint t)
(defvar config-enable-cua-mode t)
(defvar config-enable-dlgopen t)
(defvar config-enable-emacs-server t)
(defvar config-enable-extra-java-font-lock t)
(defvar config-enable-hideshow nil)
(defvar config-enable-hl-line t)
(defvar config-enable-htmlize t)
(defvar config-enable-html-helper t)
(defvar config-enable-imenu t)
(defvar config-enable-iswitchb nil)
(defvar config-enable-jde nil)
(defvar config-enable-mmm-mode t)
(defvar config-enable-outline t)
(defvar config-enable-pcl-cvs t)
(defvar config-enable-recentf t)
(defvar config-enable-speedbar t)
(defvar config-show-speedbar t)
(defvar config-enable-strip-whitespace t)
(defvar config-enable-swbuff t)
(defvar config-enable-uniquify t)
(defvar config-enable-ws-trim t)
(defvar config-enable-xt-mouse nil)
System paths
The portion of the configuration file that appears similar to the following is
used to specify where the third party Emacs packages are stored.
;;_____________________________________________________________________________
;;
;; Your shared system wide lisp packages directory. The path should NOT end
;; with a slash.
;;
(defvar config-packages-path
"/opt/websrc/dev1/janus-dev5/developers/share/emacs/packages")
;;_____________________________________________________________________________
;;
;; Extend the load-path so that my specific lisp packages can be found and
;; loaded.
;;
(add-to-list 'load-path config-packages-path)
(add-to-list 'load-path (expand-file-name "~/emacs/site-lisp"))
Determination of system properties
The snippet of code below shows how the configuration file determines if Emacs
is running within a graphical window or within a text only terminal. This
section also determines if Emacs is running under MS-Windows. The values
of the variables will be used in various parts of the configuration file to
properly enable or disable packages.
;;_____________________________________________________________________________
;;
;; The following section determines various properties that will be used to
;; automatically turn on and off sections of this emacs configuration file.
;; You should leave these alone as they are going to be determined by emacs.
;;
;; Check to see if we are on a graphical terminal
(if (null window-system)
; then
(defvar config-is-graphical-window-system nil)
; else
(defvar config-is-graphical-window-system t))
;; Check to see if we are under MS-Windows
(if (eq window-system 'w32)
; then
(defvar config-is-ms-windows t)
; else
(defvar config-is-ms-windows nil))
Screen size and font settings
This section is really big so I didn't try and cut and paste it here. The
big thing to notice here is that you don't have to change each and every font
and color entry. Just find the resolution that you are running at and
modify the entries there. I have run Emacs under both X and MS-Windows
at quite a few resolutions so you will most likely find a section you can
modify to your liking. If not, just copy an if block and specify settings
for the missing resolution.
MS-Windows stuff
If you are running under MS-Windows and are at all familiar with Unix, I will
suggest that you install a bash shell (Cygwin is an excellent one -
http://www.cygwin.com). If you do
decide to install a bash shell, the bash support section will cause Emacs to
load bash instead of command.com when a shell is started from within Emacs.
The second section specifically to MS-Windows is the font selection
dialog box. This helps out quite a bit when it comes to quickly finding
a font.
;;_____________________________________________________________________________
;;
;; Support for the bash shell under Windows 95/98/ME/NT/2000
;;
(cond ((and (eq config-enable-ms-windows-bash t) (eq config-is-ms-windows t))
(setq binary-process-input t)
(setq w32-quote-process-args ?\")
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)
(setq explicit-sh-args '("-login" "-i"))))
;;_____________________________________________________________________________
;;
;; Add's ability to change the current font via a Windows 95/98/ME/NT/2000
;; dialog box. ALT-F10 to display dialog box.
(cond ((eq config-is-ms-windows t)
(defun w32-set-font ()
"Select a new font via Window's dialog box"
(interactive)
(let ((new-font (w32-select-font)))
(if new-font
(set-frame-font new-font))))
(global-set-key [M-f10] 'w32-set-font)))
Packages
The packages that I configure and load during the processing of the Emacs
configuration file follow the format of the calculator section shown below.
You
Determination of system properties
The snippet of code below shows how the configuration file determines if Emacs
is running within a graphical window or within a text only terminal. This
section also determines if Emacs is running under MS-Windows. The values
of the variables will be used in various parts of the configuration file to
properly enable or disable packages.
;;_____________________________________________________________________________
;;
;; The following section determines various properties that will be used to
;; automatically turn on and off sections of this emacs configuration file.
;; You should leave these alone as they are going to be determined by emacs.
;;
;; Check to see if we are on a graphical terminal
(if (null window-system)
; then
(defvar config-is-graphical-window-system nil)
; else
(defvar config-is-graphical-window-system t))
;; Check to see if we are under MS-Windows
(if (eq window-system 'w32)
; then
(defvar config-is-ms-windows t)
; else
(defvar config-is-ms-windows nil))
Screen size and font settings
This section is really big so I didn't try and cut and paste it here. The
big thing to notice here is that you don't have to change each and every font
and color entry. Just find the resolution that you are running at and
modify the entries there. I have run Emacs under both X and MS-Windows
at quite a few resolutions so you will most likely find a section you can
modify to your liking. If not, just copy an if block and specify settings
for the missing resolution.
MS-Windows stuff
If you are running under MS-Windows and are at all familiar with Unix, I will
suggest that you install a bash shell (Cygwin is an excellent one -
http://www.cygwin.com). If you do
decide to install a bash shell, the bash support section will cause Emacs to
load bash instead of command.com when a shell is started from within Emacs.
The second section specifically to MS-Windows is the font selection
dialog box. This helps out quite a bit when it comes to quickly finding
a font.
;;_____________________________________________________________________________
;;
;; Support for the bash shell under Windows 95/98/ME/NT/2000
;;
(cond ((and (eq config-enable-ms-windows-bash t) (eq config-is-ms-windows t))
(setq binary-process-input t)
(setq w32-quote-process-args ?\")
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)
(setq explicit-sh-args '("-login" "-i"))))
;;_____________________________________________________________________________
;;
;; Add's ability to change the current font via a Windows 95/98/ME/NT/2000
;; dialog box. ALT-F10 to display dialog box.
(cond ((eq config-is-ms-windows t)
(defun w32-set-font ()
"Select a new font via Window's dialog box"
(interactive)
(let ((new-font (w32-select-font)))
(if new-font
(set-frame-font new-font))))
(global-set-key [M-f10] 'w32-set-font)))
can see that the first thing every section does is determine if it
should be executed by testing the config-enable-xxxxx variable. The next
thing that is accomplished is to test to see if the lisp package can be
located. If the package cannot be located, text is sent to the message
buffer explaining what may have gone wrong. This does two things.
First, this makes sure that Emacs doesn't wind up with a half completed
configuration. Second, this lets you know where to find the package and
install it. If, however, the package is can be located, the package is
loaded and any other configuration required is completed.
;;_____________________________________________________________________________
;;
;; CALCULATOR -- http://www.gnusoftware.com/Emacs/Lisp
;; Provides simple calculator functions in a mini-buffer.
;;
(cond ((eq config-enable-calculator t)
(if (locate-library "calculator")
; then
(progn
(autoload 'calculator
"calculator" "A simple pocket calculator for Emacs." t)
(global-set-key [(control return)] 'calculator))
; else
(progn
(message "MISSING: calculator.el")
(message " http://www.gnusoftware.com/Emacs/Lisp")))))
Customize settings
All of the properties within the two sections below are handled by the
customization within Emacs. As these sections should be handled by Emacs,
I tend to leave them alone. Although many of the properties below would
make more sense if they were placed with the proper packages section, Emacs
won't currently handle having them spread out like that.
;;_____________________________________________________________________________
;;
;; Set color and font properties to what I like. Remember that placing the
;; cursor on top of a piece of text and using the menu options
;; Edit -> Text Properties -> List Properties will display the font-lock face
;; name you want to set. Alternately, you could execute the lisp function
;; list-text-properties-at after placing the cursor on the text you want
;; information on.
;;
(custom-set-faces
'(default ((t (:foreground "white" :background "#000066"))))
'(custom-variable-tag-face ((t (:underline t :foreground "cyan"))))
'(custom-button-face ((t (:foreground "yellow" :background "dark blue"))) t)
'(html-helper-bold-face ((t (:bold t))))
'(cvs-filename-face ((t (:foreground "white"))))
'(modeline-mousable-minor-mode ((t (:foreground "cornflowerblue" :background "black"))))
'(font-lock-comment-face ((t (:foreground "grey50"))))
'(cvs-header-face ((t (:bold t :foreground "cyan"))))
n
dialog box. This helps out quite a bit when it comes to quickly finding
a font.
;;_____________________________________________________________________________
;;
;; Support for the bash shell under Windows 95/98/ME/NT/2000
;;
(cond ((and (eq config-enable-ms-windows-bash t) (eq config-is-ms-windows t))
(setq binary-process-input t)
(setq w32-quote-process-args ?\")
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)
(setq explicit-sh-args '("-login" "-i"))))
;;_____________________________________________________________________________
;;
;; Add's ability to change the current font via a Windows 95/98/ME/NT/2000
;; dialog box. ALT-F10 to display dialog box.
(cond ((eq config-is-ms-windows t)
(defun w32-set-font ()
"Select a new font via Window's dialog box"
(interactive)
(let ((new-font (w32-select-font)))
(if new-font
(set-frame-font new-font))))
(global-set-key [M-f10] 'w32-set-font)))
'(font-lock-string-face ((t (:foreground "#10D010"))))
'(underline ((t (:underline t))))
'(custom-group-tag-face ((t (:underline t :foreground "cyan"))))
'(speedbar-directory-face ((t (:foreground "light green"))))
'(html-tag-face ((t (:bold t :foreground "dark orchid"))))
'(region ((t (:background "#003300"))))
'(custom-set-face ((t (:foreground "#2020D0"))))
'(widget-inactive-face ((t (:foreground "gray"))))
'(font-lock-keyword-face ((t (:foreground "#00BBBB"))))
'(highlight-changes-delete-face ((t (:foreground "red" :background "navy"))))
'(html-helper-builtin-face ((t (:foreground "OrangeRed1"))))
'(show-paren-mismatch-face ((t (:background "red"))))
'(custom-state-face ((t (:foreground "mediumaquamarine"))))
'(custom-face-tag-face ((t (:foreground "goldenrod" :underline t))))
'(font-lock-constant-face ((t (:foreground "indian red"))))
'(highlight-changes-face ((t (:background "navy"))))
'(widget-field-face ((t (:foreground "black" :background "grey35"))))
'(mmm-default-submode-face ((t (:background "#000033"))))
'(widget-single-line-field-face ((t (:foreground "navy" :background "gray85"))))
'(custom-documentation-face ((t (:foreground "#10D010"))) t)
'(modeline-buffer-id ((t (:foreground "cornflowerblue" :background "black"))))
'(html-helper-underline-face ((t (:underline t))))
'(html-helper-italic-face ((t (:italic t))))
'(modeline ((t (:foreground "cornflowerblue" :background "black"))))
'(highlight ((t (:foreground "navy" :background "darkseagreen2"))))
'(show-paren-match-face ((t (:background "darkgreen"))))
'(italic ((t (:italic t))))
'(font-lock-function-name-face ((t (:foreground "cyan"))))
'(secondary-selection ((t (:background "navy"))))
'(modeline-mousable ((t (:foreground "cornflowerblue" :background "black")))))
;;_____________________________________________________________________________
;;
;; Define miscellaneous properties to my liking.
;;
(custom-set-variables
'(jde-compile-option-debug (quote ("all" (t nil nil))))
'(scroll-step 1)
'(mmm-global-mode (quote maybe) nil (mmm-mode))
'(resize-minibuffer-mode 1 nil (rsz-mini))
'(show-paren-mode t nil (paren))
'(widget-mouse-face (quote highlight))
'(jde-db-source-directories (quote ("~/opt/websrc/dev1/janus-dev5/developers/tiedemma/java/" "/opt/websrc/dev1/janus-dev5/developers/tiedemma/java/")))
'(html-helper-mode-uses-bold-italic t nil (html-helper-mode))
'(jde-db-debugger (quote ("oldjdb" "" . "Executable")))
'(column-number-mode t)
'(visible-bell t)
'(jde-bug-jpda-directory "c:/jdk1.3/jpda/")
'(next-line-add-newlines nil)
'(cvs-allow-dir-commit t)
'(global-font-lock-mode t nil (font-lock))
'(scroll-bar-mode (quote right)))
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
al,sans-serif" size="+1">
Programming mode hooks
Below is my C mode configuration. This handles everything to do with
editing C files (indentation, Imenu, etc.). I also make sure that files
having extensions of .pc, .PC, .sc, and .SC (Oracle and Ingres C files before
they have run thru a precompiler) are treated as C source files.
;;_____________________________________________________________________________
;;
;; C-MODE
;; Customize various aspects of c-mode to my liking. Remember that placing the
;; cursor on top of some text and pressing C-c C-o will display the
;; c-set-offset parameter name.
;;
(defun my-c-mode-hook ()
(c-set-style "ellemtel")
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq c-tab-always-indent nil)
(c-set-offset 'statement-case-intro ' + )
(c-toggle-hungry-state 1)
(if (fboundp 'turn-on-ws-trim)
(turn-on-ws-trim))
(cond ((and (eq config-enable-imenu t) (fboundp 'imenu-add-to-menubar))
(imenu-add-to-menubar "Functions")
(setq imenu-sort-function (quote imenu--sort-by-name)))))
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-to-list 'auto-mode-alist '("\\.[sSpP][cC]\\'" . c-mode))
Things I need to clean up
Below all of the modes that I have specifically configured are miscellaneous
things that are in partial disarray. There is some working code that
redefines the backup function. There is also an incomplete function that
if I ever finish modifying it would allow auto-save files to be saved in a
central location.