;; This file is designed to be re-evaled; use the variable first-time ;; to avoid any problems with this. ;; See the sample .emacs file in FreeBSD Developer's Handbook ;; http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/emacs.html#AEN1181 (defvar first-time t "Flag signifying this is the first time that .emacs has been evaled") (add-to-list 'load-path "~/Emacs/muse") (add-to-list 'load-path "~/Emacs/haskell") (add-to-list 'load-path "~/cqual/share/emacs/site-lisp/cqual") (add-to-list 'load-path "~/Emacs") ;;;; Put scroll bar on the right (set-scroll-bar-mode 'right) ;;;; goto-line (global-set-key "\C-c\C-g" 'goto-line) ;;;; C-. to save a point C-, to jump between them (global-set-key [(control ?\.)] 'ska-point-to-register) (global-set-key [(control ?\,)] 'ska-jump-to-register) (defun ska-point-to-register() "Store cursorposition _fast_ in a register. Use ska-jump-to-register to jump back to the stored position." (interactive) (setq zmacs-region-stays t) (point-to-register 8) (message "Position saved")) (defun ska-jump-to-register() "Switches between current cursorposition and position that was stored with ska-point-to-register." (interactive) (setq zmacs-region-stays t) (let ((tmp (point-marker))) (jump-to-register 8) (set-register 8 tmp))) (setq inhibit-startup-message t) (setq require-final-newline t) ; assures the newline at eof (global-font-lock-mode t) ;;;; Enhance redo (require 'redo) (global-set-key "\M-z" 'redo) ;; A better menu helper: type ` M-x' (require 'icicles-menu) (global-set-key [?\e ?\M-x] 'icicle-execute-menu-command) ;; Session restores your history of input, your file position, etc. ;; It only restores recently changed files, but I can't get it right. (require 'session) (add-hook 'after-init-hook 'session-initialize) ;;;; Make a "recent file list" (require 'recentf) (recentf-mode 1) ;;;; Accelerate fontifying (setq font-lock-support-mode 'jit-lock-mode) (setq jit-lock-stealth-time 16 jit-lock-defer-contextually t jit-lock-stealth-nice 0.5) (setq-default font-lock-multiline t) ;;;; Back up to one directory, and keep version control (require 'backup-dir) ;; << The code failed ;; (setq ;; backup-by-copying t ; don't clobber symlinks ;; backup-directory-alist ;; '(("." . "/home/roy/.emacsbackup")) ; don't litter my fs tree ;; delete-old-versions t ;; kept-new-versions 3 ;; kept-old-versions 1 ;; version-control t) ; use versioned backups ;; (setq make-backup-files t) ;; >> ends here ;; loalize it for safety. (make-variable-buffer-local 'backup-inhibited) (setq bkup-backup-directory-info '((t "~/.emacsbackup" ok-create full-path prepend-name))) (setq delete-old-versions t kept-old-versions 1 kept-new-versions 3 version-control t) ;; Program Analysis Mode ;; I had to modify cqual-pam.el in order to load it using the command below (require 'cqual-pam) (require 'htmlize) ;;UnPdf (add-to-list 'auto-mode-alist '("\\.pdf\\'" . no-pdf)) (defun no-pdf () "Run pdftotext on the entire buffer." (interactive) (erase-buffer) (shell-command (concat "pdftotext " (buffer-file-name) " -") (current-buffer) t) (set-buffer-modified-p nil) (toggle-read-only t) (delete-other-windows) ) ;;;; Auto fill ;; M-q to reformat paragraph (add-hook 'text-mode-hook 'turn-on-auto-fill) ;; Cursor stretches over Tabs (setq x-stretch-cursor t) ;;;; Tuareg-mode for OCaml (setq load-path (cons "~/Emacs/tuareg-mode-1.45.4" load-path)) (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) (autoload 'camldebug "camldebug" "Run the Caml debugger" t) ;(autoload 'tuareg-imenu-set-imenu "tuareg-imenu" ; "Configuration of imenu for tuareg" t) (add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu) (setq auto-mode-alist (append '(("\\.ml[ily]?$" . tuareg-mode) ("\\.topml$" . tuareg-mode)) auto-mode-alist)) ;;;; Debugging CIL ;; Modified to accomodate changes in Tuareg-mode ;; Read "Debugging support" in the manual, http://manju.cs.berkeley.edu/cil/cil016.html ;; ALT-X my-camldebug ;; cilly --ocamldebug -c hello.c (defvar ocamldebug-history nil) (defun my-camldebug (command-line) "Run camldebug on program FILE in buffer *camldebug-FILE*. The directory containing FILE becomes the initial working directory and source-file directory for camldebug. If you wish to change this, use the camldebug commands `cd DIR' and `directory'." (interactive (list (read-from-minibuffer "Run ocamldebug (like this): " (if (consp ocamldebug-history) (car ocamldebug-history) "ocamldebug") nil nil '(ocamldebug-history . 1)))) (require 'camldebug) (camldebug-numeric-arg 1) (pop-to-buffer (concat "*camldebug*")) (setq words (split-string command-line)) (message "Current directory is %s" default-directory) (apply 'make-comint (cons "camldebug" (cons (car words) (cons nil (cdr words))))) (set-process-filter (get-buffer-process (current-buffer)) 'camldebug-filter) (set-process-sentinel (get-buffer-process (current-buffer)) 'camldebug-sentinel) (camldebug-mode) (camldebug-set-buffer)) ;;;; Muse ;; To customize M-x customize, then goto Hypermedia group. (require 'muse-mode) ; load authoring mode (require 'muse-html) ; load publishing styles I use ;(require 'muse-latex) ;(require 'muse-texinfo) ;(require 'muse-docbook) ; M-x muse-mode, then C-c C-t -> muse-publish-this-file (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(column-number-mode t) '(fill-column 80) '(haskell-hugs-program-name "~/hugs") '(kill-whole-line t) '(muse-html-header " <lisp> (concat (muse-publishing-directive \"title\") (let ((author (muse-publishing-directive \"author\"))) (if (not (string= author (user-full-name))) (concat \" (by \" author \")\"))))</lisp> muse-html-meta-http-equiv\" content=\"muse-html-meta-content-type\"> (let ((maintainer (muse-style-element :maintainer))) (when maintainer (concat \"\"))) ") '(show-paren-mode t nil (paren)) '(transient-mark-mode t)) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(pam-color-1 ((t (:foreground "olive drab" :underline t)))) '(pam-color-2 ((t (:foreground "turquoise" :underline t)))) '(pam-color-3 ((t (:foreground "greenyellow" :underline t)))) '(pam-color-4 ((t (:foreground "aquamarine" :underline t)))) '(pam-color-5 ((t (:foreground "purple" :underline t)))) '(pam-color-6 ((t (:foreground "red" :underline t)))) '(pam-color-7 ((t (:foreground "green" :underline t)))) '(pam-color-8 ((t (:foreground "maroon" :underline t)))) '(pam-color-locked ((t (:foreground "red" :underline t)))) '(pam-color-mouse ((t (:foreground "white" :background "grey" :underline t)))) '(pam-color-nonyear ((t (:foreground "MediumBlue" :underline t)))) '(pam-color-rcsdate ((t (:foreground "Green" :underline t)))) '(pam-color-tainted ((t (:foreground "red" :underline t)))) '(pam-color-unknown ((t (:foreground "purple" :underline t)))) '(pam-color-unlocked ((t (:foreground "green" :underline t)))) '(pam-color-untainted ((t (:foreground "green" :underline t)))) '(pam-color-ww50 ((t (:foreground "Red" :underline t)))) '(pam-color-yy ((t (:foreground "LightBlue" :underline t)))) '(pam-color-yyyy ((t (:foreground "GreenYellow" :underline t))))) ;;;; Haskell (setq auto-mode-alist (append auto-mode-alist '(("\\.[hg]s$" . haskell-mode) ("\\.hi$" . haskell-mode) ("\\.l[hg]s$" . literate-haskell-mode)))) (autoload 'haskell-mode "haskell-mode" "Major mode for editing Haskell scripts." t) (autoload 'literate-haskell-mode "haskell-mode" "Major mode for editing literate Haskell scripts." t) (add-hook 'haskell-mode-hook 'turn-on-haskell-font-lock) (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan) (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) ;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent) (add-hook 'haskell-mode-hook 'turn-on-haskell-hugs) ;; M-x desktop-save for the first time ;; Use session together with desktop ;; Put desktop at the bottom to make sure the restored files get correct mode!! (setq desktop-globals-to-save '(desktop-missing-file-warning)) ;; But desktop-missing-file-warning on my machine is nil, so no file is saved ;; Fall back to the original solution. (desktop-load-default) (setq history-length 250) (add-to-list 'desktop-globals-to-save 'file-name-history) (desktop-read) (setq desktop-enable t) ;;;; turn on debugging ;(setq debug-on-error t)