[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]
Customizing Emacs
I'm attaching my .emacs file here in the hope that it will
provide emacspeak users a taste of the number of things one
can configure and load inside emacs.
Warning:
*DO NOT USE THIS .EMACS UNLESS YOU UNDERSTAND WHAT IT DOES*
The purpose in posting it is so emacspeak users can clone
relevant sections as needed.
Note that I typically place
individual package customizations in their own files --
none of which are attached here--
The file is arranged into a series of folds (marked with
;;;{{{ for convenient maintainance)
;;; Emacs initialization file for Raman.
;;; $Id: emacs-startup.el,v 1.110 1998/07/14 17:09:15 raman Exp raman $
;;{{{ info on byte compiling:
;;; Introducing a start up function to allow byte-compilation.
;;; Refer to the article
;;; "~/News/gnu/emacs/help/speed-up-startup"
;;}}}
(require 'cl)
(declare (optimize (safety 0) (speed 3)))
(defun start-up-my-emacs()
(interactive)
;;{{{ memory management:
;;; First handle memory management.
;
;If you have lots of real-memory, or don't mind more paging activity,
;do the following at the start of your .emacs.
;
(setq gc-cons-threshold 2000000)
;;}}}
(let ((gc-cons-threshold 4000000))
;;; Load path tells emacs where to look for emacs-lisp files.
(setq load-path
(append
(list
(expand-file-name "~/.elisp")
(expand-file-name "~/emacs/lisp/site-lisp"))
load-path))
;;{{{ are we lapdog?
(declare (special lapdog-p ))
(setq lapdog-p
(string= (system-name)
"lapdog.corp.adobe.com"))
;;}}}
;;{{{ Load and customize emacspeak
(unless (featurep 'emacspeak)
(load-file
(expand-file-name "~/emacs/lisp/emacspeak/emacspeak-setup.el")))
(when (featurep 'emacspeak)
(declare (special emacspeak-play-program emacspeak-play-args
emacspeak-auditory-icon-function
dtk-default-speech-rate))
(unless lapdog-p
(setq emacspeak-play-program "/usr/demo/SOUND/play")
(setq emacspeak-play-args "-i")
(setq emacspeak-auditory-icon-function 'emacspeak-play-auditory-icon))
(setq dtk-default-speech-rate 450)
(emacspeak-pronounce-load-dictionaries "~/.emacspeak/.dictionary")
(dtk-set-rate 450 t)
(emacspeak-toggle-auditory-icons t)
)
;;}}}
;;{{{ handle terminal weirdnesses and function keys
(unless lapdog-p
(load-library "sun-raw-prefix")
(load-library "term/vt100"))
(load-library "console")
(load-library "pf-keys")
;;}}}
;;{{{ initial stuff
(load-library "my-functions")
(setq-default outline-minor-mode-prefix "\C-l")
(setq enable-local-variables t
enable-local-eval t)
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook
(function (lambda nil
(local-unset-key "\M-s")
(outline-minor-mode 1))))
(setq auto-save-default t)
(setq auto-save-interval 2000)
(setq default-fill-column 60)
(setq tab-stop-list
'(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
(setq require-final-newline t)
(setq inhibit-startup-message t)
(setq kept-new-versions 3)
(setq delete-old-versions t )
(setq kept-old-versions 2)
(setq dired-kept-versions 1)
;(setq indent-line-function 'indent-relative-maybe)
(declare (special Man-notify))
(setq Man-notify 'friendly)
(put 'upcase-region 'disabled nil)
(setq next-line-add-newlines nil)
;;; turn on/off what we want
(put 'narrow-to-region 'disabled nil)
(put 'eval-expression 'disabled nil)
(setq-default indent-tabs-mode nil) ; always use spaces when indenting.
(declare (special explicit-shell-file-name
shell-cd-regexp))
(unless lapdog-p
(setq explicit-shell-file-name "/usr/local/bin/bash"))
(add-hook 'find-file-hooks
(function (lambda () (auto-fill-mode 1 ))))
(setq backup-by-copying-when-linked t)
(setq version-control t)
(setq kill-ring-max 16)
(unless lapdog-p
(setq Info-default-directory-list
(append Info-default-directory-list
'("/public/info" ))))
(setq shell-cd-regexp
"cd\\|pushd\\|popd")
;;}}}
;;{{{ advice:
;;; Place in a separate file so we can have defadvice forms:
(load-library "advice-setup")
;;}}}
;;{{{ isearch:
;;; search bindings
(setq default-case-fold-search nil)
(add-hook 'isearch-mode-hook (function (lambda ()
(setq isearch-case-fold-search t)
(define-key isearch-mode-map "\C-t" 'isearch-toggle-regexp))))
;;}}}
;;{{{ c mode:
;;; emacs 20 autoloads things correctly
;;}}}
;;{{{ completion: tmc
(load "completion")
(initialize-completions)
(global-set-key "\M- " 'complete)
;;}}}
;;{{{ gnus:
(load-library "gnus-setup")
;;}}}
;;{{{ dired
(declare (special dired-x-hands-off-my-keys
dired-bind-vm
dired-omit-files-p))
(add-hook 'dired-load-hook
(function
(lambda ()
(declare (special dired-x-hands-off-my-keys
dired-bind-vm
dired-omit-files-p))
(load-library "dired-x")
(setq dired-x-hands-off-my-keys nil
dired-bind-vm t))))
(add-hook 'dired-mode-hook
(function (lambda ()
;; Set dired-x buffer-local variables here. For example:
(setq dired-omit-files-p t)
)))
;;}}}
;;{{{ ange ftp:
(require 'ange-ftp)
(declare (special ange-ftp-default-user
ange-ftp-default-password
ange-ftp-gateway-host
ange-ftp-smart-gateway
ange-ftp-smart-gateway-port
ange-ftp-local-host-regexp
ange-ftp-good-msgs))
(setq ange-ftp-default-user "anonymous"
ange-ftp-default-password "raman@xxxxxxxxxxx"
ange-ftp-gateway-host "relay"
ange-ftp-smart-gateway t
ange-ftp-smart-gateway-port 1555)
(setq ange-ftp-local-host-regexp "\\.adobe\\.com$\\|^[^.]*$")
(setq ange-ftp-good-msgs (concat "^220\\|" ange-ftp-good-msgs))
;;}}}
;;{{{ w3:
(setq browse-url-browser-function 'browse-url-w3)
(load-library "w3-prepare")
;;}}}
;;{{{ calendar:
(require 'calendar)
(setq diary-file (expand-file-name "~/.diary"))
(setq view-diary-entries-initially t)
(setq appt-issue-message t)
(display-time)
(add-hook 'diary-hook 'appt-make-list)
;;;
;;;
(add-hook 'diary-display-hook 'fancy-diary-display)
(calendar)
(global-set-key "\M-\C-c" 'calendar)
;;}}}
;;{{{ vm setup
(load-library "vm-prepare")
(declare (special mail-default-headers
mail-archive-file-name
mail-passwd-files))
(setq mail-archive-file-name
(expand-file-name "~/Mail/outgoing"))
(setq mail-passwd-files
(list "/tmp/passwd.dat" ))
(setq mail-default-reply-to "raman@xxxxxxxxxxx")
(setq mail-default-headers
(concat "From: \"T. V. Raman\" <raman@xxxxxxxxxxx>\n"
"X-Phone: 1 (408) 536-3945\n"
"X-Fax: 1(408) 537-4042\n"))
(load-library "init-bbdb")
(bbdb-insinuate-vm)
(add-hook 'vm-quit-hook 'vm-expunge-folder)
(add-hook 'mail-send-hook
(function (lambda ()
(mail-signature nil ))))
(loop for hook in
(list 'vm-mail-mode-hook 'mail-mode-hook)
do
(add-hook hook
(function (lambda ()
(local-set-key "\C-c\C-g" 'my-thanks-mail-signature)
(local-set-key "\M-\C-i" 'bbdb-complete-name)
(auto-fill-mode 1)))))
(load-library "mailcrypt-setup")
;;}}}
;;{{{ html helper mode:
(autoload 'html-helper-mode "html-helper-mode")
(declare (special html-helper-do-write-file-hooks
html-helper-build-new-buffer
html-helper-address-string
html-helper-new-buffer-template))
;;; Config:
(setq html-helper-do-write-file-hooks t)
;"*If not nil, then html-helper-mode will modify the local-write-file-hook
;to do timestamps."
(setq html-helper-build-new-buffer t )
;"*If not nil, then html-helper will insert html-helper-new-buffer-strings
;when new buffers are generated
;;; personal settings:
(setq html-helper-address-string
(format "<A href=\"mailto:%s\">Email: %s</a>"
"raman@xxxxxxxxxxx" "raman@xxxxxxxxxxx"))
;"*The default author string of each file.")
(setq html-helper-new-buffer-template
'("<html>\n"
"<!--$Id: emacs-startup.el,v 1.110 1998/07/14 17:09:15 raman Exp raman $ -->\n"
" <head>\n"
"<LINK REV=MADE HREF=\"mailto:raman@xxxxxxxxxxx">\n"
"<title>" p "</title>\n"
"</head>\n\n"
"<body>\n"
"<h1>" p "</h1>\n\n"
p
"\n\n<hr>\n"
"<address>" html-helper-address-string "</address>\n"
html-helper-timestamp-start
html-helper-timestamp-end
"\n</body>\n </html>\n"))
(add-hook 'html-helper-mode-hook
(function (lambda ()
(auto-fill-mode 1)
(require 'html-addons))))
(require 'html-outline)
;;}}}
;;{{{ auto mode and auto includes
;;; auto-mode-alist tells emacs what mode should be used for a given
;;; filename extension.
(mapcar
(function (lambda (setting)
(setq auto-mode-alist
(cons setting auto-mode-alist ))))
'(
;("\\.system$"
;. lisp-mode)
("\\.xml$". sgml-mode)
("\\.rdf$". sgml-mode)
("\\.html$". html-helper-mode)
;("\\.m$" . fortran-mode)
("\\.l$" . c-mode)
("\\.idl$" . idl-mode)))
;;; Use the autoinclude file hack, which reads in a template file for
;;; any new file read into emacs with a matching filename extension.
; (load-library "autoinclude")
; (declare (special auto-include-directory
; auto-include-alist))
; (setq auto-include-directory "/user/raman/.auto/")
; (setq auto-include-alist
; (append
; '(("\\.lisp$" . "header.lisp")
; ("\\.orc$" . "header.orc")
; ("\\.txt$" . "header.txt")
; ("\\.tex$" . "header.tex")
; )
; auto-include-alist))
;(setq auto-include-alist
; (append
; '(("\\.tcl$" . "header.tcl"))
; auto-include-alist))
;;; set up python mode
;;
(autoload 'python-mode "python-mode" "Python editing mode." t)
(setq auto-mode-alist
(cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
(cons '("python" . python-mode) interpreter-mode-alist))
;;}}}
;;{{{ different mode settings
;;; Mode hooks.
(add-hook 'shell-mode-hook
(function (lambda ()
(declare (special
comint-prompt-regexp
comint-input-autoexpand
comint-input-ignoredups))
(setq comint-prompt-regexp
"[0-9:]* [^ ]* [^ ]* ")
(setq comint-input-autoexpand 'input
comint-input-ignoredups t)
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt ))))
(setq completion-ignored-extensions
(append completion-ignored-extensions '(".class")))
;;; emacs lisp mode:
(add-hook 'emacs-lisp-mode-hook
(function (lambda ()
(local-set-key "\C-cc" 'byte-compile-current-buffer)
(local-set-key "\C-cl" 'load-current-file))))
;(augment-load-path "~/aster-clisp/lisp-code/vanila-interface")
;(autoload 'aster "run-lisp-setup" "Run AsTeR" t)
;;}}}
;;{{{ global key definitions
(global-set-key "\C-x\C-v" 'view-file)
(global-set-key "\C-xc" 'compile)
(define-key ctl-x-map "%" 'comment-region)
(global-set-key "\M-r" 'replace-string)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\M-s" 'save-buffer);; use in screen
(global-set-key "\C-xt" 'line-to-top)
;(global-set-key "\C-m" 'newline-and-indent)
(if (not (featurep 'emacspeak))
(global-set-key "\M-f" 'raman-forward-word))
(global-set-key "\M--" 'undo)
(global-set-key "\M-e" 'end-of-word)
(global-set-key "\C-xra" 'append-to-register)
(global-set-key "\C-xrp" 'prepend-to-register)
;;}}}
;;{{{ auctex:
(load-library "auctex-prepare")
(declare (special TeX-auto-private
TeX-macro-private
TeX-auto-local))
(setq TeX-auto-private (expand-file-name "~/text/.auto/"))
(setq TeX-macro-private
(list (expand-file-name "~/text/styles/")))
(setq TeX-auto-local ".auto/")
;; Personal defaults for AUC-TeX mode
;;; variable settings:
(declare (special
TeX-debug-bad-boxes
tex-mode-hook))
(setq TeX-debug-bad-boxes t) ; find overful underful boxes in debugger.
(setq tex-mode-hook
(function (lambda()
(local-set-key "\M-s" 'save-buffer)
(local-set-key "\C-c o" 'outline-minor-mode)
(local-set-key "\C-c," 'comma-at-end-of-word)
(local-set-key "\C-c~" 'tex-tie-current-word)
(auto-fill-mode 1))))
;;}}}
;;{{{ ctl-z-keymap
(setup-ctl-z-keymap)
;;}}}
;;{{{ folding mode
(load-library "folding")
(declare (special fold-fold-on-startup
fold-keys-already-setup
fold-keys-already-setup
fold-dont-bind-keys
fold-inhibit-startup-message
))
(setq fold-fold-on-startup nil)
(setq fold-keys-already-setup nil)
(add-hook 'folding-mode-hook
(function (lambda()
(unless fold-keys-already-setup
(setq fold-keys-already-setup t)
(define-prefix-command 'ctl-f-folding-mode-prefix)
(define-key 'ctl-f-folding-mode-prefix "f" 'fold-fold-region)
(define-key 'ctl-f-folding-mode-prefix "e" 'fold-enter)
(define-key 'ctl-f-folding-mode-prefix "x" 'fold-exit)
(define-key 'ctl-f-folding-mode-prefix "b" 'fold-whole-buffer)
(define-key 'ctl-f-folding-mode-prefix "o" 'fold-open-buffer)
(define-key 'ctl-f-folding-mode-prefix "h" 'fold-hide)
(define-key 'ctl-f-folding-mode-prefix "s" 'fold-show)
(define-key 'ctl-f-folding-mode-prefix "t" 'fold-top-level)
)
(local-set-key "\C-f" 'ctl-f-folding-mode-prefix))))
(setq fold-dont-bind-keys t)
(setq fold-inhibit-startup-message t)
(folding-mode-add-find-file-hook)
(fold-add-to-marks-list 'sgml-mode
"<!-- {"
"<!-- } -->" " --> ")
(fold-add-to-marks-list 'c-mode "/* <" "/* > */" "*/")
(fold-add-to-marks-list 'c++-mode
"//<" "//>" "")
(fold-add-to-marks-list 'LaTeX-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'latex2e-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'latex-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'BibTeX-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'lisp-mode ";;; {" ";;; }" "")
(fold-add-to-marks-list 'lex-mode" /* {{{ " " /* }}} */ " "*/")
(fold-add-to-marks-list 'html-helper-mode "<!-- { " "<!-- } -->" "-->")
;;}}}
;;{{{ handle compressed files:
;;; load compress package.
(load "jka-compr")
;;}}}
;;{{{ emacs server:
;(server-start)
;;}}}
;;{{{ gc when I am not looking:
;(require 'auto-gc)
; gc when I am not looking
;(setq auto-gc-interval 3000)
;;}}}
;;{{{ Improved grep: igrep
(autoload 'igrep "igrep"
"Improved grep" t)
;;}}}
;;{{{ calculator:
(load-library "prepare-calc")
;;}}}
;;{{{ hyperbole:
(unless (featurep 'hyperbole-prepare)
(load-library "hyperbole-prepare"))
(load-library "oobr-prepare")
;;}}}
;;{{{ tcl mode:
(declare (special inferior-tcl-mode-map
tcl-prompt-regexp
tcl-help-directory-list))
(fold-add-to-marks-list 'tcl-mode "# {{{" "# }}}" " ")
(autoload 'tcl-mode "tcl" "Tcl mode." t)
(autoload 'inferior-tcl "tcl" "Run inferior Tcl process." t)
;; If you plan to use the interface to the TclX help files, you must
;; set the variable tcl-help-directory-list to point to the topmost
;; directories containing the TclX help files. Eg:
;;
(autoload 'tcl-help-on-word "tcl" "Help on Tcl commands" t)
(add-hook 'tcl-mode-hook 'tcl-auto-fill-mode)
(add-hook 'tcl-mode-hook 'tcl-guess-application)
(setq tcl-prompt-regexp "[-_a-zA-Z]+> \| [=>]+")
(add-hook 'inferior-tcl-mode-hook
(function (lambda ()
(define-key inferior-tcl-mode-map "\C-c\C-p"
'comint-previous-prompt ))))
(setq tcl-help-directory-list
(if lapdog-p
(list "/usr/tclX/7.5.0/help/tcl"
"/usr/tkX/4.1.0/help/tk")
(list "/usr/local/tclX/7.4a-p1/help/tcl"
"/usr/local/tkX/4.0a-p1/help/tk"))
)
;;}}}
;;{{{ dmacros: dynamic macros
(load-library "dmacro-prepare")
;;}}}
;;{{{ view processes
(load-library "view-ps-prepare")
(load-library "buff-sel")
;;}}}
;;{{{ imenu setup
(global-set-key "\M-\C-j" 'imenu)
(declare (special imenu-always-use-completion-buffer-p))
(setq imenu-always-use-completion-buffer-p t)
(autoload 'imenu-go-find-at-position "imenu-go"
"Go to the definition of the current word." t)
(autoload 'imenu-go--back "imenu-go"
"Return back to a position saved during `imenu-go-find-at-position'." t)
(global-set-key "\e\"" 'imenu-go-find-at-position)
;;}}}
;;{{{ term setup
(autoload 'tshell-mode "tshell" "shell in a terminal" t)
;;}}}
;;{{{ file at point
(require 'ffap)
(declare (special ffap-bindings
ffap-require-prefix))
(setq ffap-bindings
'(
(global-set-key "\M-M" 'ffap-menu)
(global-set-key "\M-L" 'ffap-next)
(global-set-key [S-mouse-3] 'ffap-at-mouse)
(global-set-key [C-S-mouse-3] 'ffap-menu)
(global-set-key "\C-x\C-f" 'find-file-at-point)
(global-set-key "\C-x4f" 'ffap-other-window)
(global-set-key "\C-x5f" 'ffap-other-frame)
)
)
(setq ffap-require-prefix nil)
(ffap-bindings)
(setq ffap-require-prefix t)
;;}}}
;;{{{ saveplace
(autoload 'toggle-save-place "saveplace" "saveplace" nil t)
(define-key ctl-x-map "p" 'toggle-save-place)
;;}}}
;;{{{ jde
(load-library "jde-prepare")
(load-library "prepare-javahelp")
(load-library "speedbar-prepare")
;;}}}
;;{{{ load yasb
(load-library "yasb-prepare")
;;}}}
;;{{{ mail spools
(load-library "mspools-prepare")
;;}}}
;;{{{ dismal
(load-library "prepare-dismal")
;;}}}
;;{{{ if using emacspeak, fix interactive functions:
;(and (featurep 'emacspeak)
;(emacspeak-fix-commands-that-use-interactive)
;)
;;}}}
(load-library "my-macros")
) ;end let
)
;;; So actually start it up:
(start-up-my-emacs)
(provide 'emacs-startup)
(shell-command "play ~/cues/sounds/highbells.au")
;;{{{ emacs local variables
;;;local variables:
;;;folded-file: t
;;;end:
;;}}}
--
Best Regards,
--raman
Adobe Systems Tel: 1 (408) 536 3945 (W14-612)
Advanced Technology Group Fax: 1 (408) 537 4042
(W14 129) 345 Park Avenue Email: raman@xxxxxxxxxxx
San Jose , CA 95110 -2704 Email: raman@xxxxxxxxxxx
http://labrador.corp.adobe.com/~raman/ (Adobe Intranet)
http://cs.cornell.edu/home/raman/raman.html (Cornell)
----------------------------------------------------------------------
Disclaimer: The opinions expressed are my own and in no way should be taken
as representative of my employer, Adobe Systems Inc.
____________________________________________________________
-----------------------------------------------------------------------------
To unsubscribe or change your address send mail to
"emacspeak-request@xxxxxxxxxxx" with a subject of "unsubscribe" or "help"
Emacspeak Files |
Subscribe |
Unsubscribe