Mercurial > hg > xemacs-beta
annotate etc/sample.init.el @ 5880:44ba043ceada
Fix a small typo
author | Vin Shelton <acs@xemacs.org> |
---|---|
date | Sat, 28 Mar 2015 16:03:33 -0400 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
462 | 1 ;; -*- Mode: Emacs-Lisp -*- |
2 | |
3 ;; Copyright (C) 2000, 2001 Ben Wing. | |
4 | |
5 ;; Author: Mostly Ben Wing <ben@xemacs.org> | |
6 ;; Maintainer: XEmacs Development Team | |
7 ;; Keywords: sample, initialization | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
11 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
12 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
13 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
14 ;; option) any later version. |
462 | 15 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
19 ;; for more details. |
462 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1959
diff
changeset
|
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
462 | 23 |
24 ;; #### to do: | |
863 | 25 ;; -- scan for #### markers and fix the problems noted there. |
26 ;; -- #### maybe the setqs in this file should be changed to defvars | |
27 ;; to avoid tromping on customizations when custom.el is loaded | |
28 ;; early (dv and sjt at least favor making this the default) | |
29 ;; -- #### update documentation in (lispref)Starting Up XEmacs, in | |
30 ;; (xemacs)Entering Emacs, and in (custom), then point to them | |
31 ;; instead of going into detail here. | |
462 | 32 |
863 | 33 ;;; This is a sample init file. It can be used without modification |
34 ;;; as your init.el or .emacs. In older versions of XEmacs, this file | |
35 ;;; was called .emacs and placed in your home directory. (Under MS | |
36 ;;; Windows, that directory is controlled by the HOME environment | |
37 ;;; variable and defaults to C:\. You can find out where XEmacs | |
38 ;;; thinks your home directory is using | |
462 | 39 ;;; |
40 ;;; ESC : (expand-file-name "~") | |
41 ;;; | |
42 ;;; . This means type ESC, then colon, then the following text, then hit | |
43 ;;; return.) In more recent versions of XEmacs, this file has migrated to | |
44 ;;; the .xemacs/ subdirectory and is called init.el. Other files are | |
45 ;;; also located here, such as custom.el (the auto-generated file | |
46 ;;; containing Customization options that you saved when using | |
47 ;;; Options->Save Options). | |
48 | |
49 ;;; Changes to your init.el file will not take effect until the next | |
50 ;;; time you start up XEmacs, unless you load it explicitly with | |
51 ;;; | |
52 ;;; M-x load-file RET ~/.xemacs/init.el RET | |
53 | |
54 ;;; The language that this file (and most other XEmacs init files) is | |
55 ;;; written in is called "XEmacs Lisp" or more commonly "Elisp". | |
56 | |
863 | 57 ;;; Brief descriptions of how the init process works and how to |
58 ;;; accomplish many useful customizations are given below in this | |
59 ;;; file. There are many sources of further information: | |
462 | 60 |
61 ;;; -- the XEmacs User's Manual (Access using the online Info browser: | |
62 ;;; Use `Help->Info (Online Docs)->XEmacs User's Manual' (if | |
63 ;;; there is such an entry); or get to the Info contents page | |
64 ;;; using `Help->Info Contents' or `C-h i', and then | |
65 ;;; *middle-click* the XEmacs link or move the cursor into the | |
66 ;;; link and hit ENTER. This manual contains a great deal of | |
67 ;;; documentation on customization: Scroll down to the | |
68 ;;; Customization link and select it in the same fashion as for | |
69 ;;; the XEmacs link just mentioned.) | |
70 | |
71 ;;; -- the XEmacs FAQ (`C-h F' for the local version; get either the | |
72 ;;; local version or the very latest version off the net using | |
73 ;;; the Help menu) | |
74 | |
75 ;;; -- the XEmacs Lisp Reference Manual, containing detailed | |
76 ;;; documentation on Elisp. (Access using Info, just like for the | |
77 ;;; XEmacs User's Manual.) | |
78 | |
79 ;;; -- the documentation strings for specific commands, functions, | |
80 ;;; key sequences, and variables. NOTE: This is *not* the same | |
81 ;;; information as in the XEmacs User's Manual or XEmacs Lisp | |
82 ;;; Reference Manual! In general, the doc strings are more | |
83 ;;; terse and more up-to-date than what is found in the manuals. | |
84 ;;; Once you understand the general concepts, these doc strings | |
85 ;;; should be your first point of reference for further | |
86 ;;; info. (Access using menu entries under `Help->Commands, | |
87 ;;; Variables, Keys' or using the keyboard: `C-h k' for a key | |
88 ;;; sequence, `C-h f' for a named command or Elisp function, | |
89 ;;; `C-h v' for a variable. There is various other useful | |
90 ;;; information accessible similarly, such as `C-h a' | |
91 ;;; ["Apropos", i.e. search for a command, function, or variable | |
92 ;;; by name]; `C-h C-a' ["Apropos Docs", i.e. search through the | |
93 ;;; text of the doc strings]; `C-h b' to list all key bindings; | |
94 ;;; `C-h m' to describe the current major and minor modes; etc. | |
95 ;;; Type `C-h ? ?' for a complete list.) | |
96 | |
97 ;;; -- Getting Started with XEmacs [aka the "New User's Guide"], a | |
98 ;;; more introductory manual than the XEmacs User's Manual. | |
99 ;;; (Access using Info, just like for the XEmacs User's Manual. | |
100 ;;; There are some sections on customization here.) | |
101 | |
102 ;;; -- the XEmacs tutorial, a very simple introduction to XEmacs for | |
103 ;;; total beginners. (`C-h t' for English; get the version in | |
104 ;;; various languages from the Help menu) | |
105 | |
106 ;;; -- the XEmacs web site, www.xemacs.org. | |
107 | |
108 ;;; -- the XEmacs mailing lists (xemacs-FOO@xemacs.org; | |
109 ;;; see http://www.xemacs.org/Lists/ for more info. Before | |
110 ;;; posting, consider looking through the archives -- they go back | |
111 ;;; years and there is a powerful searching interface. Currently | |
112 ;;; the archives are at http://list-archive.xemacs.org/, but if | |
113 ;;; this doesn't work, you can always access them through | |
114 ;;; www.xemacs.org.) | |
115 | |
116 ;;; -- the XEmacs newsgroup, comp.emacs.xemacs. This is | |
117 ;;; bi-directionally gatewayed with xemacs@xemacs.org. WARNING: | |
118 ;;; The developers do not normally hang out on this newsgroup. If | |
119 ;;; you need to contact them, use xemacs-beta@xemacs.org. | |
120 | |
121 ;;; -- the XEmacs internals manual, for those interested in working on | |
122 ;;; the XEmacs C code. (Available through Info.) | |
123 | |
124 ;;; -- `Help->About XEmacs' to find out who the maintainers are. | |
125 | |
126 | |
127 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
863 | 128 ;; Theory of Operation ;; |
129 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
130 | |
131 ;;; XEmacs allows you to make persistent changes to editor behavior by | |
132 ;;; saving code in files which are by default loaded at startup. | |
133 | |
134 ;; These files are just Lisp libraries with names built in to XEmacs. | |
135 ;; There are files for the use of the user (the init file and the | |
136 ;; custom file), for the site administrator (default.el and | |
137 ;; site-start.el), and for the XEmacs maintainers (auto-autoloads | |
138 ;; files). See the Lispref for user and site files (node Starting Up | |
139 ;; XEmacs, currently inaccurate (it doesn't describe the custom | |
140 ;; file)). Interactions among the files are complex; see | |
141 ;; lisp/startup.el for details. | |
142 | |
143 ;; Briefly, after very basic initializations including processing a | |
144 ;; special command line options (including GUI toolkit options), | |
145 ;; setting up the terminal, and setting up `load-path', it executes | |
146 ;; customization code as follows: | |
147 | |
148 ;; 1. It runs the normal hook `before-init-hook'. | |
149 ;; 2. It loads the library `site-start' (by default `site-start.el'). | |
150 ;; 3. It loads the init file (by default `~/.xemacs/init.el'). | |
151 ;; 4. It loads the custom file (by default `~/.xemacs/custom.el'). | |
152 ;; 5. It loads the library `default' (by default `default.el'). | |
153 ;; 6. It runs the normal hook `after-init-hook'. | |
154 | |
155 ;; After this the *scratch* buffer is set up and the remaining command | |
156 ;; line arguments (actions and file names) are processed. | |
157 | |
158 ;; N.B. Switching the order of steps 3 and 4 is under discussion and | |
159 ;; favored by several core developers. | |
160 | |
161 ;; Step 2 is inhibited by the -no-site-file command line switch. | |
162 ;; Steps 3 and 4 are inhibited (as a unit) by the -no-init-file | |
163 ;; command line switch (-q is a convenient synonym). Step 5 is | |
164 ;; inhibited by -no-init-file or a non-nil value of | |
165 ;; `inhibit-default-init' (set it in the init file). From now on the | |
166 ;; hooks and the site initialization files will be ignored. | |
167 | |
168 ;; The custom file and the init file contain customizations managed by | |
169 ;; XEmacs itself via the Custom subsystem and manual customizations, | |
170 ;; respectively. Originally both were placed in the same file, | |
171 ;; usually ~/.emacs, but occasionally XEmacs would trash user settings | |
172 ;; when automatically changing options, and more frequently users | |
173 ;; would trash the automatically generated code. So these functions | |
174 ;; have been reallocated to separate files, usually named custom.el | |
175 ;; and init.el, respectively. | |
176 | |
177 ;; The Custom system is accessed most conveniently from the | |
178 ;; Options->Advanced (Customize) menu (also, the Options->Fonts and | |
179 ;; Options->Sizes menus are implicitly managed by Custom, and | |
180 ;; Options->Edit Faces explicitly invokes Custom). You can also use | |
181 ;; the suite of customize commands directly (cf C-h a customize RET). | |
182 ;; Currently, Custom possesses specialized facilities for setting | |
183 ;; ordinary variables of many types, and for customizing faces. As a | |
184 ;; general rule, variable and face initialization should be done using | |
185 ;; Custom, and other initializations should be done in the init file. | |
186 | |
187 ;; A possible exception is a subsystem with its own complex init file, | |
188 ;; eg, Gnus and .gnus. In these cases it is often preferable to keep | |
189 ;; even simple variable initializations together, and you may wish to | |
190 ;; maintain these configurations by hand. | |
191 | |
192 ;; You should avoid editing the custom file by hand. The syntax used | |
193 ;; is complex but concise, and it is easy to silently break the whole | |
194 ;; file with a single error that happens to result in a valid Lisp | |
195 ;; form. On the other hand, the init file is just a Lisp library that | |
196 ;; is loaded before starting the read-eval-redisplay loop. | |
197 | |
198 ;; The interactions between the custom file and other init files are | |
199 ;; governed by a simple idea: | |
200 | |
201 ;; Custom to User: ALL VARIABLES YOURS OURS NOW ARE. | |
202 | |
203 ;; To be precise, Custom is pretty good about noticing and respecting | |
204 ;; existing settings in interactive use. However, it is weak in | |
205 ;; understanding advanced use of specifier variables (these are used | |
206 ;; for customizations which depend on display characteristics and | |
207 ;; configuration in complex ways), and can be quite brutal at | |
208 ;; initialization. | |
209 | |
210 ;; Normal practice for Custom at initialization is to (1) reset all | |
211 ;; customized faces before applying customizations and (2) force all | |
212 ;; variables to the values specified in custom.el. For this reason, | |
213 ;; and because it is generally the case that the init file can | |
214 ;; usefully depend on customized variables, but Custom pays no | |
215 ;; attention to behavior of the init file, it is probably a good idea | |
216 ;; to force custom.el to be loaded before the init file. (As | |
217 ;; mentioned, this will probably become the default in future versions | |
218 ;; of XEmacs.) | |
219 | |
220 ;; To enable early loading of custom.el, uncomment the following line: | |
221 ;(setq Init-inhibit-custom-file-p (not (assoc custom-file load-history))) | |
222 | |
223 ;; Code to implement early loading where late loading is the default. | |
224 ;; A crucial snippet of code must be the last thing in this file. | |
225 | |
226 ;; defvars only initialize uninitialized variables; if the setq above | |
227 ;; is active, the variable below is defined but the value will not be | |
228 ;; altered. | |
229 (defvar Init-inhibit-custom-file-p nil | |
230 "Internal user init flag. Don't use this yourself. | |
231 | |
232 Non-nil if we need to inhibit XEmacs from loading custom.el after init.el.") | |
233 | |
234 (when Init-inhibit-custom-file-p | |
235 ;; This is the default custom-file. | |
236 (let ((file (expand-file-name "~/.xemacs/custom.el"))) | |
237 (add-one-shot-hook 'after-init-hook | |
238 `(lambda () (setq custom-file ,file))) | |
239 (cond ((file-readable-p file) | |
240 (load file)) | |
241 ((file-exists-p file) | |
242 (warn "Existing custom file \"%s\" is not readable!" file))) | |
243 (cond ((not (file-exists-p file)) | |
244 (display-warning ' resource | |
245 (format "Custom file \"%s\" not found." file) | |
246 'info)) | |
247 ((not (file-writable-p file)) | |
248 (warn "Existing custom file \"%s\" is not writable!" file))))) | |
249 | |
250 | |
251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
462 | 252 ;; Basic Customization ;; |
253 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
254 | |
255 ;; TIP: Control-L characters are ignored in Lisp files and are the | |
256 ;; standard way of indicating major section divisions. You can enter | |
257 ;; such a character using C-q C-l. | |
258 | |
259 ;; Define a variable to indicate whether we're running XEmacs/Lucid | |
260 ;; Emacs. (You do not have to defvar a global variable before using | |
261 ;; it -- you can just call `setq' directly. It's clearer this way, | |
262 ;; though. Note also how we check if this variable already exists | |
263 ;; using `boundp', because it's defined in recent versions of | |
264 ;; XEmacs.) | |
265 | |
266 (or (boundp 'running-xemacs) | |
267 (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))) | |
268 | |
269 ;; Define a function to make it easier to check which version we're | |
270 ;; running. This function already exists in recent XEmacs versions, | |
271 ;; and in fact all we've done is copied the definition. Note again | |
272 ;; how we check to avoid clobbering an existing definition. (It's good | |
273 ;; style to do this, in case some improvement was made to the | |
1959 | 274 ;; already-existing function -- otherwise we might substitute an older |
462 | 275 ;; definition and possibly break some code elsewhere.) |
276 ;; | |
277 ;; NOTE ALSO: It is in general *NOT* a good idea to do what we're | |
278 ;; doing -- i.e. provide a definition of a function that is present in | |
279 ;; newer versions of XEmacs but not older ones. The reason is that it | |
280 ;; may confuse code that notices the presence of the function and | |
281 ;; proceeds to use it and other functionality that goes along with it | |
282 ;; -- but which we may not have defined. What's better is to create | |
283 ;; the function with a different name -- typically, prefix it with the | |
284 ;; name of your module, which in this case might be `Init-'. For | |
285 ;; `emacs-version>=' we make an exception because (a) the function has | |
286 ;; been around a long time, (b) there isn't really any other | |
287 ;; functionality that is paired with it, (c) it's definition hasn't | |
288 ;; changed and isn't likely to, and (d) the calls to `emacs-version>=' | |
289 ;; or its renamed replacement would be scattered throughout the code | |
290 ;; below, and with a replacement name the code would become | |
291 ;; significantly less portable into someone else's init.el file. (BUT | |
292 ;; NOTE BELOW: We do follow the procedure outlined above with renaming | |
293 ;; in a different case where the specifics are much different.) | |
294 ;; | |
295 ;; TIP: At this point you may be wondering how I wrote all these nice, | |
296 ;; long, nicely-justified textual stretches -- didn't I go crazy | |
297 ;; sticking in the semicolons everywhere and having to delete them and | |
298 ;; rearrange everything whenever I wanted to make any corrections to | |
299 ;; the text? The answer is -- of course not! Use M-q. This does all | |
300 ;; the magic for you, justifying and breaking lines appropriately and | |
301 ;; putting any necessary semicolons or whatever at the left (it | |
302 ;; figures out what this ought to be by looking in a very clever | |
303 ;; fashion at what's already at the beginning of each line in the | |
304 ;; paragraph). You may need `filladapt' set up (it's done below in | |
305 ;; this file) in order for this to work properly. Finally, if you | |
306 ;; want to turn on automatic filling (like in a word processor, but | |
307 ;; not quite as automatic), use M-x auto-fill-mode or the binding set | |
308 ;; up below in this file (Meta-F9). | |
309 | |
310 (or (fboundp 'emacs-version>=) | |
311 (defun emacs-version>= (major &optional minor patch) | |
312 "Return true if the Emacs version is >= to the given MAJOR, MINOR, | |
313 and PATCH numbers. | |
314 The MAJOR version number argument is required, but the other arguments | |
315 argument are optional. Only the Non-nil arguments are used in the test." | |
316 (let ((emacs-patch (or emacs-patch-level emacs-beta-version -1))) | |
317 (cond ((> emacs-major-version major)) | |
318 ((< emacs-major-version major) nil) | |
319 ((null minor)) | |
320 ((> emacs-minor-version minor)) | |
321 ((< emacs-minor-version minor) nil) | |
322 ((null patch)) | |
323 ((>= emacs-patch patch)))))) | |
324 | |
325 ;; 19.13 was released ages ago (Sep. 1995), and lots of graphic and | |
326 ;; window-system stuff doesn't work before then. | |
327 | |
328 (or (not running-xemacs) | |
329 (emacs-version>= 19 13) | |
330 (error "This init file does not support XEmacs before 19.13")) | |
331 | |
332 ;; Here are some example code snippets that you can use if you need to | |
333 ;; conditionalize on a particular version of Emacs (in general, though, | |
334 ;; it is much better to use `fboundp', `featurep', or other such | |
335 ;; feature-specific checks rather than version-specific checks): | |
336 | |
337 ; (cond ((and running-xemacs | |
338 ; (emacs-version>= 21 2)) | |
339 ; ;; | |
340 ; ;; Code requiring XEmacs version 21.2 or newer goes here | |
341 ; ;; | |
342 ; )) | |
343 | |
344 ; (cond ((emacs-version >= 19 0) | |
345 ; ;; | |
346 ; ;; Code for any vintage-19 Emacs goes here | |
347 ; ;; | |
348 ; )) | |
349 | |
350 ; (cond ((and (not running-xemacs) | |
351 ; (emacs-version>= 20 0)) | |
352 ; ;; | |
353 ; ;; Code specific to GNU Emacs 20 or newer (not XEmacs) goes here | |
354 ; ;; | |
355 ; )) | |
356 | |
558 | 357 (defun Init-safe-require (feat) |
358 "Try to REQUIRE the specified feature. Errors occurring are silenced. | |
359 \(Perhaps in the future there will be a way to get at the error.) | |
360 Returns t if the feature was successfully required." | |
361 (condition-case nil | |
362 (progn (require feat) t) | |
363 (error nil))) | |
364 | |
462 | 365 |
366 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
367 ;; Key Definitions ;; | |
368 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
369 | |
370 ;;; Set up the function keys to do common tasks to reduce Emacs pinky | |
371 ;;; and such. | |
372 | |
373 ;; You can set a key sequence either to a command or to another key | |
374 ;; sequence. (Use `C-h k' to map a key sequence to its command. Use | |
375 ;; `C-h w' to go the other way.) In general, however, it works better | |
376 ;; to specify the command name. For example, it does not currently | |
377 ;; work to say | |
378 | |
379 ;; (global-set-key 'f5 "\C-x\C-f") | |
380 | |
381 ;; The reason is that macros (which is what the string on the right | |
382 ;; really is) can't currently use the minibuffer. This is an | |
383 ;; extremely longstanding bug in Emacs. Eventually, it will be | |
384 ;; fixed. (Hopefully ..) | |
385 | |
386 ;; Note also that you may sometimes see the idiom | |
387 | |
388 ;; (define-key global-map ...) | |
389 | |
390 ;; in place of (global-set-key ...). These are exactly the same. | |
391 | |
392 ;; Here I've tried to put all the most common commands on simple | |
393 ;; non-modifier function keys to take the pressure off your modifier | |
394 ;; fingers. Furthermore, on my keyboard at least, the function keys | |
395 ;; are grouped into three groups of four with spaces between them, and | |
396 ;; so it's easier to hit the keys at the edge of the groups -- | |
397 ;; i.e. f1, f4, f5, f8, f9, and f12. Finally, you may note that f9, | |
398 ;; f11, and f12 are purposely left blank. [F6 is defined below.] | |
399 ;; That's because I use them for _, {, and } -- see below. | |
400 | |
401 (global-set-key 'f1 'advertised-undo) ;; Undo | |
402 (global-set-key 'f2 'kill-primary-selection) ;; Cut | |
403 (global-set-key 'f3 'copy-primary-selection) ;; Copy | |
404 (global-set-key 'f4 'yank-clipboard-selection) ;; Paste | |
405 (global-set-key 'f5 'find-file) ;; C-x C-f | |
406 (global-set-key 'f7 'save-buffer) ;; C-x C-s | |
407 | |
408 ;; I considered having this retain the current column after killing | |
409 ;; the line, but that messes up the common idiom `f8 move-cursor f4'. | |
410 | |
411 (defun Init-kill-entire-line (&optional arg) | |
464 | 412 "Kill the entire line. |
413 With prefix argument, kill that many lines from point. Negative | |
414 arguments kill lines backward. | |
415 | |
416 When calling from a program, nil means \"no arg\", | |
417 a number counts as a prefix arg." | |
462 | 418 (interactive "*P") |
419 (let ((kill-whole-line t)) | |
420 (beginning-of-line) | |
421 (call-interactively 'kill-line))) | |
422 | |
423 (global-set-key 'f8 | |
424 (if (fboundp 'kill-entire-line) 'kill-entire-line 'Init-kill-entire-line)) | |
425 | |
426 ;; A keystroke repeated incredible amounts of times. We need to patch | |
427 ;; into the isearch keymap so that repeat searches while in isearch | |
428 ;; mode still work. Here we show how to make a key in a keymap have the | |
429 ;; same binding as another key in the keymap, without knowing what the | |
430 ;; binding is in advance; instead, we find it with `lookup-key'. This | |
431 ;; way, if the binding of C-s changes (e.g. to a different function) but | |
432 ;; the meaning is basically the same, we automatically do the right thing. | |
433 ;; If we put in the actual binding, which is 'isearch-repeat-forward, | |
434 ;; this automatic tracking wouldn't happen. | |
435 ;; | |
436 ;; TIP: To find out what the (lookup-key ...) expression evaluates to, | |
437 ;; move just to the right of the closing paren and type C-x C-e. | |
438 | |
439 (global-set-key 'f10 'isearch-forward) | |
440 (define-key isearch-mode-map 'f10 (lookup-key isearch-mode-map "\C-s")) | |
441 (define-key minibuffer-local-isearch-map 'f10 | |
442 (lookup-key minibuffer-local-isearch-map "\C-s")) | |
443 (global-set-key '(shift f10) 'isearch-backward) | |
444 (define-key isearch-mode-map '(shift f10) (lookup-key isearch-mode-map "\C-r")) | |
445 (define-key minibuffer-local-isearch-map '(shift f10) | |
446 (lookup-key minibuffer-local-isearch-map "\C-r")) | |
447 | |
448 ;; Here we define our own function and then bind a key to it. | |
449 | |
450 (defun start-or-end-kbd-macro () | |
451 ;; A doc string. This is optional. | |
452 "Start defining a keyboard macro, or stop if we're already defining." | |
453 ;; IMPORTANT: Any function bound to a key MUST have an interactive spec, | |
454 ;; usually just the following line: | |
455 (interactive) | |
456 (if defining-kbd-macro | |
457 (end-kbd-macro) | |
458 (start-kbd-macro nil))) | |
459 | |
460 ;; The macros used to have their place in the function keys, but I | |
461 ;; find that I use them significantly less than the really basic | |
462 ;; things on the function keys. When using a macro, you call the | |
463 ;; macro much more than define it, so the setup below makes some | |
464 ;; sense. | |
465 | |
466 (global-set-key '(shift kp-multiply) 'start-or-end-kbd-macro) | |
467 (global-set-key 'kp-multiply 'call-last-kbd-macro) ;; C-x e | |
468 | |
469 ;; Note that you can refer to a key sequence either using an ASCII | |
470 ;; string or the "long way", with vectors and conses. You saw above | |
471 ;; (in a comment) the string form for specifying the key sequence `C-x | |
472 ;; C-f', which is "\C-x\C-f". (For those curious, \C-x is just an | |
473 ;; escape sequence that puts a ^X character into the string. Thus, | |
474 ;; the string just mentioned really just contains two characters, a ^X | |
475 ;; and a ^F.) The long way to specify the sequence `C-x C-f' would be | |
476 ;; | |
477 ;; [(control x) (control f)] | |
478 ;; | |
479 ;; The long format lets you specify all possible key sequences, while the | |
480 ;; string form only lets you specify sequences involving ASCII characters | |
481 ;; and/or modifiers and in fact only a subset of them. | |
482 ;; | |
483 ;; Other examples are: | |
484 ;; | |
485 ;; [(control x) n] | |
486 ;; | |
487 ;; (You can leave out the parens when there is no modifier specified in | |
488 ;; the keystroke, and that's normally done.) | |
489 ;; | |
490 ;; [(shift control meta left)] | |
491 ;; | |
492 ;; (You can put more than one modifier in a keystroke.) | |
493 ;; | |
494 ;; (shift control meta left) | |
495 ;; | |
496 ;; (This is the same as the previous. when there's only one keystroke in | |
497 ;; the sequence, you can leave out the brackets, and that's normally | |
498 ;; done.) | |
499 ;; | |
500 ;; [(control x) (shift button3)] | |
501 ;; | |
502 ;; (You can refer to mouse buttons just like keys -- apply modifiers, | |
503 ;; intermingle them in key sequences, etc. But there's only problem | |
504 ;; here, which is that with the mouse you don't just have one possible | |
505 ;; gesture, like with keys. You'd really like to control button-down, | |
506 ;; button-up, button-click (down and up without selecting anything), | |
507 ;; button drag, button double-click, etc. This is normally done by | |
508 ;; binding your key sequence to `mouse-track', and then putting hooks | |
509 ;; onto `mouse-track-click-hook', `mouse-track-drag-up-hook', etc. to | |
510 ;; customize the specific behavior.) | |
511 ;; | |
512 ;; 'left | |
513 ;; | |
514 ;; (Ultimate reductionism -- no brackets, no parens. This is the form, in | |
515 ;; that, that the 'f1, 'f2, etc. took, which where in fact "long" | |
516 ;; forms.) | |
517 ;; | |
518 ;; '(control C) | |
519 ;; | |
520 ;; (You cannot use '(control shift c) here. This applies whenever Shift + | |
521 ;; key translates to a single character. Note also that you can't use | |
522 ;; "\C-C" either; this refers to the non-shifted C-c, just like "\C-c" | |
523 ;; would.) | |
524 ;; | |
525 ;; '(control \() | |
526 ;; (Put a backslash in front of characters used in Lisp syntax.) | |
527 ;; | |
528 ;; Also, you can find out the name of a key using C-h c. WARNING: | |
529 ;; This does not report the correct name of the keys named `delete', | |
530 ;; `backspace', `return', `tab', `space', `escape', and `linefeed'! | |
531 ;; (More correct results can be achieved using | |
532 ;; | |
533 ;; ESC : (read-key-sequence "foo: ") | |
534 ;; | |
535 ;; .) | |
536 | |
537 ;;;;;;;;;;;;;;;;;;;;;;;; | |
538 | |
539 ;; Keystrokes to conveniently switch buffers. | |
540 | |
541 ;; F6 is invaluable for flipping back and forth between two buffers | |
542 ;; you're working with. | |
543 | |
544 (global-set-key 'f6 'switch-to-other-buffer) ;; M-C-l | |
545 | |
546 ;;;;;;;;;;;;;;;;;;;;;;;; | |
547 | |
548 ;; Other text keystrokes. | |
549 | |
550 ;; Make a keystroke to insert a literal TAB character. (`C-q TAB' is | |
551 ;; annoying because difficult to repeat.) Note that this does not work | |
552 ;; in TTY frames, where TAB and Shift-TAB are indistinguishable. | |
553 (define-key global-map '(shift tab) 'tab-to-tab-stop) | |
554 | |
555 ;; Toggle auto-filling. Useful with text but annoying with code. You | |
556 ;; can manually fill with M-q. | |
557 (global-set-key '(meta f9) 'auto-fill-mode) | |
558 | |
559 ;; You cannot say '(meta shift t) here -- see above. | |
560 (if (fboundp 'transpose-line-down) | |
561 (global-set-key '(meta T) 'transpose-line-down)) | |
562 (if (fboundp 'transpose-line-up) | |
563 (global-set-key '(control T) 'transpose-line-up)) | |
564 | |
565 ;;;;;;;;;;;;;;;;;;;;;;;; | |
566 | |
567 ;; Rearrange some inconvenient bindings. | |
568 | |
569 ;; ESC ESC ESC is a useful command, but too long. ESC ESC would be | |
570 ;; much more logical, but interferes with Meta + keypad/arrow keys on | |
571 ;; TTY's. But most people only use window systems and no such problem | |
572 ;; exists there, so set up the more logical binding there. | |
573 ;; | |
574 ;; Note also the use of if vs. cond/when/unless/or/and to express | |
575 ;; conditional statements. The difference is purely stylistic. | |
576 | |
577 (when (console-on-window-system-p) | |
578 (global-set-key '(meta escape) 'keyboard-escape-quit) | |
579 (define-key isearch-mode-map '(meta escape) 'isearch-cancel)) | |
580 | |
581 ;; The standard definition of C-z causes iconification on window | |
582 ;; systems, which is both useless and annoying. Instead, bind it to a | |
583 ;; useful command that's not on any keys. (This also makes a neat | |
584 ;; parallelism with M-z, which does zap-to-char.) Don't override the | |
585 ;; TTY binding, which does "Suspend". If you want this new binding on | |
586 ;; TTY's, and can train yourself to use C-x C-z to suspend, then | |
587 ;; remove or comment out the `when' statement. (Here's the proper way | |
588 ;; to comment out such a statement: | |
589 ;; | |
590 ;; ;(when (console-on-window-system-p) | |
591 ;; (global-set-key "\C-z" 'zap-up-to-char) | |
592 ;; ; ) | |
593 ;; | |
594 ;; To do this, I first moved the closing paren to a new line, | |
595 ;; reindented with TAB, then added the semicolons.) | |
596 | |
597 (when (console-on-window-system-p) | |
598 (global-set-key "\C-z" 'zap-up-to-char)) | |
599 | |
600 ;; When not on a TTY, remove the binding of C-x C-c, which normally | |
601 ;; exits XEmacs. It's easy to hit this by mistake, and that can be | |
602 ;; annoying. You can always quit with the "Exit XEmacs" option on the | |
603 ;; File menu. | |
604 | |
605 (when (console-on-window-system-p) | |
771 | 606 (global-set-key "\C-x\C-c" |
607 #'(lambda () (interactive) | |
608 (beep) | |
609 (message "Use the \"File/Exit XEmacs\" menu item to exit XEmacs")))) | |
462 | 610 |
611 ;; Make C-k always delete the whole line, which is what most people want, | |
612 ;; anyway. | |
613 (setq kill-whole-line 'always) | |
614 ;; M-k does the old behavior (kill to end of line). | |
615 (global-set-key '(meta k) #'(lambda () | |
616 (interactive) | |
617 (if (fboundp 'historical-kill-line) | |
618 (call-interactively #'historical-kill-line) | |
619 (let ((kill-whole-line nil)) | |
620 (call-interactively #'kill-line))))) | |
621 ;; and Meta-Shift-K does what used to be on M-k, and should | |
622 ;; (hopefully) even work under TTY's. | |
623 (global-set-key '(meta K) 'kill-sentence) | |
624 | |
625 ;; Make sure we get Windows-like shifted-motion key selection behavior | |
626 ;; on recent XEmacs versions. | |
558 | 627 (cond ((boundp 'shifted-motion-keys-select-region) |
628 (setq shifted-motion-keys-select-region t)) | |
629 ;; otherwise, try the pc-select package -- | |
630 ((Init-safe-require 'pc-select) | |
631 (pc-select-mode 1))) | |
462 | 632 |
633 ;; The following commented-out code rearranges the keymap in an | |
634 ;; unconventional but extremely useful way for programmers. Parens | |
635 ;; and braces are both available without using the shift key (using | |
636 ;; the bracket keys and f11/f12, respectively). Brackets (much less | |
637 ;; used) are the shifted versions of the new paren keys (i.e. where | |
638 ;; the braces normally are). | |
639 ;; | |
640 ;; The idea for this comes from Jamie Zawinski. | |
641 ;; | |
642 ;; Also make a convenient keystroke for _, used constantly in C code. | |
643 ;; | |
644 ;; NOTE: you can (semi-) conveniently uncomment a region using | |
645 ;; C-u M-x comment-region, or the "Uncomment Region" menu item on the | |
646 ;; Lisp menu in new enough versions of XEmacs. | |
647 | |
648 ;(keyboard-translate ?[ ?() | |
649 ;(keyboard-translate ?] ?)) | |
650 ;(keyboard-translate ?{ ?[) | |
651 ;(keyboard-translate ?} ?]) | |
652 ;;; We don't use `keyboard-translate' for these because it messes up | |
653 ;;; bindings for M-F9 and the like. | |
654 ;(define-key key-translation-map 'f11 "{") | |
655 ;(define-key key-translation-map 'f12 "}") | |
656 ;(define-key key-translation-map 'f9 "_") | |
657 | |
658 | |
659 ;;;;;;;;;;;;;;;;;;;;;;;; | |
660 | |
661 ;; Useful programming-related keystrokes. | |
662 | |
663 (defun describe-foo-at-point () | |
464 | 664 "Show the documentation of the Elisp function and variable near point. |
665 This checks in turn: | |
666 | |
667 -- for a function name where point is | |
668 -- for a variable name where point is | |
669 -- for a surrounding function call | |
670 " | |
462 | 671 (interactive) |
672 (let (sym) | |
673 ;; sigh, function-at-point is too clever. we want only the first half. | |
674 (cond ((setq sym (ignore-errors | |
675 (with-syntax-table emacs-lisp-mode-syntax-table | |
676 (save-excursion | |
677 (or (not (zerop (skip-syntax-backward "_w"))) | |
678 (eq (char-syntax (char-after (point))) ?w) | |
679 (eq (char-syntax (char-after (point))) ?_) | |
680 (forward-sexp -1)) | |
681 (skip-chars-forward "`'") | |
682 (let ((obj (read (current-buffer)))) | |
683 (and (symbolp obj) (fboundp obj) obj)))))) | |
684 (describe-function sym)) | |
685 ((setq sym (variable-at-point)) (describe-variable sym)) | |
686 ;; now let it operate fully -- i.e. also check the | |
687 ;; surrounding sexp for a function call. | |
688 ((setq sym (function-at-point)) (describe-function sym))))) | |
689 | |
690 (global-set-key '(shift f4) 'next-error) ;; C-x ` | |
691 (global-set-key '(control f4) 'previous-error) | |
692 (global-set-key '(shift f5) 'find-library) | |
693 (global-set-key '(control f5) 'find-function) | |
694 (global-set-key '(meta f5) 'find-variable) | |
695 (global-set-key '(shift f11) 'describe-foo-at-point) | |
696 (global-set-key '(control f11) 'eval-last-sexp) | |
697 ;; Edebug is a source-level debugger for Emacs Lisp programs. Put | |
698 ;; the cursor at the end of a function definition and "instrument" it | |
699 ;; with this command; then, you can single step through it the next | |
700 ;; time it's run. | |
701 (global-set-key '(meta f11) 'edebug-defun) | |
702 (global-set-key '(meta f12) 'add-change-log-entry) | |
703 | |
704 ;; This nicely parallels M-*, which pops the tag stack. See below for | |
705 ;; how to set up tags. | |
706 (global-set-key '(control *) 'find-tag-at-point) | |
707 | |
708 ;; Define a function to conveniently determine where time is being | |
709 ;; spent when executing commands or Lisp code. | |
710 (defun toggle-profiling () | |
711 "Start profiling, or stop it and print results. | |
712 This lets you figure out where time is being spent when executing Lisp code." | |
713 (interactive) | |
714 (if (profiling-active-p) | |
715 (progn | |
716 (stop-profiling) | |
717 (message "...Finished profiling") | |
718 (profile-results)) | |
719 (message "Profiling...") | |
720 (clear-profiling-info) | |
721 (start-profiling))) | |
722 | |
723 ;; Note that sequences of C-c plus a letter are specifically | |
724 ;; reserved for users and should never be bound by any packages. | |
725 | |
726 (global-set-key "\C-cp" 'toggle-profiling) | |
727 | |
728 ;; LISPM bindings of Control-Shift-C and Control-Shift-E. | |
729 ;; See comment above about bindings like this. | |
730 (define-key emacs-lisp-mode-map '(control C) 'compile-defun) | |
731 (define-key emacs-lisp-mode-map '(control E) 'eval-defun) | |
732 | |
733 ;;;;;;;;;;;;;;;;;;;;;;;; | |
734 | |
735 ;; Numeric keypad. | |
736 | |
737 ;; The numeric keypad as a whole is underused, and it's a good source | |
738 ;; of keys to bind to commands. Here we add some useful bindings. | |
739 ;; Because this is a sample file and I want to avoid unpleasant | |
740 ;; surprises for novices, I don't actually bind the shared | |
741 ;; numeric/cursor-motion keys because | |
742 ;; | |
743 ;; (a) someone keypads don't have separate motion keys (e.g. laptops?), and | |
744 ;; (b) TTY's and some X servers might not distinguish the regular and | |
745 ;; numeric-keypad motion keys. | |
746 | |
747 ;; `kill-current-buffer' (defined below) deletes the current | |
748 ;; buffer. (Don't worry, you will be prompted to save if it's | |
749 ;; modified.) By repeatedly pressing keypad-minus, you can | |
750 ;; conveniently reduce the number of open buffers to a manageable size | |
751 ;; after you've opened a whole bunch of files and finished working on | |
752 ;; them. Shift plus keypad-minus kills both the current buffer and | |
753 ;; its window, and Control plus keypad-minus kills just the current | |
754 ;; window. | |
755 | |
756 (global-set-key 'kp-subtract 'kill-current-buffer) | |
757 (global-set-key '(shift kp-subtract) 'kill-current-buffer-and-window) | |
758 (global-set-key '(control kp-subtract) 'delete-window) | |
759 ;; Ugh, modes that use `suppress-keymap' and are dumped with XEmacs will | |
760 ;; need their own definition. There is no easy way to fix this. | |
761 (define-key help-mode-map 'kp-subtract 'kill-current-buffer) | |
762 (define-key help-mode-map '(shift kp-subtract) | |
763 'kill-current-buffer-and-window) | |
764 (define-key list-mode-map 'kp-subtract 'kill-current-buffer) | |
765 (define-key list-mode-map '(shift kp-subtract) | |
766 'kill-current-buffer-and-window) | |
767 | |
768 (defun kill-current-buffer () | |
464 | 769 "Kill the current buffer (prompting if it is modified)." |
462 | 770 (interactive) |
771 (kill-buffer (current-buffer))) | |
772 | |
773 (defun kill-current-buffer-and-window () | |
464 | 774 "Kill the current buffer (prompting if it is modified) and its window." |
462 | 775 (interactive) |
776 (kill-buffer (current-buffer)) | |
777 (delete-window)) | |
778 | |
464 | 779 (defvar grep-all-files-history nil) |
780 | |
781 (defvar grep-all-files-omitted-expressions | |
782 '("*~" "#*" ".#*" ",*" "*.elc" "*.obj" "*.o" "*.exe" "*.dll" "*.lib" "*.a" | |
783 "*.dvi" "*.class" "*.bin") | |
784 "List of expressions matching files to be omitted in `grep-all-files-...'. | |
785 Each entry should be a simple name or a shell wildcard expression.") | |
786 | |
787 (defvar grep-all-files-omitted-directories '("CVS" "RCS" "SCCS") | |
788 "List of directories not to recurse into in `grep-all-files-...'. | |
789 Each entry should be a simple name or a shell wildcard expression.") | |
790 | |
791 (defun construct-grep-all-files-command (find-segment grep-segment) | |
792 (let ((omit-annoying | |
793 (mapconcat #'(lambda (wildcard) | |
794 (concat "-name '" wildcard "' -or ")) | |
795 grep-all-files-omitted-expressions | |
796 ""))) | |
797 (cond ((eq grep-find-use-xargs 'gnu) | |
798 (format "find . %s %s -type f -print0 | xargs -0 -e %s" | |
799 find-segment omit-annoying grep-segment)) | |
800 (grep-find-use-xargs | |
801 (format "find . %s %s -type f -print | xargs %s" | |
802 find-segment omit-annoying grep-segment)) | |
803 (t | |
804 (format "find . %s %s -type f -exec %s {} /dev/null \\;" | |
805 find-segment omit-annoying grep-segment))))) | |
462 | 806 |
464 | 807 (defun grep-all-files-in-current-directory (command) |
808 "Run `grep' in all non-annoying files in the current directory. | |
809 `Non-annoying' excludes backup files, autosave files, CVS merge files, etc. | |
810 More specifically, this is controlled by `grep-all-files-omitted-expressions'. | |
811 | |
812 This function does not recurse into subdirectories. If you want this, | |
813 use \\[grep-all-files-in-current-directory-and-below]." | |
814 (interactive | |
815 (progn | |
816 (require 'compile) | |
817 (list (read-shell-command "Run grep (like this): " | |
818 grep-command 'grep-all-files-history)))) | |
462 | 819 (require 'compile) |
464 | 820 (grep (construct-grep-all-files-command |
821 "-name . -or -type d -prune -or" command))) | |
822 | |
479 | 823 (defun grep-all-files-in-current-directory-and-below (command) |
464 | 824 "Run `grep' in all non-annoying files in the current directory and below. |
825 `Non-annoying' excludes backup files, autosave files, CVS merge files, etc. | |
826 More specifically, this is controlled by `grep-all-files-omitted-expressions'. | |
462 | 827 |
464 | 828 This function recurses into subdirectories. If you do not want this, |
829 use \\[grep-all-files-in-current-directory]." | |
830 (interactive | |
831 (progn | |
832 (require 'compile) | |
833 (list (read-shell-command "Run grep (like this): " | |
834 grep-command 'grep-all-files-history)))) | |
835 (require 'compile) | |
836 (grep (construct-grep-all-files-command | |
837 ;; prune all specified directories. | |
838 (mapconcat #'(lambda (wildcard) | |
839 (concat "-name '" wildcard "' -prune -or ")) | |
840 grep-all-files-omitted-directories | |
841 "") | |
842 command))) | |
462 | 843 |
844 (defun clear-select () | |
464 | 845 "Repeatedly select ever larger balanced expressions around the cursor. |
846 Once you have such an expression marked, you can expand to the end of | |
847 the following expression with \\[mark-sexp] and to the beginning of the | |
848 previous with \\[backward-sexp]." | |
462 | 849 (interactive "_") ;this means "preserve the active region after this command" |
850 (backward-up-list 1) | |
851 (let ((end (save-excursion (forward-sexp) (point)))) | |
852 (push-mark end nil t))) | |
853 | |
854 ;; #### no kp-divide because it doesn't (currently) work on MS Windows | |
855 ;; -- always reports as /. #### this should be fixable. | |
856 (global-set-key 'kp-add 'query-replace) | |
857 (global-set-key '(shift kp-add) 'query-replace-regexp) | |
464 | 858 (global-set-key '(control kp-add) 'grep-all-files-in-current-directory) |
859 (global-set-key '(meta kp-add) 'grep-all-files-in-current-directory-and-below) | |
462 | 860 (global-set-key 'clear 'clear-select) |
861 ;; Note that you can use a "lambda" expression (an anonymous function) | |
862 ;; in place of a function name. This function would be called | |
863 ;; `pop-local-mark' and lets you repeatedly cycle back through recent | |
864 ;; marks (marks are set whenever you begin a selection, begin a | |
865 ;; successful search, are about to jump to the beginning or end of the | |
866 ;; buffer, etc.). | |
867 (global-set-key 'kp-enter (lambda () (interactive) (set-mark-command t))) | |
868 (global-set-key '(shift kp-enter) 'repeat-complex-command) | |
464 | 869 (global-set-key 'pause 'repeat-complex-command) ;; useful on Windows-style kbds |
462 | 870 (global-set-key '(control kp-enter) 'eval-expression) |
871 | |
872 ;;;;;;;;;;;;;;;;;;;;;;;; | |
873 | |
874 ;; Misc. | |
875 | |
876 ;; If you want button2 to insert the selected text | |
877 ;; at point (where the text cursor is), instead of at the | |
878 ;; position clicked, uncomment the following: | |
879 | |
880 ;(setq mouse-yank-at-point t) | |
881 | |
882 ;; If you like the FSF Emacs binding of button3 (single-click | |
883 ;; extends the selection, double-click kills the selection), | |
884 ;; uncomment the following: | |
885 | |
886 ;(define-key global-map 'button3 'mouse-track-adjust) | |
887 | |
888 ;(add-hook 'mouse-track-click-hook | |
889 ; (lambda (event count) | |
890 ; (if (or (/= (event-button event) 3) | |
891 ; (/= count 2)) | |
892 ; nil ;; do the normal operation | |
893 ; (kill-region (point) (mark)) | |
894 ; t ;; don't do the normal operations. | |
895 ; ))) | |
896 | |
897 ;; Uncomment this to enable "sticky modifier keys". With sticky | |
898 ;; modifier keys enabled, you can press and release a modifier key | |
899 ;; before pressing the key to be modified, like how the ESC key works | |
900 ;; always. If you hold the modifier key down, however, you still get | |
901 ;; the standard behavior. I personally think this is the best thing | |
902 ;; since sliced bread (and a *major* win when it comes to reducing | |
903 ;; Emacs pinky), but it's disorienting at first so I'm not enabling it | |
904 ;; here by default. | |
905 | |
906 ;(setq modifier-keys-are-sticky t) | |
907 | |
908 ;; Enable the command `narrow-to-region' ("C-x n n"). It's a useful | |
909 ;; command, but possibly confusing to a new user, so it's disabled by | |
910 ;; default. | |
911 (put 'narrow-to-region 'disabled nil) | |
912 | |
913 ;; Enable obvious hyperlink following with button1. | |
914 (setq Info-button1-follows-hyperlink t) | |
915 | |
916 | |
917 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
918 ;; Change Some Basic Behaviors ;; | |
919 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
920 | |
921 ;; Change the values of some variables. | |
922 ;; (t means true; nil means false.) | |
923 ;; | |
924 ;; Use C-h v or `Help->Commands, Variables, Keys->Describe Variable...' | |
925 ;; to find out what these variables mean. | |
926 (setq | |
927 find-file-compare-truenames t | |
928 minibuffer-max-depth nil | |
929 ) | |
930 | |
931 ;; When running ispell, consider all 1-3 character words as correct. | |
932 (setq ispell-extra-args '("-W" "3")) | |
933 | |
934 ;;; pending-delete-mode causes typed text to replace a selection, | |
935 ;;; rather than append -- standard behavior under all window systems | |
936 ;;; nowadays. | |
937 | |
558 | 938 (if (fboundp 'pending-delete-mode) |
939 (pending-delete-mode 1)) | |
462 | 940 |
941 ;;; NOTE: In this context, `windows-nt' actually refers to all MS | |
942 ;;; Windows operating systems! | |
943 (when (eq system-type 'windows-nt) | |
944 ;; Get mail working under Windows. | |
945 (setq send-mail-function 'smtpmail-send-it) | |
946 (setq smtpmail-debug-info t) | |
947 ;; Substitute your info here. | |
948 ;(setq user-mail-address "ben@xemacs.org") | |
949 ;(setq user-full-name "Ben Wing") | |
950 ;(setq smtpmail-smtp-server "pop.tcsn.uswest.net") | |
951 | |
464 | 952 ;; Make Meta+accelerator traverse to the menu in new enough XEmacs |
462 | 953 ;; versions. Note that this only overrides Meta bindings that would |
464 | 954 ;; actually invoke a menu, and the most common commands that are |
955 ;; overridden have preferred alternative bindings using the arrow | |
956 ;; keys. You can always access the overridden ones using | |
957 ;; Shift+Meta+Key. (Note that "Alt" and "Meta" normally refer to the | |
958 ;; same key, except on some Sun keyboards [where "Meta" is actually | |
959 ;; labelled with a diamond] or if you have explicitly made them | |
960 ;; different under X Windows using `xmodmap'.) | |
961 ;; | |
962 ;; More specifically, the following bindings are overridden: | |
963 ;; | |
964 ;; M-f (use C-right or Sh-M-f instead) | |
965 ;; M-e (use M-C-right or Sh-M-e instead) | |
966 ;; M-v (use Prior aka PgUp or Sh-M-v instead) | |
967 ;; M-m (use Sh-M-m instead) | |
968 ;; M-t (use Sh-M-t instead) | |
969 ;; M-o (normally undefined) | |
970 ;; M-b (use C-left or Sh-M-b instead) | |
971 ;; M-h (use M-e h or Sh-M-h instead) | |
972 ;; in Lisp mode, M-l (use Sh-M-l instead) | |
973 ;; in C mode, M-c (use Sh-M-c instead) | |
974 | |
462 | 975 (setq menu-accelerator-enabled 'menu-force) |
976 | |
977 ;; Make Cygwin `make' work inside a shell buffer. | |
558 | 978 (if (boundp 'setenv) (setenv "MAKE_MODE" "UNIX"))) |
462 | 979 |
980 ;; This shows how to set up the XEmacs side of tags. (To create the | |
981 ;; TAGS table, use the `etags' program found in the XEmacs bin | |
982 ;; directory. Run it in the root directory of your source tree and | |
983 ;; specify all source and include files on the command line.) | |
984 ;(setq tag-table-alist | |
985 ; '( | |
986 ; ;; Everywhere in the /src/xemacs/gui/ source tree will use the TAGS | |
987 ; ;; file in /src/xemacs/gui/. | |
988 ; ("/src/xemacs/gui/" . "/src/xemacs/gui/") | |
989 ; ;; Everywhere in the /src/xemacs/mule/ source tree will use the TAGS | |
990 ; ;; file in /src/xemacs/mule/. | |
991 ; ("/src/xemacs/mule/" . "/src/xemacs/mule/") | |
992 ; ;; etc. | |
993 ; ("/src/xemacs/fixup/" . "/src/xemacs/fixup/") | |
994 ; ("/src/emacs/emacs-20.6/" . "/src/emacs/emacs-20.6/") | |
995 ; ("/src/xemacs/latest/" . "/src/xemacs/latest/") | |
996 ; ;; Everywhere else will use the TAGS file in | |
997 ; ;; /src/xemacs/fixup/. | |
998 ; ("" . "/src/xemacs/fixup/") | |
999 ; )) | |
1000 | |
1001 | |
1002 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1003 ;; Change Some Aspects of GUI Appearance ;; | |
1004 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1005 | |
1006 ;; Changes the text in the window title bar, to switch to MS Windows | |
1007 ;; format (filename goes first, for best identification in icons) and | |
1008 ;; add the version and full executable path. (However, it is not | |
1009 ;; changed unless it currently has the default value, to avoid | |
1010 ;; interfering with a -wn command line argument I may have started | |
1011 ;; XEmacs with.) | |
1012 | |
1013 (if (or (equal frame-title-format "%S: %b") | |
1014 (equal frame-title-format "%b - XEmacs")) | |
1015 (setq frame-title-format | |
1016 (concat "%b - XEmacs " | |
1017 (progn (string-match "\\(.*?\\)\\( XEmacs Lucid\\)?$" | |
1018 emacs-version) | |
1019 (match-string 1 emacs-version)) | |
1020 " [" invocation-directory invocation-name "]"))) | |
1021 | |
1022 ;; Load some nifty sounds that will replace the default beep. | |
1023 ;; | |
1024 ;; (Note that sampled sounds only work if XEmacs was compiled with | |
1025 ;; sound support and we're running on MS Windows, on a machine which | |
1026 ;; has a NetAudio or ESD server, or on the console of a Linux, Sparc, | |
1027 ;; HP, or SGI machine. Otherwise, you just get the standard beep.) | |
1028 | |
558 | 1029 (cond ((and (fboundp 'load-default-sounds) |
1030 (or (and (getenv "DISPLAY") | |
1031 (string-match ":0" (getenv "DISPLAY"))) | |
1032 (and (eq (console-type) 'mswindows) | |
1033 (device-sound-enabled-p)))) | |
1034 (condition-case nil | |
1035 (progn | |
1036 (load-default-sounds) | |
1037 ;; On Windows, at least, the sound "quiet-beep", which is normally | |
1038 ;; given the symbolic name `quiet' and is used for Quit and such, | |
1039 ;; is just totally disgusting. So make this name correspond to a | |
1040 ;; more innocuous sound. | |
1041 (load-sound-file "drum-beep" 'quiet 80)) | |
1042 (error nil))) | |
462 | 1043 (t |
1044 (setq bell-volume 40) | |
1045 (setq sound-alist | |
1046 (append sound-alist '((no-completion :pitch 500)))) | |
1047 )) | |
1048 | |
1049 ;; Change the continuation glyph face so it stands out more | |
1050 (make-face-bold (glyph-face continuation-glyph)) | |
1051 | |
1052 ;; Change the pointer used during garbage collection. | |
1053 ;; | |
1054 ;; Note that this pointer image is rather large as pointers go, | |
1055 ;; and so it won't work on some X servers (such as the MIT | |
1056 ;; R5 Sun server) because servers may have lamentably small | |
1057 ;; upper limits on pointer size. | |
1058 ;;(if (featurep 'xpm) | |
1059 ;; (set-glyph-image gc-pointer-glyph | |
1060 ;; (expand-file-name "trash.xpm" data-directory))) | |
1061 | |
1062 ;; Here's another way to do that: it first tries to load the | |
1063 ;; pointer once and traps the error, just to see if it's | |
1064 ;; possible to load that pointer on this system; if it is, | |
1065 ;; then it sets gc-pointer-glyph, because we know that | |
1066 ;; will work. Otherwise, it doesn't change that variable | |
1067 ;; because we know it will just cause some error messages. | |
1068 (if (featurep 'xpm) | |
1069 (let ((file (expand-file-name "recycle.xpm" data-directory))) | |
1070 (if (condition-case nil | |
1071 ;; check to make sure we can use the pointer. | |
1072 (make-image-instance file nil | |
1073 '(pointer)) | |
1074 (error nil)) ; returns nil if an error occurred. | |
1075 (set-glyph-image gc-pointer-glyph file)))) | |
1076 | |
1077 ;(when (featurep 'menubar) | |
1078 ; ;; Add `dired' to the File menu | |
1079 ; (add-menu-button '("File") ["Edit Directory" dired]) | |
1080 | |
1081 ; ;; Here's a way to add scrollbar-like buttons to the menubar | |
1082 ; (add-menu-button nil ["Top" beginning-of-buffer]) | |
1083 ; (add-menu-button nil ["<<<" scroll-down]) | |
1084 ; (add-menu-button nil [" . " recenter]) | |
1085 ; (add-menu-button nil [">>>" scroll-up]) | |
1086 ; (add-menu-button nil ["Bot" end-of-buffer])) | |
1087 | |
1088 ;; Here's a cute hack that shows how to programmatically change some | |
1089 ;; text colors. It changes the background color of the window if it's | |
1090 ;; not on the local machine, or if it's running as root: | |
1091 | |
1092 ;; local emacs background: whitesmoke [i.e. the default color] | |
1093 ;; remote emacs background: palegreen1 | |
1094 ;; root emacs background: coral2 | |
1095 | |
1096 ;; Uncomment to enable. | |
1097 | |
1098 ;(cond | |
1099 ; ((and running-xemacs | |
1100 ; (console-on-window-system-p) | |
1101 ; ;; this does not make much sense on Windows. | |
1102 ; (not (eq system-type 'windows-nt))) | |
1103 ; (let* ((root-p (eq 0 (user-uid))) | |
1104 ; (dpy (or (getenv "DISPLAY") "")) | |
1105 ; (remote-p (not | |
1106 ; (or (string-match "^\\(\\|unix\\|localhost\\):" dpy) | |
1107 ; (let ((s (system-name))) | |
1108 ; (if (string-match "\\.\\(netscape\\|mcom\\)\\.com" s) | |
1109 ; (setq s (substring s 0 (match-beginning 0)))) | |
1110 ; (string-match (concat "^" (regexp-quote s)) dpy))))) | |
1111 ; (bg (cond (root-p "coral2") | |
1112 ; (remote-p "palegreen1") | |
1113 ; (t nil)))) | |
1114 ; (cond (bg | |
1115 ; (let ((def (color-name (face-background 'default))) | |
1116 ; (faces (face-list))) | |
1117 ; (while faces | |
1118 ; (let ((obg (face-background (car faces)))) | |
1119 ; (if (and obg (equal def (color-name obg))) | |
1120 ; (set-face-background (car faces) bg))) | |
1121 ; (setq faces (cdr faces))))))))) | |
1122 | |
1123 | |
1124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1125 ;; Changing the Modeline ;; | |
1126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1127 | |
1128 ;; Enable line numbers and column numbers. This is done in C code now | |
1129 ;; and is very fast. | |
1130 (line-number-mode 1) | |
1131 (column-number-mode 1) | |
1132 | |
1133 ;; Rearrange the modeline so that everything is to the left of the | |
1134 ;; long list of minor modes, which is relatively unimportant but takes | |
1135 ;; up so much room that anything to the right is obliterated. | |
1136 | |
1137 (setq-default | |
1138 modeline-format | |
1139 (list | |
1140 "" | |
1141 (if (boundp 'modeline-multibyte-status) 'modeline-multibyte-status "") | |
1142 (cons modeline-modified-extent 'modeline-modified) | |
1143 (cons modeline-buffer-id-extent | |
1144 (list (cons modeline-buffer-id-left-extent | |
1145 (cons 15 (list | |
1146 (list 'line-number-mode "L%l ") | |
1147 (list 'column-number-mode "C%c ") | |
1148 (cons -3 "%p")))) | |
1149 (cons modeline-buffer-id-right-extent "%17b"))) | |
1150 " " | |
1151 'global-mode-string | |
1152 " %[(" | |
1153 (cons modeline-minor-mode-extent | |
1154 (list "" 'mode-name 'minor-mode-alist)) | |
1155 (cons modeline-narrowed-extent "%n") | |
1156 'modeline-process | |
1157 ")%]----" | |
1158 "%-" | |
1159 )) | |
1160 | |
1161 ;; Get rid of modeline information taking up too much space -- in | |
1162 ;; particular, minor modes that are always enabled. | |
1163 (setq pending-delete-modeline-string "") | |
1164 (setq filladapt-mode-line-string "") | |
1165 ;; lazy-lock doesn't have a variable for its modeline name, so we have | |
1166 ;; to do a bit of surgery. | |
1167 (and (assoc 'lazy-lock-mode minor-mode-alist) | |
1168 (setcdr (cdr (cadr (assoc 'lazy-lock-mode minor-mode-alist))) "")) | |
1169 | |
1170 | |
1171 | |
1172 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1173 ;; Customization of Specific Packages ;; | |
1174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
1175 | |
1176 | |
1177 ;;; ******************** | |
1178 ;;; Load gnuserv, which will allow you to connect to XEmacs sessions | |
1179 ;;; using `gnuclient'. | |
1180 | |
1181 ;; If you never run more than one XEmacs at a time, you might want to | |
1182 ;; always start gnuserv. Otherwise it is preferable to specify | |
1183 ;; `-f gnuserv-start' on the command line to one of the XEmacsen. | |
1184 ; (gnuserv-start) | |
1185 | |
1186 | |
1187 ;;; ******************** | |
1188 ;;; Load efs, which uses the FTP protocol as a pseudo-filesystem. | |
1189 ;;; When this is loaded, the pathname syntax /user@host:/remote/path | |
1190 ;;; refers to files accessible through ftp. | |
1191 ;;; | |
558 | 1192 (Init-safe-require 'dired) |
462 | 1193 |
558 | 1194 (or (Init-safe-require 'efs-auto) (Init-safe-require 'ange-ftp)) |
462 | 1195 |
1196 ;;; ******************** | |
1197 ;;; Load the default-dir.el package which installs fancy handling of | |
1198 ;;; the initial contents in the minibuffer when reading file names. | |
558 | 1199 ;; #### but it seems to cause some breakage. |
1200 ;(Init-safe-require 'default-dir)) | |
462 | 1201 |
1202 ;;; ******************** | |
1203 ;;; Put all of your autosave files in one place, instead of scattering | |
1204 ;;; them around the file system. This has many advantages -- e.g. it | |
1205 ;;; will eliminate slowdowns caused by editing files on a slow NFS | |
1206 ;;; server. (*Provided* that your home directory is local or on a | |
1207 ;;; fast server! If not, pick a value for `auto-save-directory' that | |
1208 ;;; is fast fast fast!) | |
1209 ;;; | |
1210 ;;; Unfortunately, the code that implements this (auto-save.el) is | |
558 | 1211 ;;; broken on Windows prior to 21.4. |
462 | 1212 (unless (and (eq system-type 'windows-nt) |
558 | 1213 (not (emacs-version>= 21 4))) |
462 | 1214 (setq auto-save-directory (expand-file-name "~/.autosave/") |
1215 auto-save-directory-fallback auto-save-directory | |
1216 auto-save-hash-p nil | |
1217 efs-auto-save t | |
1218 efs-auto-save-remotely nil | |
1219 ;; now that we have auto-save-timeout, let's crank this up | |
1220 ;; for better interactive response. | |
1221 auto-save-interval 2000 | |
1222 ) | |
1223 ) | |
1224 | |
1225 | |
1226 ;;; ******************** | |
1227 ;;; cc-mode (the mode you're in when editing C, C++, and Objective C files) | |
1228 | |
1229 ;; Tell cc-mode not to check for old-style (K&R) function declarations. | |
1230 ;; This speeds up indenting a lot. | |
1231 (setq c-recognize-knr-p nil) | |
1232 | |
1233 ;; Change the indentation amount to 4 spaces instead of 2. | |
1234 ;; You have to do it in this complicated way because of the | |
1235 ;; strange way the cc-mode initializes the value of `c-basic-offset'. | |
1236 ;; (add-hook 'c-mode-hook (lambda () (setq c-basic-offset 4))) | |
1237 | |
1238 | |
1239 ;;; ******************** | |
1240 ;;; Load a partial-completion mechanism, which makes minibuffer completion | |
1241 ;;; search multiple words instead of just prefixes; for example, the command | |
1242 ;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET' | |
1243 ;;; because there are no other commands whose first three words begin with | |
1244 ;;; the letters `b', `c', and `a' respectively. | |
1245 ;;; | |
558 | 1246 (Init-safe-require 'completer) |
462 | 1247 |
1248 | |
1249 ;;; ******************** | |
1250 ;;; Load crypt, which is a package for automatically decoding and reencoding | |
1251 ;;; files by various methods - for example, you can visit a .Z or .gz file, | |
1252 ;;; edit it, and have it automatically re-compressed when you save it again. | |
1253 ;;; | |
1254 (setq crypt-encryption-type 'pgp ; default encryption mechanism | |
1255 crypt-confirm-password t ; make sure new passwords are correct | |
1256 ;crypt-never-ever-decrypt t ; if you don't encrypt anything, set this to | |
1257 ; tell it not to assume that "binary" files | |
1258 ; are encrypted and require a password. | |
1259 ) | |
558 | 1260 (Init-safe-require 'crypt) |
462 | 1261 |
1262 | |
1263 ;;; ******************** | |
1959 | 1264 ;;; Filladapt is an adaptive text-filling package. When it is enabled it |
462 | 1265 ;;; makes filling (e.g. using M-q) much much smarter about paragraphs |
1266 ;;; that are indented and/or are set off with semicolons, dashes, etc. | |
1267 | |
558 | 1268 (Init-safe-require 'filladapt) |
462 | 1269 (setq-default filladapt-mode t) |
558 | 1270 (when (fboundp 'turn-off-filladapt-mode) |
1271 (add-hook 'c-mode-hook 'turn-off-filladapt-mode) | |
1272 (add-hook 'outline-mode-hook 'turn-off-filladapt-mode)) | |
462 | 1273 |
1274 | |
1275 ;;; ******************** | |
1276 ;;; Font-Lock is a syntax-highlighting package. When it is enabled and you | |
1277 ;;; are editing a program, different parts of your program will appear in | |
1278 ;;; different fonts or colors. For example, with the code below, comments | |
1279 ;;; appear in red italics, function names in function definitions appear in | |
1280 ;;; blue bold, etc. The code below will cause font-lock to automatically be | |
1281 ;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of | |
1282 ;;; programs. | |
1283 ;;; | |
1284 ;;; The "Options" menu has some commands for controlling this as well. | |
1285 ;;; | |
1286 (cond (running-xemacs | |
1287 | |
1288 ;; The commented-out code below is an example of setting up custom | |
1289 ;; font-lock colors. | |
1290 | |
1291 ; ;; If you want the default colors, you could do this: | |
1292 ; ;; (setq font-lock-use-default-fonts nil) | |
1293 ; ;; (setq font-lock-use-default-colors t) | |
1294 ; ;; but I want to specify my own colors, so I turn off all | |
1295 ; ;; default values. | |
1296 ; (setq font-lock-use-default-fonts nil) | |
1297 ; (setq font-lock-use-default-colors nil) | |
1298 | |
558 | 1299 (Init-safe-require 'font-lock) |
462 | 1300 |
1301 ; ;; Mess around with the faces a bit. Note that you have | |
1302 ; ;; to change the font-lock-use-default-* variables *before* | |
1303 ; ;; loading font-lock, and wait till *after* loading font-lock | |
1304 ; ;; to customize the faces. | |
1305 | |
1306 ; ;; string face is green | |
1307 ; (set-face-foreground 'font-lock-string-face "forest green") | |
1308 | |
1309 ; ;; comments are italic and red; doc strings are italic | |
1310 ; (set-face-font 'font-lock-comment-face [italic]) | |
1311 ; ;; Underlining comments looks terrible on tty's | |
1312 ; (set-face-underline-p 'font-lock-comment-face nil 'global 'tty) | |
1313 ; (set-face-highlight-p 'font-lock-comment-face t 'global 'tty) | |
1314 ; (copy-face 'font-lock-comment-face 'font-lock-doc-string-face) | |
1315 ; (set-face-foreground 'font-lock-comment-face "red") | |
1316 | |
1317 ; ;; function names are bold and blue | |
1318 ; (set-face-font 'font-lock-function-name-face [bold]) | |
1319 ; (set-face-foreground 'font-lock-function-name-face "blue") | |
1320 | |
1321 ; ;; misc. faces | |
1322 ; (set-face-font 'font-lock-preprocessor-face [bold]) | |
1323 ; (set-face-font 'font-lock-type-face [italic]) | |
1324 ; (set-face-font 'font-lock-keyword-face [bold]) | |
1325 )) | |
1326 | |
1327 | |
1328 ;;; ******************** | |
1329 ;;; lazy-lock is a package which speeds up the highlighting of files | |
1330 ;;; by doing it "on-the-fly" -- only the visible portion of the | |
1331 ;;; buffer is fontified. The results may not always be quite as | |
1332 ;;; accurate as using full font-lock or fast-lock, but it's *much* | |
1333 ;;; faster. No more annoying pauses when you load files. | |
1334 | |
558 | 1335 (if (fboundp 'turn-on-lazy-lock) |
1336 (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)) | |
1337 | |
462 | 1338 ;; I personally don't like "stealth mode" (where lazy-lock starts |
1339 ;; fontifying in the background if you're idle for 30 seconds) | |
558 | 1340 ;; because it takes too long to wake up again. |
462 | 1341 (setq lazy-lock-stealth-time nil) |
1342 | |
1343 | |
1344 ;;; ******************** | |
1345 ;;; func-menu is a package that scans your source file for function | |
1346 ;;; definitions and makes a menubar entry that lets you jump to any | |
1347 ;;; particular function definition by selecting it from the menu. The | |
1348 ;;; following code turns this on for all of the recognized languages. | |
1349 ;;; Scanning the buffer takes some time, but not much. | |
1350 ;;; | |
1351 ;;; Send bug reports, enhancements etc to: | |
1352 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl> | |
1353 ;;; | |
558 | 1354 (cond ((and running-xemacs (Init-safe-require 'func-menu)) |
462 | 1355 (global-set-key '(shift f12) 'function-menu) |
1356 (add-hook 'find-file-hooks 'fume-add-menubar-entry) | |
1357 (global-set-key "\C-cl" 'fume-list-functions) | |
1358 (global-set-key "\C-cg" 'fume-prompt-function-goto) | |
1359 | |
1360 ;; The Hyperbole information manager package uses (shift button2) and | |
1361 ;; (shift button3) to provide context-sensitive mouse keys. If you | |
1362 ;; use this next binding, it will conflict with Hyperbole's setup. | |
1363 ;; Choose another mouse key if you use Hyperbole. | |
1364 (global-set-key '(shift button3) 'mouse-function-menu) | |
1365 | |
1366 ;; For descriptions of the following user-customizable variables, | |
1367 ;; type C-h v <variable> | |
1368 (setq fume-max-items 25 | |
1369 fume-fn-window-position 3 | |
1370 fume-auto-position-popup t | |
1371 fume-display-in-modeline-p t | |
1372 fume-menubar-menu-name | |
1373 (if (fboundp 'submenu-generate-accelerator-spec) | |
1374 "Function%_s" "Functions") | |
1375 fume-buffer-name "*Function List*" | |
1376 fume-no-prompt-on-valid-default nil) | |
1377 )) | |
1378 | |
1379 | |
1380 ;;; ******************** | |
1381 ;;; MH is a mail-reading system from the Rand Corporation that relies on a | |
1382 ;;; number of external filter programs (which do not come with emacs.) | |
1383 ;;; Emacs provides a nice front-end onto MH, called "mh-e". | |
1384 ;;; | |
1385 ;; Bindings that let you send or read mail using MH | |
1386 ;(global-set-key "\C-xm" 'mh-smail) | |
1387 ;(global-set-key "\C-x4m" 'mh-smail-other-window) | |
1388 ;(global-set-key "\C-cr" 'mh-rmail) | |
1389 | |
1390 ;; Customization of MH behavior. | |
1391 (setq mh-delete-yanked-msg-window t) | |
1392 (setq mh-yank-from-start-of-msg 'body) | |
1393 (setq mh-summary-height 11) | |
1394 | |
1395 ;; Use lines like the following if your version of MH | |
1396 ;; is in a special place. | |
1397 ;(setq mh-progs "/usr/dist/pkgs/mh/bin.svr4/") | |
1398 ;(setq mh-lib "/usr/dist/pkgs/mh/lib.svr4/") | |
1399 | |
1400 | |
1401 ;;; ******************** | |
1402 ;;; resize-minibuffer-mode makes the minibuffer automatically | |
863 | 1403 ;;; resize as necessary when it's too small to hold its contents. |
462 | 1404 |
558 | 1405 (when (fboundp 'resize-minibuffer-mode) |
1406 (resize-minibuffer-mode) | |
1407 (setq resize-minibuffer-window-exactly nil)) | |
462 | 1408 |
1409 | |
1410 ;;; ******************** | |
1411 ;;; scroll-in-place is a package that keeps the cursor on the same line (and in the same column) when scrolling by a page using PgUp/PgDn. | |
1412 | |
558 | 1413 (if (Init-safe-require 'scroll-in-place) |
1414 (turn-on-scroll-in-place)) | |
462 | 1415 |
1416 | |
1417 ;;; ******************** | |
1418 ;;; W3 is a browser for the World Wide Web, and takes advantage of the very | |
1419 ;;; latest redisplay features in XEmacs. You can access it simply by typing | |
1420 ;;; 'M-x w3'; however, if you're unlucky enough to be on a machine that is | |
1421 ;;; behind a firewall, you will have to do something like this first: | |
1422 | |
1423 ;(setq w3-use-telnet t | |
1424 ; ;; | |
1425 ; ;; If the Telnet program you use to access the outside world is | |
1426 ; ;; not called "telnet", specify its name like this. | |
1427 ; w3-telnet-prog "itelnet" | |
1428 ; ;; | |
1429 ; ;; If your Telnet program adds lines of junk at the beginning | |
1430 ; ;; of the session, specify the number of lines here. | |
1431 ; w3-telnet-header-length 4 | |
1432 ; ) | |
863 | 1433 |
1434 ;;; Inhibit loading of custom-file | |
1435 | |
1436 ;; make-temp-name returns a name which does not refer to an existing file, | |
1437 ;; and thus the named file is unreadable. | |
1438 (when Init-inhibit-custom-file-p | |
1439 (setq custom-file (make-temp-name "/tmp/non-existent-"))) | |
1440 |