;; This is a startup file for 21.x XEmacs ;; It's called from ../.emacs ;; ;; (Georg Nikodym - WST Staff) ;; from site-start ;; common lisp extensions (require 'cl) (require 'custom) (require 'cus-load) (defvar target-buffer (get-buffer "*scratch*")) ;; C, C++, Java, etc (require 'cc-mode) (custom-set-variables '(c-mode-hook (function cscope-project:c-mode-hook)) '(c++-mode-hook (function cscope-project:c++-mode-hook)) '(next-line-add-newlines nil) '(auto-save-timeout 180 t) '(auto-save-interval 0) '(passwd-invert-frame-when-keyboard-grabbed nil) ) ;; Allows the compose key to work, thereby allowing us to do ;; accented characters (require 'x-compose) ;; set some keypad keys for Sun type-4 keyboard (define-key global-map 'f35 (function scroll-up)) ; PGUP (define-key global-map 'f29 (function scroll-down)) ; PGDN (define-key global-map '(control f35) (function forward-page)) ; CTRL-PGUP (define-key global-map '(control f29) (function backward-page)) ; CTRL-PGDN (define-key global-map 'f27 (function beginning-of-line)) ; HOME (define-key global-map 'r13 (function end-of-line)) ; END (define-key global-map 'f33 (function end-of-line)) ; END (define-key global-map '(control f27) (function (lambda () (interactive) (goto-char (point-min))))) (define-key global-map '(control r13) (function (lambda () (interactive) (goto-char (point-max))))) (define-key global-map 'f12 (function repeat-complex-command)) ; AGAIN (define-key global-map 'f14 (function advertised-undo)) ; UNDO (define-key global-map 'f16 (function x-copy-primary-selection)) ; COPY (define-key global-map 'f18 (function x-yank-clipboard-selection)) ; PASTE (define-key global-map 'f20 (function x-delete-primary-selection)) ; CUT ;; Some extras the Ron invented that we all like... (define-key global-map '(control up) (function enlarge-window)) ; CTRL-up (define-key global-map '(control down) (function shrink-window)) ; CTRL-down (global-set-key "\C-x\C-c" (function opcom-exit-from-emacs)) (defun opcom-exit-from-emacs () (interactive) (if (yes-or-no-p "Do you want to exit ") (save-buffers-kill-emacs))) ;; autoload the lisp directory tools (autoload (function format-lisp-code-directory) "lispdir" nil t) (autoload (function lisp-dir-apropos) "lispdir" nil t) (autoload (function lisp-dir-retrieve) "lispdir" nil t) (autoload (function lisp-dir-verify) "lispdir" nil t) ;; tar file support, if we use it (autoload (function tar-mode) "tar-mode" "Autoloaded: Major mode for tar files" t) (setq auto-mode-alist (cons '("\\.tar$" . tar-mode) auto-mode-alist)) ;; new method to handle compressed, packed *and* encrypted files. ;; needs work for svr4 (require 'crypt) (require 'efs-auto) ;; Super-Cite (autoload (function sc-cite-original) "supercite" "Supercite 3.1" t) (autoload (function sc-submit-bug-report) "supercite" "Supercite 3.1" t) (add-hook 'mail-citation-hook (function sc-cite-original)) (defvar sc-fixup-whitespace-p t) (defvar sc-citation-leader " ") (defvar sc-preferred-attribution-list '("sc-lastchoice" "x-attribution" "initials" "firstname" "emailname" "lastname")) ;; Fast-lock/font-lock ;(require 'font-lock) ;(load-library "fontlock-regexps") ;(autoload 'turn-on-fast-lock "fast-lock") ;; beep when mail arrives ;; ;(require 'reportmail) ;; Set auto-save characteristics... (require 'itimer) ;; GNATS stuff (autoload (function send-pr-mode) "send-pr" "Major mode for sending problem reports." t) (autoload (function send-pr) "send-pr" "Command to create and send a problem report." t) (autoload (function edit-pr) "gnats" "Command to edit a problem report." t) (autoload (function view-pr) "gnats" "Command to view a problem report." t) (autoload (function gnats-mode) "gnats" "Major mode for editing of problem reports." t) (autoload (function query-pr) "gnats" "Command to query information about problem reports." t) (defvar gnats-mailer 'vm-mail) ;; Stuff for PCL-CVS (defvar cvs-program "/ot/gnu_NEW/bin/cvs") (defvar cvs-diff-program "/ot/gnu_NEW/bin/diff") (defvar cvs-rmdir-program "/usr/bin/rmdir") ;; Cursor preference (setq bar-cursor nil) ;; BBDB Setup (autoload (function bbdb) "bbdb-com" "Insidious Big Brother Database" t) (autoload (function bbdb-name) "bbdb-com" "Insidious Big Brother Database" t) (autoload (function bbdb-company) "bbdb-com" "Insidious Big Brother Database" t) (autoload (function bbdb-net) "bbdb-com" "Insidious Big Brother Database" t) (autoload (function bbdb-notes) "bbdb-com" "Insidious Big Brother Database" t) (autoload (function bbdb-insinuate-vm) "bbdb-vm" "Hook BBDB into VM") (autoload (function bbdb-insinuate-rmail) "bbdb-rmail" "Hook BBDB into RMAIL") (autoload (function bbdb-insinuate-mh) "bbdb-mhe" "Hook BBDB into MH-E") (autoload (function bbdb-insinuate-gnus) "bbdb-gnus" "Hook BBDB into GNUS") (autoload (function bbdb-insinuate-sendmail) "bbdb" "Hook BBDB into sendmail") ;; autoload the VM (Visual Mail) reader (autoload (function vm) "vm" "Autoloaded: visual mail" t) (autoload (function vm-visit-folder) "vm" "Autoloaded: visual mail" t) ;; This causes Emacs lisp mode to be used when I load my .vm ;; or .xemacs-options file. ;; Setup some of my dot files for ksh-mode treatment. (mapcar (function (lambda (file) (or (assoc file auto-mode-alist) (setq auto-mode-alist (cons (cons file 'emacs-lisp-mode) auto-mode-alist))))) (list "\\.xemacs-options$" "\\.emacs-custom" "\\.vm$")) ;; Makefile support (or (assoc "\\([Mm]akefile.*\\|\\.mk$\\)" auto-mode-alist) (setq auto-mode-alist (cons '("\\([Mm]akefile.*\\|\\.mk$\\)" . makefile-mode) auto-mode-alist))) ;; Autoload ifdef lisp code (autoload (function insert-ifdef) "ifdef" nil t) (autoload (function insert-ifndef) "ifdef" nil t) ;; ASM mode setup (defvar asm-comment-char ?!) ;; Add X-Face function (defun opcom-add-x-face-header () "hook function to add X-Face: header (or whatever happens to be in ~/.xface" (require 'filladapt) (or (save-excursion (goto-char (point-min)) (looking-at "^resent-to:")) (save-excursion (let ((xfacefile (concat (getenv "HOME") "/.xface"))) (goto-char (point-min)) (re-search-forward mail-header-separator nil t) (beginning-of-line) (or (save-excursion (forward-line -3) (looking-at "^X-Face: ")) (insert-file xfacefile)))))) ;; This little ditty will provide a recycle symbol as a cursor in certain ;; situations. (if (featurep 'xpm) (let ((file (expand-file-name "recycle2.xpm" data-directory))) (if (condition-case nil (make-cursor file) (error nil)) (setq x-gc-pointer-shape file)))) ;; Function menu... ;(require 'func-menu) ;(define-key global-map 'f8 (function function-menu)) ;(add-hook 'find-file-hooks (function fume-add-menubar-entry)) ;(define-key global-map "\C-cg" (function fume-prompt-function-goto)) ;(define-key global-map '(shift button3) (function mouse-function-menu)) ;; Auto-resizing minibuffer (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t) (resize-minibuffer-mode) ;; passwd.el hack (require 'passwd) ;; w3 gateway info (defvar url-proxy-services '(("http" . "http://webcache.canada:8080/") ("ftp" . "ftp://webcache.canada:8080"))) ;; ipe/workshop stuff (if (member "/opcom/on28-tools/SUNWspro/SC4.2/bin" exec-path) (progn (setq load-path (append load-path '("/opcom/on28-tools/SUNWspro/SC4.2/lib"))) (load "workshop.el"))) (defun what-line-and-column () "Display current line number and column number in minibuffer" (interactive) (message "Line %d, Column %d" (1+ (count-lines (point-min) (point))) (current-column))) (define-key global-map "\M-=" (function what-line-and-column)) ;; Gnus definitions (setq mail-host-address "somanetworks.com" gnus-local-organization "SOMA Networks") (defvar gnus-use-generic-from t) (defvar gnus-startup-hook (function bbdb-insinuate-gnus)) (add-hook 'gnus-article-prepare-hook (function (lambda () (require 'highlight-headers) (set-face-underline-p 'message-highlighted-header-contents nil)))) (add-hook 'gnus-inews-article-hook (function opcom-add-x-face-header)) (autoload (function gnus) "gnus" "Read network news." t) (autoload (function gnus-post-news) "gnuspost" "Post a news." t) ;; Setup some of my dot files for ksh-mode treatment. (mapcar (function (lambda (file) (or (assoc file auto-mode-alist) (setq auto-mode-alist (cons (cons file 'ksh-mode) auto-mode-alist))))) (list "\\.kshrc$" "\\.setup-paths$" "\\.profile$" "\\.dtprofile")) (defvar ksh-indent 4) ; ; Init ; (setq focus-follows-mouse t) ;; Adaptive filling (require 'filladapt) (add-hook 'vm-mail-mode-hook (function turn-on-filladapt-mode)) (add-hook 'text-mode-hook (function turn-on-filladapt-mode)) (add-hook 'message-mode-hook (function turn-on-filladapt-mode)) (load-library "cscope-xtra.el") ;; Shell mode setup (defvar shell-completion-execonly nil) (defvar shell-prompt-pattern "^\\([^#%$>]*[#$%>]\\) *") (defvar shell-pushd-regexp "pd\\|pushd") (defvar shell-popd-regexp "pp\\|popd") (defvar comint-input-ring-file-name "") (defun my-shell-setup () (install-shell-fonts) (setq shell-dirstack-query "dirs") (set-face-foreground 'shell-input "green") (set-face-foreground 'shell-prompt "red") (set-face-font 'shell-prompt "lucidasanstypewriter-10") (if (and (not (null comint-input-ring-file-name)) (string-match ".sh_history" comint-input-ring-file-name)) (setq comint-input-ring-file-name nil))) (add-hook 'shell-mode-hook (function my-shell-setup)) (autoload (function install-shell-fonts) "shell-font" "Shell Fontify" t) ;; Start the server for gnuclient (gnuserv-start) ;; Keyboard macro to convert bcopy to memcpy (fset 'bcopy-convert [(control a) (meta x) i s e a r c h - f o r w a r d - r e g e x p return b c o p y (meta b) (control x) (control x) (control w) (meta d) m e m m o v e (control f) return (control s) \, (control b) (control d) return (control s) (control s) (control b) (control d) return (control a) (control p) (control k) (control k) (control p) (control y) (control p) (control e) \, escape ^ (control n) (control e) \, escape ^ (control n) escape ^ (control a) tab (control a) tab]) ;; Keyboard macro to convert bzero to memset (fset 'bzero-convert "dmemset, 0,  ") (defun my-bk-citool () (interactive) (start-process-shell-command "citool" nil "bk" "citool")) (defun my-bk-revtool () (interactive) (let ((file (buffer-file-name))) (if file (start-process-shell-command "revtool" nil "bk" "revtool" file) (start-process-shell-command "revtool" nil "bk" "revtool")))) ;; Some personal key preferences (define-key global-map 'f1 (function compile)) (define-key global-map '(meta g) (function goto-line)) (define-key global-map '(control \.) (function call-last-kbd-macro)) (define-key global-map '(control f1) (function my-bk-citool)) (define-key global-map '(control f2) (function my-bk-revtool)) ;; Mouse roller! (require 'mwheel) (mwheel-install) ;; BBDB setup... (defvar bbdb-file "~/.bbdb") (defvar bbdb-notice-auto-save-file t) (defun my-bbdb-init () (or (find-face 'bbdb-name) (face-differs-from-default-p (make-face 'bbdb-name)) (set-face-foreground 'bbdb-name "cyan"))) (add-hook 'bbdb-mode-hook (function my-bbdb-init)) (defun my-find-all-files (matching) (interactive "sFind all files matching (regexp): ") (let ((my-dirlist (directory-files default-directory nil matching nil t))) (while (car my-dirlist) (progn (if (not (or (string-equal (car my-dirlist) ".") (string-equal (car my-dirlist) ".."))) (find-file (car my-dirlist))) (setq my-dirlist (cdr my-dirlist)))))) ;; PCL-CVS Setup (make-face 'cvs-header-face) (make-face 'cvs-filename-face) (make-face 'cvs-status-face) (set-face-foreground 'cvs-header-face "light blue") (set-face-foreground 'cvs-filename-face "green") (set-face-foreground 'cvs-status-face "red") ;;(setq cvs-diff-flags '("-c")) ;; AWK mode temporary hack (defun ccify-awk-mode () (setq c-conditional-key c-C-conditional-key c-class-key c-C-class-key c-comment-start-regexp "/\\*")) (add-hook 'awk-mode-hook 'ccify-awk-mode) ;; Some additional compilation mode stuff... ;; This function is called when M-x compile goes to create the buffer. ;; It returns a name based on the buffer name of the caller. ;; The connection of this function to compile.el happens via custom. (defun my-gen-compilation-buffer-name (major-mode) "Creates a compilation buffer name based on the name of the caller's buffer." (let* ((foo (buffer-name)) (bar (substring foo 1 (- (length foo) 1)))) (if (string-match "compilation*" foo) foo (if (char-equal ?* (string-to-char foo)) (concat "*" bar "-compilation*") (concat "*" foo "-compilation*"))))) ;; ispell (defvar ispell-program-name "ispell") ;; Setup cstyle thingies (c-add-style "sunsoft" '((c-basic-offset . 8) (c-tab-always-indent . nil) (c-offsets-alist (arglist-cont . 4) (arglist-cont-nonempty . 4) (statement-cont . 4) (label . -1000))) t) (c-add-style "soma" '((c-basic-offset . 8) (c-tab-always-indent . nil)) t) ;; For GNUS (defvar browse-url-browser-function (function browse-url-netscape)) ;; func-menu (require 'func-menu) (define-key global-map 'f8 #'function-menu) (add-hook 'find-file-hooks #'fume-add-menubar-entry) (define-key global-map "\C-cl" #'fume-list-functions) (define-key global-map "\C-cg" #'fume-prompt-function-goto) (define-key global-map '(shift button3) #'mouse-function-menu) (define-key global-map '(meta button1) #'fume-mouse-function-goto) ;; Wack frame titles (setq frame-title-format (concat hostname ": %b")) ;; ADL mode (autoload (function adl-mode) "adl-mode") (or (assoc "\\.adl$" auto-mode-alist) (setq auto-mode-alist (cons '("\\.adl$" . adl-mode) auto-mode-alist))) ;; read abbrevs (if (file-exists-p "~/.xemacs-abbrevs") (quietly-read-abbrev-file "~/.xemacs-abbrevs")) ;; save place. ;; When you return to a file, this package will bring you ;; back to the point you left off. (setq-default save-place t) (require 'saveplace) ;; recent files (require 'recent-files) (recent-files-initialize) ;; Unique buffer names (require 'uniquify) ;; Balloon help ;(require 'balloon-help) ;(balloon-help-mode) ;; VC (require 'vc-hooks) ;; ctypes (defun my-activate-ctypes () (require 'ctypes) (setq ctypes-write-types-at-exit t) (ctypes-read-file nil nil t t) (ctypes-auto-parse-mode 1)) (add-hook 'c-mode-hook 'my-activate-ctypes) (add-hook 'c++-mode-hook 'my-activate-ctypes) ;; cscope-project (require 'cscope-project) ;; iswitchb (iswitchb-default-keybindings)