Paste number 4085: .emacs

Paste number 4085: .emacs
Pasted by: swalters
When:17 years, 8 months ago
Share:Tweet this! |
Paste contents:
Raw Source | XML | Display As
 ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(case-fold-search t)
 '(current-language-environment "English")
 '(ecb-options-version "2.24")
 '(global-font-lock-mode t nil (font-lock))
 '(highline-face (quote highline-face))
 '(highline-line nil)
 '(quack-fontify-threesemi-p nil)
 '(transient-mark-mode t))
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(highline-face ((t (:weight bold))))
 '(quack-pltish-paren-face ((((class color) (background dark)) (:foreground "magenta" :weight bold)))))

;; set emacs to load from ~/elisp and its subdirectories
(add-to-list 'load-path "~/elisp")

(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
    (let* ((my-lisp-dir "~/elisp/")
	   (default-directory my-lisp-dir))
      (setq load-path (cons my-lisp-dir load-path))

(add-hook 'c-mode-common-hook
	  (function (lambda ()
		      (local-set-key (kbd "<tab>") 'indent-or-complete))))

(require 'allout)
(require 'filladapt)
(require 'highline)
(require 'emacs-wiki)
(require 'dircolors)
(require 'boxquote)
(require 'binclock)
(require 'color-theme)
(require 'igrep)
(require 'setnu)
(require 'stripes)
(require 'table)
(require 'tnt)
(require 'tramp)
(require 'keywiz)
(require 'menu-bar)
(require 'menu-bar-plus)
(require 'color-theme-maker)
(require 'ibuffer)
(require 'quack)

(tool-bar-mode 0)
(set-border-color "black")
(set-cursor-color "white")
(highline-mode 1)
(scroll-bar-mode 0)
(menu-bar-mode 0)
(blink-cursor-mode 1)
(auto-compression-mode 1)
(line-number-mode 1)
(column-number-mode 1)
(temp-buffer-resize-mode 1)
(resize-minibuffer-mode 1)
(setq display-time-and-date t)
;; Remove the annoying redundancy. When I type `y', I mean `y'.
(fset 'yes-or-no-p 'y-or-n-p)

;;turn on word wrap
(setq-default truncate-lines nil)
(setq-default truncate-partial-width-windows nil)

(setq inhibit-startup-message   t)   ; Don't want any startup message
(show-paren-mode t)
;;(setnu-mode t) ;setnu seems to have large problems with varous modes

;;; Backup files in one spot
(setq backup-directory-alist nil)
(setq backup-directory-alist
      (cons (cons "\\.*$" (expand-file-name "~/elisp/eback"))

;;;Bind any keys.
(global-set-key [ESC kp-home]  'beginning-of-buffer) ; [Home]
(global-set-key [ESC home]     'beginning-of-buffer) ; [Home]
(global-set-key [ESC kp-end]   'end-of-buffer)       ; [End]
(global-set-key [ESC end]      'end-of-buffer)       ; [End]
;;FIXME:  bind mode-line-other-buffer
;;FIXME:  bind delete-trailing-whitespace
;;FIXME:  bind delete-blank-lines
;;FIXME:  bind zap-to-char

;;; Change behaviour based on what type of display we have.

(when (and (equal window-system 'w32)
           (equal emacs-major-version 21))
  (defun fix-cursor ()
    "Fix the Emacs 21 cursor issue"
    (set-cursor-color "medium turquoise"))
  (add-hook 'emacs-startup-hook 'fix-cursor))

;; Console
(when (equal window-system nil)

;; Xwindows
(when (equal window-system 'x)

;; MS Windows
(when (equal window-system 'w32)

;; All Windowing Systems
(when window-system

;; Fixes a bug in the color-theme-select function
(when (= emacs-major-version 21)
  (defun color-theme-face-attr-construct (face frame)
    (if (atom face)
	(custom-face-attributes-get face frame)
      (if (and (consp face) (eq (car face) 'quote))
	  (custom-face-attributes-get (cadr face) frame)
	(custom-face-attributes-get (car face) frame)))))

;; GNU Emacs 21 Trailing Whitespace setup
(when (>= emacs-major-version 21)
  (setq-default show-trailing-whitespace t)

  (defun turn-off-show-trailing-whitespace ()
    "Turn on the highlighting of trailing whitespace in this buffer."
    (setq show-trailing-whitespace nil))

  (defun turn-on-show-trailing-whitespace ()
    "Turn off the highlighting of trailing whitespace in this buffer."
    (setq show-trailing-whitespace t))

  (defun toggle-show-trailing-whitespace ()
    "Toggle the highlighting of trailing whitespace in this buffer."
    (setq show-trailing-whitespace
          (not show-trailing-whitespace)))

  ;Turn off the whitespace highlighting in various modes.
  (let ((mode-hooks '(Buffer-menu-mode-hook custom-mode-hook
                                            term-mode-hook Info-mode-hook
                                            comint-mode-hook buffer-menu-mode-hook
                                            apropos-mode-hook tooltip-show-hook
                                            gnus-article-mode-hook mail-mode-hook
                                            gnus-summary-mode-hook message-mode-hook
                                            gnus-group-mode-hook eshell-mode-hook

    (mapcar '(lambda (mode-hook)
               (add-hook mode-hook 'turn-off-show-trailing-whitespace))

;; (toggle-truncate-lines -1)
;; (setq truncate-lines t)
;; (setq truncate-partial-width-windows t)

;;; Mode-Specific Setup

;; FIXME:figure out what each of these does.
(add-hook 'scheme-mode-hook
          ( function (lambda ()
                       (local-set-key [(control c) (control c)] 'comment-region )
                       (local-unset-key [(control c) (meta c)])
(add-hook 'scheme-mode-hook
          ( function (lambda ()
                       (setq folding-mode-marks-alist
			     (cons '(scheme-mode ";;{{{ " ";;}}}")
				   folding-mode-marks-alist))) ))

;; scheme-send-region adds to input history of scheme buffer
;; and then commands sent by C-c C-r will appear in scheme interpreter
;; buffer history so that you can then select them with M-p M-n
;; (look at In/Out section of menu in scheme buffer)
;; idea : emacswiki
(defadvice scheme-send-region (after scheme-store-in-history)
  "The region sent to the scheme process is also stored in the history."
  (let ((history (buffer-substring-no-properties start end)))
      (set-buffer scheme-buffer)
      (message history)
      (if (and (funcall comint-input-filter history)
               (or (null comint-input-ignoredups)
                   (not (ring-p comint-input-ring))
                   (ring-empty-p comint-input-ring)
                   (not (string-equal (ring-ref comint-input-ring 0)
          (ring-insert comint-input-ring history))
      (setq comint-save-input-ring-index comint-input-ring-index)
      (setq comint-input-ring-index nil))))
(ad-activate 'scheme-send-region)

(add-hook 'c-mode-hook
	  ( function (lambda ()
		       (auto-fill-mode 1)
		       (filladapt-mode 1)
		       (c-toggle-auto-hungry-state 1))))
(add-hook 'c++-mode-hook
	  ( function (lambda ()
		       (auto-fill-mode 1)
		       (filladapt-mode 1)
		       (c-toggle-auto-hungry-state 1))))

;;;; Generic Functions

;; (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)))

;; From LoadingLispFiles node of EmacsWiki
;;FIXME: See if there's a more reasonable way to handle errors.
;;FIXME: Move mode-specific data to new macro.
(defmacro with-library (package-symbol &rest body)
	(condition-case err
	    (require ',package-symbol)
	 (error (if (eq (car err) 'file-error)
		     (format "Package %s was not loaded. \"%s\""
			     (cadr err)) nil)
	  (error (message
		  (format "Error trying to process %s %s:\"%s\""
			  (car err) (cadr err))) nil))))
	(condition-case err
	  (error (message
		  (format "Error during processing of with-library %s %s:\"%s\""
			  (car err) (cadr err)))))))
  (put 'with-library 'lisp-indent-function 1)

(with-library asdf
  (global-set-key [(control tabasdfasdfasdf afsd)]       'tabbar-forward)
  (global-set-key [(control shift tab)] 'tabbar-backward)
  (global-set-key [(control shift iso-lefttab)] 'tabbar-backward)
  (global-set-key [(control f10)] 'tabbar-local-mode))

(with-library quack
  (setq-default show-trailing-whitespace t)
  (global-set-key [(control c) (g)] 'scheme-send-region)
  (global-set-key [(control c) (G)] 'scheme-send-region-and-go))

;; From
(defun numerotate-line ()
  (let ((P (point))
	(max (count-lines (point-min)(point-max)))
	(line 1))
    (goto-char (point-min))
    (while (< line max)
      (insert (format "%04d " line))
      (beginning-of-line 2)
      (setq line (+ line 1)))
    (goto-char P)))

;; From DosToUnix node on
(defun dos2unix (buffer)
  "Automate M-% C-q C-m RET C-q C-j RET"
  (interactive "*b")
    (goto-char (point-min))
    (while (search-forward (string ?\C-m) nil t)
      (replace-match (string ?\C-j) nil t))))

;; Found on PopupRuler node of
;; Soon to be superceded by ruler-mode in 21.3.50
;; change [f9] to the key you prefer to activate the ruler with.
;; (global-set-key [f9] 'my-column-ruler)
;;FIXME: Change to real 3-digit vertical numbering.
(defun column-ruler (width)
  "Display temp ruler at point."
  ;;The following fix was suggested on emacswiki
  (interactive `(,(- (window-width) 1)))
  ;;(interactive `(,(+ (window-hscroll)(window-width))))
   (if (< width 10)
       "1   5   10\n|...|....|\n"
     (let* ((iterations (/ width 10))
	    (short (- width (* 10 iterations)))
	    (result1 "|...|....|")
	    (result2 "1   5   10")
	    (inc1 "....|....|")
	    (inc2 "        %d0")
	    (i 1))
       (while  (< i iterations)
	 (setq i (1+ i))
	 (setq result1 (concat result1 inc1))
	 (setq result2 (concat result2 (substring (format inc2 i) -10))))
       (concat result2 "\n" result1 (substring inc1 0 short) "\n")))
   nil "[space] Clears ruler"))

;; Found on TheaterStyle node of
;; Removes the modeline.
;; Needs to be changed to a toggle.
(defun run-theater (command)
  "Open an Emacs frame with nothing other than the executed command."
  (interactive "CEnter command: ")
  (select-frame (new-frame '((width . 72) (height . 20)
			     (menu-bar-lines . 0)
			     (minibuffer . nil)
			     (toolbar . nil))))
  (setq-default mode-line-format nil)
  (call-interactively command))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.