A ~/.emacs initialization and customization file

Here is a sample ~/.emacs file to customize Emacspeak. As far as I can figure, the only person who likes Emacs in its default configuration is Richard Stallman, who wrote it. All the rest of us change it somewhat.

I will not describe my full ~/.emacs file since it is more than 180 kilobytes long. Instead, I will create for you a much shorter, sample ~/.emacs file that works — I tested it – and that has a few of the customizations that I like.

The following ~/.emacs file contains left and right angle brackets. To hear them in Emacspeak, you must set the punctuation mode to all with the command:

Control-e d p all RET

In the ~/.emacs file itself, I have set the global default mode to none. To set a global default value of all in your ~/.emacs file, write the expression as:

;; The `t' is optional and sets the global default value.
;; Without it, the setting applied only to the local buffer.
(dtk-set-punctuations 'all t)

Here is the file:

;;; ~/.emacs                          -*- mode: emacs-lisp -*-

;; Robert J. Chassell, 2003 Apr 23, 2005 May 17

;;; First, general customizations for GNU Emacs

;; Make Text mode the default, with autofill
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;; Put two spaces after a colon with explicit fill commands
(setq colon-double-space t)

;; Do not insert tabs
;  Indentation can insert tabs if indent-tabs-mode is non-nil,
;   but I do not like tabs.
(setq-default indent-tabs-mode nil)

;; Insert newline at the end of a buffer
(setq next-line-add-newlines t)

;; Find existing buffer, even with different name
;  (Avoid problems with symbolic links.)
(setq find-file-existing-other-name t)

;; Set command history list to 1000; it is 32 by default.
(setq list-command-history-max 1000)

;; Enable numbered backups
; `t'     Make numbered backups.
; `nil'   Make numbered backups for files
;             that have numbered backups already.
;         Otherwise, make single backups.
; `never' Always make single backups.
(setq version-control t)

;; By default the following are disabled to prevent confusing novices

;; Enable goal column
(put 'set-goal-column 'disabled nil)

;; Enable upcase region
(put 'upcase-region 'disabled nil)

;; Enable downcase region
(put 'downcase-region 'disabled nil)

;; Enable narrowing
(put 'narrow-to-region 'disabled nil)

;; Allow narrowing to a page.
(put 'narrow-to-page 'disabled nil)

;; Run Ediff with its help window in the same frame
(setq ediff-window-setup-function 'ediff-setup-windows-plain)

;; Ignore case when using `grep'
;  The options are:
;    -i Ignore case distinctions
;    -n Prefix each line of output with line number
;    -e Protect patterns beginning with -.
(setq grep-command "grep  -i -n -e ")

;; Reduce frequent garbage collections
(setq gc-cons-threshold 600000)

;; Increase undo limit
(setq undo-strong-limit 60000)

;; Increase `max-specpdl-size'
(setq max-specpdl-size 2500)

;; Load Info at start up rather than when you first use Info
(load "info")

;;; Custom keybindings

;; Binding for goto-line.
(global-set-key "\C-c\C-g" 'goto-line)

;; Use `apropos' instead of `command-apropos'
(global-set-key "\C-ha" 'apropos)

;; Binding for compile
(global-set-key "\C-xc" 'compile)

;; Binding for occur
(global-set-key "\C-co" 'occur)

;; List all the function definitions and defvars and the like
;; that are in an Emacs Lisp source file.
(defun occurrences-of-def ()
  "Run `occur' to find `^(def' from beginning of buffer or narrowed part.
Replaces going to the beginning of the buffer and finding the
occurrences of `^(def'."
  (interactive)
  (let ((buffer (current-buffer))
        (current-def nil))
    (save-excursion
      (end-of-line)             ; so as to find def on current line
      (if (re-search-backward "^(def\\w+\\W+\\w+-*.*" nil t)
          (setq current-def
                (buffer-substring (match-beginning 0) (match-end 0)))))
    (save-excursion
      (goto-char (point-min))
      (occur "^(def\\w+-?\\w*" nil)
      )
    (pop-to-buffer "*Occur*")
    (goto-char (point-min))
    (if current-def (search-forward current-def))
    (beginning-of-line)
    ))

(global-set-key "\C-cf" 'occurrences-of-def)

;; For sighted people using GNU Emacs 21, turn off the blinking cursor!
(if (fboundp 'blink-cursor-mode) (blink-cursor-mode -1))

;; Set the title for a frame
(setq frame-title-format '("Emacspeak:  %b"))

;;; For Emacspeak specifically

;; Make sure all Emacspeak code is in the load-path.
;; I commented this out since the load-path since is
;;     specific to my set up.
;;  The rest of this ~/.emacs file should work with
;;     all instances of Emacspeak.
;;  Depending on how you set up Emacspeak, you may not need to
;;    configure your load-path manually at all.
;; (setq load-path (cons "/usr/local/src/emacspeak/lisp/" load-path))
;;  A more modern and elegant way to set your load-path is
;; (add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
;;  The older method reminds you what `cons' does; the newer is simpler.

;; Turn on global-font-lock for the voice lock engine
(load "font-lock")
(global-font-lock-mode 1)
(setq font-lock-global-modes t)
;; (setq global-voice-lock-mode t) ; not needed and obsolete in Emacs 21

;; Speak time in a reasonable format: `C-e t'
(setq emacspeak-speak-time-format-string
  "The time is %_H hours %M minutes %Z on %A %_e %B %Y")

;; Set the audio theme
;; /usr/local/src/emacspeak/sounds/chimes-mono/
;; ( alternatively /usr/local/src/emacspeak/sounds/chimes-stereo/ )
(emacspeak-sounds-define-theme
 (expand-file-name "chimes-mono/" emacspeak-sounds-directory)
 ".wav")

;; Set punctuation mode to MODE `\'some, 'all, or 'none
;; For individual buffers the keybinding is: `C-e d p'
;; The expression in this ~/.emacs file sets the mode globally.
;;     In general, I prefer 'none   but then you will not hear
;;     braces and brackets spoken.  To listen to this ~/.emacs
;;     file, you need to set the mode to 'all.
;;    That is best done using the `C-e d p' keybinding.
;;     With an interactive prefix argument, `C-u C-e d p',
;;     set the global default value.
;; In this sample, I have set the mode to 'none.
(dtk-set-punctuations 'none t)

;;;;;;;;;;;;;;;; end ~/.emacs ::::::::::::::::

This document was generated on August 4, 2026 using texi2any.