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