All pastes #605083 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-05 22:54 UTC
rendered paste body
;; CUSTOM VARS
(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.
 '(column-number-mode t)
 '(display-battery-mode t)
 '(display-time-mode t)
 '(ecb-options-version "2.32")
 '(fringe-mode 0 nil (fringe))
 '(menu-bar-mode t)
 '(scroll-bar-mode (quote right))
 '(show-paren-mode t)
 '(tool-bar-mode nil)
 '(transient-mark-mode t))
;; END CUSTOM VARS
(setq load-path (cons  "/home/mog/.emacs.d" load-path))
;; ERLANG GOODNESS
;;(setq load-path (cons "/usr/local/lib/erlang/lib/tools-2.5.4/emacs" load-path))
(setq erlang-root-dir "/usr/local/lib/erlang")
(setq exec-path (cons "/usr/local/lib/erlang/bin" exec-path))
(require 'erlang-start)
(add-hook 'erlang-mode-hook '(lambda()
			       (local-set-key (kbd "\C-c\C-c")  'comment-or-uncomment-region)
			       (local-set-key (kbd "<tab>") 'indent-or-complete)
			       (local-set-key (kbd "C-c C-;") 'erlang-next-error)
			       (turn-on-stripes-mode)
			       ;; when starting an Erlang shell in Emacs emacs
			       (setq inferior-erlang-machine-options '("-sname" "emacs"))
			       ;; add Erlang functions to an imenu menu
			       (imenu-add-to-menubar "imenu")
			       (flyspell-prog-mode)
			       (setq indent-tabs-mode nil)
			       (setq erlang-electric-commands
				     '(erlang-electric-comma
				       erlang-electric-semicolon
				       erlang-electric-gt
				       erlang-electric-newline)
				     )
			       )
	  )
(add-hook 'sgml-mode-hook
          '(lambda ()
	     (flyspell-prog-mode)		      
	     (turn-on-stripes-mode)
	     (xml-lite-mode)))
;; xml-lite
(require 'xml-lite)
(require 'two-mode-mode)
(or (assoc "\\.yaws$" auto-mode-alist)
    (setq auto-mode-alist (cons '("\\.yaws$" . two-mode-mode)
                                auto-mode-alist)))
;; END ERLANG GOODNESS
;; C MODE
(autoload 'linux-c-mode "linux-c-mode" "Normal editing mode." t)
(global-font-lock-mode t)
(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))
(setq auto-mode-alist (cons '("\\.[ch]$" . linux-c-mode)
			    auto-mode-alist)) 
(add-hook 'c-mode-hook
	  (function (lambda ()
		      (local-set-key (kbd "<tab>") 'indent-or-complete)
		      (local-set-key (kbd "\C-c\C-c") 'comment-or-uncomment-region)
		      (turn-on-stripes-mode)
		      (flyspell-prog-mode)
		      (imenu-add-to-menubar "imenu")))
		      ))
)
;; END C MODE
;;RUBY MODE
(add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))
(add-hook 'ruby-mode-hook
	  (function (lambda ()
		      (flyspell-prog-mode)		      
		      (turn-on-stripes-mode)
		      (local-set-key (kbd "<tab>") 'indent-or-complete)
		      (imenu-add-to-menubar "imenu")
		      (local-set-key (kbd "\C-c\C-c") 'comment-or-uncomment-region))))
;;RUBY MODE
;;MISC MODES
(add-hook 'cperl-mode-hook (function (lambda () (flyspell-prog-mode))))
(add-hook 'autoconf-mode-hook (function (lambda () (flyspell-prog-mode))))
(add-hook 'autotest-mode-hook (function (lambda () (flyspell-prog-mode))))
(add-hook 'sh-mode-hook (function (lambda () (flyspell-prog-mode))))
(add-hook 'c++-mode-hook
	  (function (lambda ()
		      (flyspell-prog-mode)		      
		      (turn-on-stripes-mode)
		      (local-set-key (kbd "<tab>") 'indent-or-complete)
		      (imenu-add-to-menubar "imenu")
		      (local-set-key (kbd "\C-c\C-c") 'comment-or-uncomment-region))))
(add-hook 'makefile-mode-hook
	  (function (lambda ()
		      (turn-on-stripes-mode)
		      (flyspell-prog-mode)
		      (local-set-key (kbd "<tab>") 'indent-or-complete)
		      (imenu-add-to-menubar "imenu")
		      (local-set-key (kbd "\C-c\C-c")  'comment-or-uncomment-region))))
(add-hook 'vhdl-mode-hook
	  (function (lambda ()
		      (turn-on-stripes-mode)
		      (flyspell-prog-mode)
		      (local-set-key (kbd "<tab>") 'indent-or-complete)
		      (imenu-add-to-menubar "imenu")
		      (local-set-key (kbd "\C-c\C-c")  'comment-or-uncomment-region))))
;;MISC MODES
;; GENERAL GUI GOODNESS
(require 'saveplace)
(require 'stripes)
(require 'vc-git)
(when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git))
(require 'git)
(require 'git-blame)
;;(require 'tramp)
;;(require 'w3m-load)
(require 'recentf)
(recentf-mode 1) 

(add-to-list 'vc-handled-backends 'GIT)
;;(require 'highlight-parentheses)
(setq-default save-place t)
(setq user-mail-address "mog@rldn.net")
(setq user-full-name "Matthew O'Gorman")
(setq show-paren-style 'mixed)
(fset 'yes-or-no-p 'y-or-n-p)
(load "gnuserv-compat")
(load-library "gnuserv")
(gnuserv-start)
(setq inhibit-startup-message t)
(setq visible-bell t)
(setq require-final-newline t)
(setq frame-title-format "%b")
(setq next-line-add-newlines nil)
;;(setq-default pop-up-frames t) ;; not needed for frames
(defun make-backup-file-name (file) (concat "/tmp/" (file-name-nondirectory file)))
(defun my-turn-on-flyspell () (flyspell-mode 1))
(easy-mmode-define-global-mode 
 global-flyspell-mode flyspell-mode my-turn-on-flyspell)
(global-flyspell-mode 1)
(require 'tabbar)
(set-face-attribute
 'tabbar-default-face nil
 :background "gray60")
(set-face-attribute
 'tabbar-unselected-face nil
 :background "gray85"
 :foreground "gray30"
 :box nil)
(set-face-attribute
 'tabbar-selected-face nil
 :background "#f2f2f6"
 :foreground "black"
 :box nil)
(set-face-attribute
 'tabbar-button-face nil
 :box '(:line-width 1 :color "gray72" :style released-button))
(set-face-attribute
 'tabbar-separator-face nil
 :height 0.7)
(defun tabbar-buffer-groups (buffer)
  "Return the list of group names BUFFER belongs to.
 Return only one group for each buffer."
  (with-current-buffer (get-buffer buffer)
    (cond
     ((or (get-buffer-process (current-buffer))
	  (memq major-mode
		'(comint-mode compilation-mode)))
      '("Main")
      )
     ((member (buffer-name)
	      '("*scratch*"))
      '("Misc")
      )
     ((member (buffer-name)
	      '("*vc-change-log*"))
      '("Misc")
      )
     ((member (buffer-name)
	      '("TAGS"))
      '("Misc")
      )
     ((member (buffer-name)
	      '("*Completions*"))
      '("Misc")
      )
     ((member (buffer-name)
	      '("*Messages*"))
      '("Misc")
      )
     ((eq major-mode 'dired-mode)
      '("Main")
      )
     ((memq major-mode
	    '(fundamental-mode help-mode apropos-mode Info-mode Man-mode))
      '("Misc")
      )
     ((memq major-mode
	    '(tex-mode latex-mode text-mode xml-mode))
      '("Main")
      )
     ((memq major-mode
	    '(rmail-mode
	      rmail-edit-mode vm-summary-mode vm-mode mail-mode
	      mh-letter-mode mh-show-mode mh-folder-mode
	      gnus-summary-mode message-mode gnus-group-mode
	      gnus-article-mode score-mode gnus-browse-killed-mode))
      '("Mail")
      )
     (t
      '("Main")
      )
     )))
(tabbar-mode 1)
;;GUI END
;;KEY
(global-set-key [(control shift iso-lefttab)] 'tabbar-backward-tab)
(global-set-key [(control tab)]       'tabbar-forward-tab)
(global-set-key "\C-l" 'goto-line)
(global-set-key "\C-c\C-c" 'comment-or-uncomment-region)
(global-set-key "\C-x r k" 'kill-rectangle)
(global-set-key "\C-x r y" 'yank-rectangle)
(global-set-key "\C-x r c" 'clear-rectangle)
(global-set-key "\C-x r o" 'open-rectangle)
(global-set-key "\C-x r i" 'string-insert-rectangle)
;;KEY END
(defun indent-or-complete ()
  "Complete if point is at end of a word, otherwise indent line."
  (interactive)
  (if (looking-at "\\>")
      (dabbrev-expand nil)
    (indent-for-tab-command)
    ))


(defun recentf-filtered-list (arg)
  "Return a filtered list of ARG recentf items."
    (recentf-apply-menu-filter
     recentf-menu-filter
     (mapcar 'recentf-make-default-menu-element
	     (butlast recentf-list (- (length recentf-list) arg)))))

(defun recentf-list-submenus (arg)
  "Return a list of the recentf submenu names."
  (if (listp (cdar (recentf-filtered-list arg))) ; submenues exist
      (delq nil (mapcar 'car (recentf-filtered-list arg)))))

(defmacro recentf-list-entries (fn arg)
  "Return a list of ARG recentf menu entries as determined by FN.
When FN is `'car' return the menu entry names, when FN is `'cdr'
return the absolute file names."
  `(mapcar (lambda (x) (mapcar ,fn x))
	   (if (recentf-list-submenus ,arg)
	       (mapcar 'cdr (recentf-filtered-list ,arg))
	     (list (recentf-filtered-list ,arg)))))

;; This function is not specific to recentf mode but is needed by
;; `recentf-minibuffer-dialog'.  I've also made enough use of it in
;; other contexts that I'm surprised it's not part of Emacs, and the
;; fact that it isn't makes me wonder if there's a preferred way of
;; doing what I use this function for.
(defun recentf-memindex (mem l)
  "Return the index of MEM in list L."
  (let ((mempos -1) ret)
    (while (eq ret nil)
      (setq mempos (1+ mempos))
      (when (equal (car l) mem) (setq ret mempos))
      (setq l (cdr l)))
    ret))
;; END GENERAL GUI GOODNESS