[0aa69a] | 1 | ;;; Emacs edit mode for this file is -*- Emacs-Lisp -*- |
---|
[b1b8e3] | 2 | ;;; $Id: .emacs-general,v 1.3 2000-06-09 10:55:03 obachman Exp $ |
---|
[0aa69a] | 3 | |
---|
| 4 | ;;; |
---|
| 5 | ;;; .emacs-general - Emacs initialization file for general emacs |
---|
| 6 | ;;; settings which have nothing to do with the |
---|
| 7 | ;;; singular-emacs mode, but which we recommend |
---|
| 8 | ;;; nevertheless, so that your emacs is more useful. |
---|
| 9 | ;;; |
---|
| 10 | ;;; This file is loaded by .emacs-singular, if it exists in your home directory |
---|
| 11 | ;;; or in the singular-emacs directory. |
---|
| 12 | ;;; |
---|
| 13 | ;;; If you have your own .emacs file, you might consider copying |
---|
| 14 | ;;; this file to your home directory and then load it from your .emacs |
---|
| 15 | ;;; file with: (load-file "~/.emacs-general") |
---|
| 16 | ;;; |
---|
| 17 | ;;; |
---|
| 18 | |
---|
| 19 | ;; a handy function for customizing the face of point |
---|
| 20 | (defun customize-face-at-point () |
---|
| 21 | "Customize face which point is at." |
---|
| 22 | (interactive) |
---|
| 23 | (let ((face (get-text-property (point) 'face))) |
---|
| 24 | (if face |
---|
| 25 | (customize-face face) |
---|
| 26 | (message "No face defined at point")))) |
---|
| 27 | |
---|
| 28 | ;; I love font-lock mode |
---|
| 29 | (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock) |
---|
| 30 | (add-hook 'lisp-mode-hook 'turn-on-font-lock) |
---|
| 31 | (add-hook 'c-mode-hook 'turn-on-font-lock) |
---|
| 32 | (add-hook 'c++-mode-hook 'turn-on-font-lock) |
---|
| 33 | (add-hook 'perl-mode-hook 'turn-on-font-lock) |
---|
| 34 | (add-hook 'tex-mode-hook 'turn-on-font-lock) |
---|
| 35 | (add-hook 'texinfo-mode-hook 'turn-on-font-lock) |
---|
| 36 | (add-hook 'postscript-mode-hook 'turn-on-font-lock) |
---|
| 37 | (add-hook 'dired-mode-hook 'turn-on-font-lock) |
---|
| 38 | (add-hook 'ada-mode-hook 'turn-on-font-lock) |
---|
| 39 | (add-hook 'TeX-mode-hook 'turn-on-font-lock) |
---|
| 40 | (add-hook 'shell-mode-hook 'turn-on-font-lock) |
---|
| 41 | |
---|
[be70a74] | 42 | ;;; |
---|
| 43 | ;;; settings for both Emacs and XEmacs |
---|
| 44 | ;;; |
---|
| 45 | (custom-set-variables |
---|
| 46 | '(next-line-add-newlines nil) |
---|
| 47 | '(require-final-newline nil) |
---|
| 48 | '(line-number-mode t) |
---|
| 49 | '(kill-whole-line t) |
---|
[b1b8e3] | 50 | '(truncate-lines t) |
---|
[be70a74] | 51 | ; I like unique buffer names based on dirs |
---|
| 52 | '(uniquify-buffer-name-style 'post-forward-angle-brackets)) |
---|
| 53 | |
---|
| 54 | (require 'uniquify) |
---|
| 55 | |
---|
[0aa69a] | 56 | (cond ((string-match "XEmacs\\|Lucid" emacs-version) |
---|
[be70a74] | 57 | ;; |
---|
[0aa69a] | 58 | ;; XEmacs specific stuff |
---|
[be70a74] | 59 | ;; |
---|
[0aa69a] | 60 | |
---|
| 61 | ;; I like some more keybindings for better moving |
---|
[be70a74] | 62 | (define-key global-map '(control up) |
---|
[0aa69a] | 63 | '(lambda () (interactive) (scroll-up -1))) |
---|
| 64 | ;; control-, scrolls up |
---|
[be70a74] | 65 | (define-key global-map '(control down) |
---|
[0aa69a] | 66 | '(lambda () (interactive) (scroll-up 1))) |
---|
| 67 | |
---|
| 68 | ;; a function which on C-= reload a file automatically without |
---|
| 69 | ;; asking for confirmation got it from From: Richard Mlynarik |
---|
| 70 | ;; <mly@adoc.xerox.com> on 1/18/95 |
---|
[be70a74] | 71 | ;; find-alternate-file (C-x C-v) is almost equivalent |
---|
[0aa69a] | 72 | (global-set-key [(control =)] '(lambda () |
---|
| 73 | (interactive) |
---|
| 74 | (or (verify-visited-file-modtime |
---|
| 75 | (current-buffer)) |
---|
| 76 | (revert-buffer t t)))) |
---|
| 77 | ;; turn on auto-compression of gz files |
---|
| 78 | (toggle-auto-compression 1) |
---|
| 79 | |
---|
| 80 | ;; Use the "Describe Variable..." option on the "Help" menu |
---|
[be70a74] | 81 | ;; or C-h v to find out what these variables mean. |
---|
| 82 | (custom-set-variables |
---|
| 83 | '(complex-buffers-menu-p t) |
---|
| 84 | '(kill-whole-line t)) |
---|
| 85 | |
---|
| 86 | (setq minibuffer-confirm-incomplete t) |
---|
| 87 | |
---|
| 88 | ;; show matching parantheses |
---|
| 89 | (paren-set-mode 'paren) |
---|
[0aa69a] | 90 | |
---|
| 91 | ;; func-menu is a package that scans your source file for function |
---|
| 92 | ;; definitions and makes a menubar entry that lets you jump to any |
---|
| 93 | ;; particular function definition by selecting it from the menu. The |
---|
| 94 | ;; following code turns this on for all of the recognized languages. |
---|
| 95 | (require 'func-menu) |
---|
| 96 | (define-key global-map 'f8 'function-menu) |
---|
| 97 | (add-hook 'find-file-hooks 'fume-add-menubar-entry) |
---|
| 98 | (define-key global-map "\C-cl" 'fume-list-functions) |
---|
| 99 | (define-key global-map "\C-cg" 'fume-prompt-function-goto) |
---|
| 100 | |
---|
| 101 | ;; The Hyperbole information manager package uses (shift button2) and |
---|
| 102 | ;; (shift button3) to provide context-sensitive mouse keys. If you |
---|
| 103 | ;; use this next binding, it will conflict with Hyperbole's setup. |
---|
| 104 | ;; Choose another mouse key if you use Hyperbole. |
---|
| 105 | (define-key global-map '(shift button3) 'mouse-function-menu) |
---|
| 106 | |
---|
| 107 | ;; For descriptions of the following user-customizable variables, |
---|
| 108 | ;; type C-h v <variable> |
---|
| 109 | (setq fume-max-items 25 |
---|
| 110 | fume-fn-window-position 3 |
---|
| 111 | fume-auto-position-popup t |
---|
| 112 | fume-display-in-modeline-p t |
---|
| 113 | fume-menubar-menu-location "File" |
---|
| 114 | fume-buffer-name "*Function List*" |
---|
| 115 | fume-no-prompt-on-valid-default nil) |
---|
| 116 | |
---|
| 117 | ;; end Xemacs stuff |
---|
| 118 | ) |
---|
| 119 | (t |
---|
[be70a74] | 120 | ;; |
---|
[0aa69a] | 121 | ;; Emcas stuff |
---|
[be70a74] | 122 | ;; |
---|
| 123 | |
---|
| 124 | ;; show matching parantheses |
---|
| 125 | (show-paren-mode t) |
---|
| 126 | |
---|
| 127 | ;; turn on auto (de)compression of files |
---|
| 128 | (auto-compression-mode t) |
---|
| 129 | |
---|
[0aa69a] | 130 | ;; End Emcas stuff |
---|
| 131 | ) |
---|
| 132 | ) |
---|
| 133 | |
---|
| 134 | ;; use auctex as default mode for editing latex stuff |
---|
[be70a74] | 135 | (let ((auctex-filename (locate-library "tex-site"))) |
---|
| 136 | (if auctex-filename |
---|
| 137 | (require 'tex-site auctex-filename))) |
---|
[0aa69a] | 138 | |
---|
| 139 | ;; put stuff here which should not be/only be executed under |
---|
| 140 | ;; mswindows/unix |
---|
| 141 | (cond ((or (eq system-type 'cygwin32) |
---|
| 142 | (eq system-type 'windows-nt)) |
---|
| 143 | ;;; mswindows stuff |
---|
| 144 | |
---|
| 145 | ;; Let shell be /bin/bash, if it exists |
---|
| 146 | (cond ((file-exists-p "/bin/bash") |
---|
| 147 | (setq explicit-shell-filename "/bin/bash") |
---|
| 148 | (setq explicit-bash-args (list "--login" "-i")))) |
---|
| 149 | |
---|
| 150 | ; patch these function so that they do not use ~ for backup under |
---|
| 151 | ; mswindows |
---|
| 152 | (defun make-backup-file-name (file) |
---|
| 153 | "Create the non-numeric backup file name for FILE. |
---|
| 154 | This is a separate function so you can redefine it for customization." |
---|
| 155 | (if (eq system-type 'ms-dos) |
---|
| 156 | (let ((fn (file-name-nondirectory file))) |
---|
| 157 | (concat (file-name-directory file) |
---|
| 158 | (if (string-match "\\([^.]*\\)\\(\\..*\\)?" fn) |
---|
| 159 | (substring fn 0 (match-end 1))) |
---|
| 160 | ".bak")) |
---|
| 161 | (if (or (eq system-type 'cygwin32) |
---|
| 162 | (eq system-type 'windows-nt)) |
---|
| 163 | (concat file ".bak") |
---|
| 164 | (concat file "~")))) |
---|
| 165 | |
---|
| 166 | (defun backup-file-name-p (file) |
---|
| 167 | "Return non-nil if FILE is a backup file name (numeric or not). |
---|
| 168 | This is a separate function so you can redefine it for customization. |
---|
| 169 | You may need to redefine `file-name-sans-versions' as well." |
---|
| 170 | (if (or (eq system-type 'ms-dos) |
---|
| 171 | (eq system-type 'cygwin32) |
---|
| 172 | (eq system-type 'windows-nt)) |
---|
| 173 | (string-match "\\.bak\\'" file) |
---|
| 174 | (string-match "~\\'" file))) |
---|
| 175 | |
---|
| 176 | ;;; end mswindows stuff |
---|
| 177 | ) |
---|
| 178 | (t |
---|
| 179 | ;;; stuff for unix only |
---|
| 180 | |
---|
| 181 | ;;; end stuff for unix only |
---|
| 182 | )) |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | |
---|