annotate etc/sample.init.el @ 771:943eaba38521

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