emacs configuration

elisp folder

total used in directory 577 available 129950416
drwxrwxrwx 1 user Domain Users 0 07-05 11:19 .
drwxrwxrwx 1 user Domain Users 0 07-29 13:31 ..
-rw-rw-rw- 1 user Domain Users 248669 2006-07-03 clearcase.el
-rw-rw-rw- 1 user Domain Users 79149 2010-08-13 csharp-mode.el
-rw-rw-rw- 1 user Domain Users 31496 2010-07-13 cygwin-mount.el
-rw-rw-rw- 1 user Domain Users 24621 2010-07-13 cygwin-mount.el.bad
-rw-rw-rw- 1 user Domain Users 12155 2009-10-01 devices.el
-r--r--r-- 1 user Domain Users 7179 2009-10-01 gnuserv-compat.el
-r--r--r-- 1 user Domain Users 29816 2009-10-01 gnuserv.el
-rw-rw-rw- 1 user Domain Users 7247 2006-07-03 imenu-go.el
-rw-rw-rw- 1 user Domain Users 1382 2006-07-03 insert-box-suffix.el
-rw-rw-rw- 1 user Domain Users 1381 2006-07-03 insert-box.el
-rw-rw-rw- 1 user Domain Users 10347 2010-08-06 interface.el
-rw-rw-rw- 1 user Domain Users 130198 2004-06-11 p4.el
-rw-rw-rw- 1 user Domain Users 7152 2010-04-07 safescrollmouse.el


.emacs file

(setq load-path (append (list "C:/cygwin/home/Username/elisp"
)
load-path))

(setq inhibit-startup-message t)

;(setq debug-on-error t)


(load-library "p4")

;; delay middle mouse button paste
(load "safescrollmouse")
(safescrollmouse-install)

;;;;
;;;; cygwin support
;;;;

;; Sets your shell to use cygwin's bash, if Emacs finds it's running
;; under Windows and c:\cygwin exists. Assumes that C:\cygwin\bin is
;; not already in your Windows Path (it generally should not be).
;;
(let* ((cygwin-root "c:/cygwin")
(cygwin-bin (concat cygwin-root "/bin")))
(when (and (eq 'windows-nt system-type)
(file-readable-p cygwin-root))

(setq exec-path (cons cygwin-bin exec-path))
(setenv "PATH" (concat cygwin-bin
";"
"/usr/bin:"
"/cygdrive/c/WINDOWS/system32:"
(getenv "PATH")))

;; By default use the Windows HOME.
;; Otherwise, uncomment below to set a HOME
(setenv "HOME" (concat cygwin-root "/home/Username"))

;; NT-emacs assumes a Windows shell. Change to baash.
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)

(setq exec-path (append (list
"c:/cygwin"
"c:/cygwin/bin"
"/usr/bin"
"c:/cygwin/usr/local/bin"
)
exec-path))

;; This removes unsightly ^M characters that would otherwise
;; appear in the output of java applications.
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)))

;; environment setups
;(progn
; (setenv "HOME" "c:/cygwin/home/Username")
; (setenv "USERNAME" "machine")
; below used by compile "make, grep...."
; (setenv "PATH" (concat "/usr/bin:"
; "/cygdrive/c/WINDOWS/system32:"
; (getenv "PATH")))
; (setenv "WIND_BASE" "C:/Tornado")
; (setenv "WIND_HOST_TYPE" "x86-win32"))

; shell stuff
; For the interactive shell
; (setq explicit-shell-file-name "c:\cygnus\cygwin-b20\cygnus.bat")
; For subprocesses invoked via the shell (e.g., "shell -c command")
;(setq shell-file-name "C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\sh.exe")
(progn
(setq shell-file-name "bash.exe")
(setq explicit-shell-file-name shell-file-name)
(setq explicit-sh-args '("-i"))
(setq shell-command-switch "-c")
(setenv "SHELL" shell-file-name)
(setq win32-quote-process-args t)
(setq win32-enable-italics t)
(setq comint-process-echoes nil)
)

;; cygwin
(require 'cygwin-mount)
(require 'csharp-mode)

(cygwin-mount-activate)

(add-hook 'comint-output-filter-functions
'shell-strip-ctrl-m nil t)
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt nil t)

(setq shell-file-name explicit-shell-file-name)

;; c++ mode list
(setq auto-mode-alist (append
'(("\\.hpp$" . c++-mode)
("\\.el$" . emacs-lisp-mode)
("\\.tex$" . latex-mode)
("\\.texinfo$" . texinfo-mode)
("\\.lsp$" . lisp-mode)
("\\.scm$" . lisp-mode)
("\\.pl$" . perl-mode)
("\\.pm$" . perl-mode)
("\\.html$" . html-helper-mode)
("\\.cs$" . csharp-mode)
("\\.java$" . java-mode))
auto-mode-alist))

; csharp
;(defun my-csharp-mode-fn ()
; "function that runs when csharp-mode is initialized for a buffer."
; ...insert your code here...
; ...most commonly, your custom key bindings ...
;)
;(add-hook 'csharp-mode-hook 'my-csharp-mode-fn t)

;; restore space
(if (>= emacs-major-version 22)
(if partial-completion-mode
(progn
(define-key minibuffer-local-must-match-filename-map
(kbd "SPC") 'PC-complete-word)
(define-key minibuffer-local-filename-completion-map
(kbd "SPC") 'PC-complete-word))
(define-key minibuffer-local-must-match-filename-map
(kbd "SPC") 'minibuffer-complete-word)
(define-key minibuffer-local-filename-completion-map
(kbd "SPC") 'minibuffer-complete-word)))


;; C# style
(defconst csharp-style
'(
(c-set-style . "java")
(c-hanging-braces-alist . ((brace-list-open before after)
(block-open before after)
(substatement-open before after)
(block-close . c-snug-do-while)
(statement-case-open before after)
(brace-list-intro before after)
(brace-list-entry before after)
))
(substatement-open . 0)
(c-indent-level 4)
(c-brace-imaginary-offset 0)
(c-brace-offset -4)
(c-argdecl-indent 4)
(c-label-offset -4)
;(c-continued-statement-offset 4)
(indent-tabs-mode nil)
(c-tab-width . 4)
(c-basic-offset . 4)
(comment-multi-line t)
)
"C# Style"
)

;; C/C++/Java/C# Mode
(defun my-c-mode-common-hook ()
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-cont 4)
(c-set-offset 'topmost-intro-cont 0)
(c-set-offset 'block-open 0)
(c-set-offset 'arglist-intro 4)
(c-set-offset 'arglist-cont-nonempty 4)
;(local-unset-key (kbd "{"))
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


;;================================================ ============
;; minibuffer space completion
;;================================================ ============
(define-key minibuffer-local-filename-completion-map (kbd "SPC")
'minibuffer-complete-word)

(define-key minibuffer-local-must-match-filename-map (kbd "SPC")
'minibuffer-complete-word)

(load "interface")
(autoload 'insert-box "insert-box" "insert at beginning or end of a line" t)
(autoload 'insert-suffix "insert-box" "insert at beginning or end of a line" t)

(setq make-backup-files nil) ; do NOT make backup files
(line-number-mode 1)
(setq visible-bell t)
(scroll-bar-mode -1) ; no scroll bars for windows
(setq query-replace-highlight t) ; highlight query replace
(setq ispell-highlight t)
(setq search-highlight t)
(setq text-mode-hook '(lambda () (auto-fill-mode 1)))
(setq buffers-menu-max-size 30)
(setq default-major-mode 'text-mode)
(add-hook 'mail-setup-hook 'mail-abbrevs-setup)
(setq find-grep-options "-n")
(setq grep-find-command "find . -type d '(' -name .kwlp -o -name .kwps -o -name .svn ')' -prune -o -type f -name '*.[shcparm]*'| xargs grep -n -e ")
;(setq grep-find-command "find . -type f -print | grep -v '.kwlp'| grep -v '.kwps'| xargs grep -n -e ")
(setq grep-command "grep -E -n -e ")
;(setq grep-command "find . -type f -print | xargs grep -E -n -e ")
(setq compilation-window-height 20)
;;; imenu setups ...
(setq imenu-max-items 50) ;; imenu buffer size
(setq ediff-diff-option "-w")
(setq imenu-sort-function 'imenu--sort-by-name)
(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)

;;; and bindings like

(global-set-key [M-S-mouse-2] 'imenu-go-find-at-position)
(global-set-key "\e\"" 'imenu-go-find-at-position)
(global-set-key [M-S-C-mouse-2] 'imenu-go--back)
(global-set-key "\e'" 'imenu-go--back) ; Conflicts with defined key.
;(global-set-key [?\C-\"] 'imenu-go--back)

;;; to your .emacs file. The usability if this package decreases a lot
;;; unless you have a simple access to `imenu', like in

(global-set-key [M-S-down-mouse-3] 'imenu)

;(setq lpr-switches '("-P" "YOUR_DOUBLE_SIDED_QUEUE_HERE"))
;(setq printer-name "//bcarydbd/Tek 360") ; network printer
;(setq printer-name "//prntsrv2/Research") ; network printer
(setq printer-name "//prntsrv2/SPAN1") ; network printer
(setq ps-line-number t)
(eval-expression (quote (setq c-macro-preprocessor "D:/cygwin/bin/cpp.exe -C")) nil)
;(setq tags-file-name "~/elisp/TAGS")
(defun compilation-buffer-name-uniquely (major-mode-name) ; generate *almost* unique names for compilation buffer
(concat "*" (downcase major-mode-name) "-" (buffer-name) "*")
) ; compilation-buffer-name-uniquely
(setq compilation-buffer-name-function 'compilation-buffer-name-uniquely)
;; general environment variables setup
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(uniquify-buffer-name-style (quote post-forward) nil (uniquify))

)


(mykeypad)

(defconst my-c-style
'(
(c-tab-always-indent . t)
(c-hanging-braces-alist . ((brace-list-open before after)
(block-open before after)
(substatement-open before after)
(block-close . c-snug-do-while)
(statement-case-open before after)
(brace-list-intro before after)
(brace-list-entry before after)
))
(c-hanging-colons-alist . ((label after)
(case-label after)
))
(c-offsets-alist . ((statement . 0)
; (access-label . 0) ; inclass 'public'
; (topmost-intro . 3) ; top level indent
(statement-cont . 0)
(block-open . 0)
(brace-list-open . 0)
(brace-list-intro . 3)
(brace-list-entry . 0)
(statement-block-intro . 3)
(statement-case-intro . 3)
(statement-case-open . 0)
(defun-block-intro . 3)
(substatement . 3)
(substatement-open . 0)
(label . 3)
(case-label . 3)
(inline-open . 0)
(arglist-cont-nonempty
. c-lineup-arglist)
(arglist-close
. c-lineup-arglist-close-under-paren)
(arglist-intro
. c-lineup-arglist-intro-after-paren)
(arglist-cont
. c-lineup-arglist-intro-after-paren)
))
(c-echo-syntactic-information-p . t)
(c-hanging-comment-ender-p . nil)
(c-hanging-comment-starter-p . nil)
(fill-column . 80)
(tab-width . 3)
(c-basic-offset . 3)
(comment-column . 45)
(indent-tabs-mode . nil)
(c-macro-prompt-flag . t)
)
"Personal C Programming Style")

;(setq text-mode-hook '(lambda () (auto-fill-mode 1) (font-lock-mode 1) (font-lock-fontify-buffer)))
(add-hook 'dired-mode-hook '(lambda () (font-lock-mode 1) (font-lock-fontify-buffer)))
(add-hook 'shell-mode-hook '(lambda () (font-lock-mode 1) (font-lock-fontify-buffer)))
;(add-hook 'c-mode-hook '(lambda () (font-lock-mode 1) (font-lock-fontify-buffer)))
(add-hook 'c-mode-hook (lambda ()
(setq c-basic-offset 3)
(setq c-macro-prompt-flag t)
(setq indent-tabs-mode nil)
(imenu-add-to-menubar "Functions")
(c-add-style "PERSONAL" my-c-style t)
(font-lock-mode 1) (font-lock-fontify-buffer)))
(add-hook 'c++-mode-hook (lambda ()
(setq c-basic-offset 3)
(setq c-macro-prompt-flag t)
(setq indent-tabs-mode nil)
(c-add-style "PERSONAL" my-c-style t)
(imenu-add-to-menubar "Functions")
(font-lock-mode 1) (font-lock-fontify-buffer)))
;(setq text-mode-hook '(lambda () (auto-fill-mode 1)))
(setq default-major-mode 'text-mode)
(setq c-macro-cppflags "-I /Tornado/target/h ")
(setq c-brace-offset 0)
(setq c-brace-imaginary-offset 0)

;; prevent accidently kill the shell buffer
(add-hook 'shell-mode-hook
(lambda()
;; make-local-hook doesn't work (yet?) for 'kill-buffer-hook,
;; so use make-local-variable instead:
(make-local-variable 'kill-buffer-hook)
(add-hook 'kill-buffer-hook
(function (lambda ()
(if (y-or-n-p
(format "Are you sure? "))
(message "");i.e. go ahead, and clear
; minibuffer
(error "Not killing shell buffer")))))))

;; gnus stuff
;(setq gnus-check-new-newsgroups nil)
;(setq gnus-read-active-file 'some)
;(setq gnus-thread-hide-subtree t)
;(setq user-full-name "colin")
;(setq user-mail-address "colin@spamthere.com") ;; mail-host-address
;(setq user-real-login-name "new")


;;;;SuperCite
(autoload 'sc-cite-original "supercite" "Supercite 3.1" t)
(autoload 'sc-submit-bug-report "supercite" "Supercite 3.1" t)
(add-hook 'mail-citation-hook 'sc-cite-original)
(setq news-reply-header-hook nil)
(setq sc-cite-region-limit t)
(setq-default sc-citation-leader " ")
(setq sc-auto-fill-region-p nil)

No comments: