;; Emacs initialization file
;;
;; turn off the scrollbar, the toolbar, and tooltips in menus
(set-scroll-bar-mode nil)
(tool-bar-mode)
(tooltip-mode)
;;
;; From the Red Hat Linux default .emacs
;;
;; Are we running XEmacs or Emacs?
(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
;; Turn on font-lock mode for Emacs
(cond ((not running-xemacs)
(global-font-lock-mode t)
))
;; Enable wheelmouse support by default
;;(cond (window-system
;; (mwheel-install)
;;))
;; Always end a file with a newline
(setq require-final-newline t)
;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
;; took this out because of errors in the php mode file
;; due to having emailed it. Need to reget the file.
;; (load-file "~/lisp/php-mode.el")
;;
;; below is from http://www.dotfiles.com/files/6/128_.emacs
;;
;; -*-emacs-lisp-*-
;; Author: K. Arun
;; File : $HOME/.emacs
;; Revision: $Id: .emacs,v 1.25 2000/06/17 07:07:44 kar Exp $
;; Paths
(setq load-path (cons "/usr/local/share/emacs/site-lisp" load-path))
(setq load-path (cons "/home/earthsid/lisp/" load-path))
(setq Info-default-directory-list '("~/lisp/info"
"/usr/local/lib/info"
"/usr/local/info"
"/usr/info"
"/usr/share/info"
))
;; Key bindings
(global-set-key [f1] 'manual-entry)
(global-set-key [f2] 'info)
;(global-set-key [f3] 'vm)
(global-set-key [f3] 'gnus)
(global-set-key [f4] 'kill-buffer)
(global-set-key [f5] 'find-file)
(global-set-key [f6] 'comment-region)
(global-set-key [f7] 'delete-frame)
(global-set-key [f8] 'insert-date);forward reference
(global-set-key [f9] 'ispell-buffer)
(global-set-key [f10] 'byte-compile-file) ;for .emacs, .gnus etc.
(global-set-key [f11] 'auto-fill-mode)
(global-set-key [f12] 'font-lock-mode)
(global-unset-key "\M-g")
(global-set-key "\M-g" 'goto-line)
(global-unset-key "\M-n")
(global-set-key "\M-n" 'make-frame-command) ; Mozilla's influence ;-)
(global-set-key "\C-cl" 'region-length);forward reference
;(global-set-key "\C-cp" 'cperl-perldoc)
(global-set-key "\C-cd" 'dos2unix);forward reference
;; DEFAULTS
;; Highlight marked region
(transient-mark-mode t)
;; Auto fill in all major modes
(setq-default auto-fill-function 'do-auto-fill)
;; Automagically read compressed files
(auto-compression-mode 1)
;; Automagically save bookmarks
(setq bookmark-save-flag 1)
;; Make mouse yank at point
(setq mouse-yank-at-point t)
;; Make searches case-insensitive
(setq case-fold-search t)
;; Man page pushiness
(setq Man-notify-method 'pushy)
;; Show line and column numbers in modeline
(line-number-mode t)
(column-number-mode t)
;; Font lock in all major modes
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
;; Don't add newlines to end of buffer when scrolling
(setq next-line-add-newlines nil)
;; Insert date into buffer
(defun insert-date ()
"Insert date at point."
(interactive)
(insert (format-time-string "%A, %B %e, %Y %k:%M:%S %z")))
;; Compute the length of the marked region
(defun region-length ()
"length of a region"
(interactive)
(message (format "%d" (- (region-end) (region-beginning)))))
;;
;; dos2unix and unix2dos from Benjamin Rutt's .emacs
;;
;; Convert a buffer from dos ^M end of lines to unix end
;; of lines...
(defun dos2unix ()
(interactive)
(goto-char (point-min))
(while (search-forward "\r" nil t) (replace-match "")))
;; ...vice versa
(defun unix2dos ()
(interactive)
(goto-char (point-min))
(while (search-forward "\n" nil t) (replace-match "\r\n")))
(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.
'(auto-compression-mode t nil (jka-compr))
'(case-fold-search t)
'(current-language-environment "Latin-9")
'(default-input-method "latin-9-prefix")
;; '(generic-define-unix-modes nil)
'(global-font-lock-mode t nil (font-lock))
;; '(show-paren-mode t nil (paren))
'(tab-width 4)
;; '(tooltip-mode f nil (tooltip))
'(transient-mark-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(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.
)
;; This is from the Linux kernel documentation
;; (Documentation/CodingStyle)....
(defun linux-c-mode ()
"C mode with adjusted defaults for use with the Linux kernel."
(interactive)
(c-mode)
(c-set-style "K&R")
(setq c-basic-offset 8))
;; This will define the M-x linux-c-mode command. When hacking on a
;; module, if you put the string -*- linux-c -*- somewhere on the
;; first two lines, this mode will be automatically invoked. Also, you
;; may want to add
(setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
auto-mode-alist))
;; to your .emacs file if you want to have linux-c-mode switched on
;; automagically when you edit source files under /usr/src/linux.
;; .... and this one MIGHT switch it on when editing under any linux
;; source tree?
(setq auto-mode-alist (cons '("linux.*/.*\\.[ch]$" . linux-c-mode)
auto-mode-alist))
;; from the GNU Emacs FAQ
;; (http://www.gnu.org/software/emacs/windows/big.html).
(defun set-buffer-file-eol-type (eol-type)
"Set the file end-of-line conversion type of the current buffer to
EOL-TYPE.
This means that when you save the buffer, line endings will be
converted
according to EOL-TYPE.
EOL-TYPE is one of three symbols:
unix (LF)
dos (CRLF)
mac (CR)
This function marks the buffer modified so that the succeeding
\\[save-buffer]
surely saves the buffer with EOL-TYPE. From a program, if you don't
want
to mark the buffer modified, use coding-system-change-eol-conversion
directly [weikart]."
(interactive "SEOL type for visited file (unix, dos, or mac): ")
(setq buffer-file-coding-system
(coding-system-change-eol-conversion
buffer-file-coding-system eol-type))
(set-buffer-modified-p t)
(force-mode-line-update))
(global-set-key "\^Cu" (lambda () (interactive)
(set-buffer-file-eol-type 'unix)))
(global-set-key "\^Cd" (lambda () (interactive)
(set-buffer-file-eol-type 'dos)))
(global-set-key "\^Cm" (lambda () (interactive)
(set-buffer-file-eol-type 'mac)))
;; Make the mode-line display the standard EOL-TYPE symbols (used
;; above)...
(setq eol-mnemonic-undecided "(?)" ;; unknown EOL type
eol-mnemonic-unix "(unix)" ;; LF
eol-mnemonic-dos "(dos)" ;; CRLF
eol-mnemonic-mac "(mac)") ;; CR
2004/09 2005/03 2005/04 2005/05 2005/06 2005/07 2005/08 2005/09 2005/10 2005/11 2006/01 2006/02 2006/04 2006/05 2006/06 2008/01
Subscribe to Posts [Atom]