comparison lisp/behavior-defs.el @ 558:ed498ef2108b

[xemacs-hg @ 2001-05-23 09:59:33 by ben] xemacs.mak: call `ver' to get the exact os version and put it in the installation; suggestion from adrian. behavior-defs.el: Add scroll-in-place, jka-compr, efs, fix up some things. pop.c: Remove BROKEN_CYGWIN. etc\sample.init.el: Rewrite to be much more careful about loading features -- now it decays gracefully even in the complete absence of packages. Also avoid doing obnoxious things when loading efs. configure.in: add some support for eventually turning on file coding by default. Fix numerous places where AC_MSG_WARN had quotes around its arg, which is bad. Replace with []. Same for AC_MSG_ERROR. s\cygwin32.h, s\mingw32.h: remove support for way old beta versions of cygwin. don't put -Wno-sign-compare in the system switches; this isn't a system issue. define BROKEN_SIGIO for cygwin to get C-g support. device-msw.c: signal an error rather than crash with an unavailable network printer (from Mike Alexander). event-msw.c: cleanup headers. fix (hopefully) an error with data corruption when sending to a network connection. fileio.c: Fix evil code that attempts to handle the ~user prefix by (a) always assuming we're referencing ourselves and not even verifying the user -- hence any file with a tilde as its first char is invalid! (b) if there wasn't a slash following the filename, the pointer was set *past* the end of file and we started reading from uninitialized memory. Now we simply treat these as files, always. optionally for 21.4 (doc fix): lread.c: cambia de pas_de_lache_ici -- al minimo usa la palabra certa. frame.c: fix warnings. emacs.c, nt.c, ntproc.c, process-nt.c, realpath.c, unexnt.c: rename MAX_PATH to standard PATH_MAX. process-nt.c, realpath.c: cleanup headers. process-unix.c, sysdep.c, systime.h, syswindows.h: kill BROKEN_CYGWIN and support for way old beta versions of cygwin. sysfile.h: use _MAX_PATH (Windows) preferentially for PATH_MAX if defined. include io.h on Cygwin (we need get_osfhandle()). include sys/fcntl.h always, since we were including it in various header files anyway. unexcw.c: fix up style to conform to standard. remove duplicate definition of PERROR. buffer.c: comment change. database.c, debug.h, device-tty.c, dired-msw.c, glyphs-msw.c: header cleanups (remove places that directly include a system header file, because we have our own layer to do this more cleanly and portably); indentation fixes.
author ben
date Wed, 23 May 2001 09:59:48 +0000
parents 7039e6323819
children 943eaba38521
comparison
equal deleted inserted replaced
557:f486da5f1a3b 558:ed498ef2108b
35 35
36 ;;; Code: 36 ;;; Code:
37 37
38 (require 'behavior) 38 (require 'behavior)
39 39
40 (define-behavior 'scroll-in-place
41 "This package provides improved vertical scrolling commands for XEmacs.
42 These new commands offer the following features:
43
44 + When a scrolling command is executed, XEmacs tries to keep point as
45 close as possible to its original window position (window line and
46 column). This is what \"scroll in place\" means: point stays \"in place\"
47 within the window. (There are times when point must be moved from its
48 original window position in order to execute the scroll; see below.)
49
50 The variable `scroll-in-place', which is true by default, determines
51 whether or not the standard XEmacs scrolling commands (`scroll-down',
52 `scroll-up', `scroll-other-window-down', and `scroll-other-window') use
53 the \"in place\" features listed here. When `scroll-in-place' is `nil'
54 the standard XEmacs scrolling commands essentially just call the
55 original versions of themselves. (Note that even when `scroll-in-place'
56 is `nil' the new versions of `scroll-down' and `scroll-up' have slightly
57 different behavior when a minibuffer window is the selected window. See
58 below.)
59
60 It is possible to turn off (or turn on) \"in place\" scrolling for certain
61 buffers by making buffer-local bindings of the variable `scroll-in-
62 place' for those buffers. The variable `scroll-in-place' is not usually
63 buffer-local, but you can make it so if you desire.
64
65 + Because the improved scrolling commands keep point at its original
66 window position, these scrolling commands are \"reversible.\" The
67 `scroll-up' command undoes the effect of the immediately previous
68 `scroll-down' command (if any) and vice versa. In other words, if you
69 scroll up and then immediately scroll back down, the window config-
70 uration is restored to its exact original state. This allows you to
71 browse through a buffer more easily, as you can always get back to the
72 original configuration.
73
74 Note, however, that the improved scrolling commands are guaranteed to be
75 reversible only if there are no intervening non-scrolling commands.
76 Also, if you give a prefix argument to a scrolling command (in order to
77 specify the number of lines to scroll by), previous scrolling commands
78 may no longer be reversible. More specifically, if the new prefix
79 argument has a different magnitude than the previous scrolling distance,
80 then any previous scrolling commands are not reversible. The new prefix
81 argument takes precedence.
82
83 You might find it useful to think of the scrolling commands as forming
84 \"chains.\" A scrolling command either starts or continues a chain. By
85 issuing a non-scrolling command or by changing the number of lines to be
86 scrolled, you break the chain. (Note that simply changing the scrolling
87 direction won't break the chain; changing the absolute number of lines
88 to be scrolled is what breaks the chain.) Scrolling commands are
89 guaranteed to be reversible only within the current chain. Hopefully
90 that's clear enough.
91
92 + When a scrolling command is given a prefix argument (which specifies the
93 number of lines to scroll by), then that argument becomes the default
94 scrolling distance for all immediately subsequent scrolling commands.
95 This means that you can easily set the scrolling distance for a chain
96 of scrolling commands. Note that a new prefix argument or any non-
97 scrolling command breaks the chain (as described above), and any further
98 scrolling commands will use the usual defaults (or the prefix argument
99 you specify at that time, of course).
100
101 However, there are cases in which one doesn't want the current scrolling
102 command to use the default scrolling distance that was set by the
103 previous scrolling command. For example, suppose that you had special
104 commands that scrolled one line up and one line down. When you invoke
105 one of these commands, the \"in place\" scrolling routines set the default
106 scrolling distance to be just one line. Now suppose that you use one of
107 your special commands and then immediately invoke `scroll-up' (`C-v'),
108 expecting it to scroll by a near windowful of text. You would be
109 disappointed --- because the previous command set the default scrolling
110 distance to be just one line, `scroll-up' just scrolls by one line.
111
112 To solve this problem, \"scroll-in-place\" allows you to divide scrolling
113 commands into separate \"groups.\" Commands in a group can only form
114 chains with (and therefore, inherit defaults from) commands in the same
115 group. (Note that no command can be in more than one group.) If you
116 invoke a scrolling command that is not in the same group as that of the
117 immediately previous scrolling command, then the previous chain is
118 broken and you start a new chain --- with a new set of defaults.
119
120 So to solve the problem described above, you could put your one-line
121 scrolling commands in their own group. Once that is done, the standard
122 scrolling commands will not form chains with your one-line scrolling
123 commands, and therefore will not use the default scrolling distance set
124 by those commands. Problem solved!
125
126 By default, all \"in place\" scrolling commands are in a single group. If
127 you want to partition some commands into separate groups, you must do
128 that yourself *before* any \"in place\" commands are invoked. For more
129 information about grouping commands, see the documentation for the
130 variables `scroll-command-groups' and `scroll-default-command-group'.
131
132 + The improved scrolling commands will avoid displaying empty lines past
133 the end of the buffer when possible. In other words, just as you can't
134 see \"dead space\" before the beginning of the buffer text, the new
135 scrolling commands try to avoid displaying \"dead space\" past the end of
136 the buffer text. This behavior is somewhat configurable; see the
137 documentation for the variable `scroll-allow-blank-lines-past-eob'.
138
139 Dead space will be displayed if it is necessary in order to make a
140 previous scrolling action reversible, however.
141
142 + If the scrolling commands cannot keep point at its initial window
143 position (because a buffer boundary is on screen and the window can't be
144 scrolled as far as necessary to keep point at the right place), point is
145 allowed to temporarily stray from its initial window position. That is,
146 point moves the correct number of window lines, even if it means that it
147 has to stray from its desired window position. This straying is undone
148 when (and if) the scrolling action is reversed.
149
150 + If a scrolling command tries to move point past a buffer boundary, point
151 is instead moved to the boundary (the beginning or the end of the buffer
152 as appropriate) and an appropriate message is displayed. This motion is
153 reversible, of course.
154
155 However, if point was already at the buffer boundary when the scrolling
156 command was invoked, the command signals an appropriate error instead.
157
158 + When a minibuffer window is the selected window, the new versions of
159 `scroll-up' and `scroll-down' either scroll the window in the variable
160 `minibuffer-scroll-window' (which is usually the window of completions)
161 or the `next-window' if there is no `minibuffer-scroll-window'. This is
162 usually much more useful than scrolling the minibuffer itself. (Note
163 that this feature is available even when the variable `scroll-in-place'
164 is `nil'.)
165
166 + When a scrolling command is scrolling a window other than the selected
167 window, it will signal an appropriate buffer boundary error if the
168 window cannot be scrolled (because the appropriate buffer boundary is
169 already visible). This means that an error is signalled even in cases
170 that would be allowed (by \"straying\" point or by moving it to the buffer
171 boundary) if the window were selected.
172
173 (If an error were not signalled in these cases, then there would be many
174 cases in which the last scroll in a particular direction would appear to
175 do nothing because only the point position would change --- the
176 displayed text would stay the same! To avoid these cases the scrolling
177 commands signal boundary errors \"prematurely\" when the window to be
178 scrolled is not selected.)"
179 :short-doc "Keep cursor on same line when scrolling"
180 :require 'scroll-in-place
181 :enable #'turn-on-scroll-in-place
182 :disable #'turn-off-scroll-in-place)
183
40 (define-behavior 'mouse-avoidance 184 (define-behavior 'mouse-avoidance
41 "Mouse avoidance mode" 185 "For those who are annoyed by the mouse pointer obscuring text,
42 :title "Mouse Avoidance" 186 this mode moves the mouse pointer - either just a little out of
187 the way, or all the way to the corner of the frame.
188
189 Customize `mouse-avoidance-mode' to one of the symbols `banish',
190 `exile', `jump', `animate', `cat-and-mouse', `proteus', or `none'.
191
192 Effects of the different modes:
193 * banish: Move the mouse to the upper-right corner on any keypress.
194 * exile: Move the mouse to the corner only if the cursor gets too close,
195 and allow it to return once the cursor is out of the way.
196 * jump: If the cursor gets too close to the mouse, displace the mouse
197 a random distance & direction.
198 * animate: As `jump', but shows steps along the way for illusion of motion.
199 * cat-and-mouse: Same as `animate'.
200 * proteus: As `animate', but changes the shape of the mouse pointer too.
201
202 Whenever the mouse is moved, the frame is also raised.
203
204 \(see `mouse-avoidance-threshold' for definition of \"too close\",
205 and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
206 definition of \"random distance\".)"
207 :short-doc "Keep mouse away from cursor"
43 :enable #'(lambda () 208 :enable #'(lambda ()
44 (mouse-avoidance-mode 'animate)) 209 (mouse-avoidance-mode 'animate))
45 :disable #'(lambda () 210 :disable #'(lambda ()
46 (mouse-avoidance-mode 'none))) 211 (mouse-avoidance-mode 'none)))
212
213 (define-behavior 'jka-compr
214 "This package implements low-level support for reading, writing,
215 and loading compressed files. It hooks into the low-level file
216 I/O functions (including write-region and insert-file-contents) so
217 that they automatically compress or uncompress a file if the file
218 appears to need it (based on the extension of the file name).
219 Packages like Rmail, VM, GNUS, and Info should be able to work
220 with compressed files without modification."
221 :short-doc "Transparently handle compressed files"
222 :enable #'jka-compr-install
223 :disable #'jka-compr-uninstall)
224
225 (define-behavior 'efs
226 "EFS is a system for transparent file-transfer between remote VMS, CMS,
227 MTS, MVS, Twenex, Explorer (the last two are Lisp machines), TOPS-20,
228 DOS (running the Distinct, Novell, FTP software, NCSA, Microsoft in both
229 unix and DOS mode, Super TCP, and Hellsoft FTP servers), Windows NT
230 \(running the Microsoft or Hummingbird ftp servers), Unix descriptive
231 listings (dl), KA9Q, OS/2 hosts using FTP. This means that you can edit,
232 copy and otherwise manipulate files on any machine you have access to
233 from within Emacs as if it were a local file. EFS works by introducing
234 an extended filename syntax, and overloading functions such as
235 `insert-file-contents' so that accessing a remote file causes
236 appropriate commands to be sent to an FTP process.
237
238 The syntax to use is like this:
239
240 \(for anonymous:) /ftp.xemacs.org:/pub/xemacs/
241 \(for non-anonymous:) /ben@gwyn.tux.org:/etc/mail/xemacs/aliases-xemacs
242
243 You can specify either a file or a directory (in the latter case,
244 Dired will be brought up). All operations in XEmacs on such files
245 should work exactly as on any other files, modulo the additional
246 slowness."
247 :short-doc "Transparent file access over FTP"
248 :require 'efs-auto
249 :enable #'ignore
250 ;; can't :disable
251 )
252
47 253
48 (define-behavior 'resize-minibuffer 254 (define-behavior 'resize-minibuffer
49 "When this behavior is enabled, the minibuffer is dynamically resized to 255 "When this behavior is enabled, the minibuffer is dynamically resized to
50 contain the entire region of text put in it as you type. 256 contain the entire region of text put in it as you type.
51 257
61 way to make more text visible at once is to increase the size of the frame. 267 way to make more text visible at once is to increase the size of the frame.
62 The variable `resize-minibuffer-frame' controls whether this should be 268 The variable `resize-minibuffer-frame' controls whether this should be
63 done. The variables `resize-minibuffer-frame-max-height' and 269 done. The variables `resize-minibuffer-frame-max-height' and
64 `resize-minibuffer-frame-exactly' are analogous to their window 270 `resize-minibuffer-frame-exactly' are analogous to their window
65 counterparts." 271 counterparts."
66 :title "Resize Minibuffer Automatically" 272 :short-doc "Resize minibuffer automatically"
67 :enable #'(lambda () 273 :enable #'(lambda ()
68 (resize-minibuffer-mode 1)) 274 (resize-minibuffer-mode 1))
69 :disable #'(lambda () 275 :disable #'(lambda ()
70 (resize-minibuffer-mode -1))) 276 (resize-minibuffer-mode -1)))
71 277
77 that very function. The mark is pushed on the mark-ring, so you can 283 that very function. The mark is pushed on the mark-ring, so you can
78 easily go back to where you were. Alternatively, you can use enter the 284 easily go back to where you were. Alternatively, you can use enter the
79 name of the desired function via the minibuffer which offers 285 name of the desired function via the minibuffer which offers
80 completing read input. In addition, the name of the function before 286 completing read input. In addition, the name of the function before
81 point is optionally displayed in the modeline." 287 point is optionally displayed in the modeline."
82 :title "Function Menu" 288 :short-doc "Add a menu of defined functions"
83 :require 'func-menu 289 :require 'func-menu
84 :enable #'(lambda () 290 :enable #'(lambda ()
85 (add-hook 'find-file-hooks 'fume-add-menubar-entry) 291 (add-hook 'find-file-hooks 'fume-add-menubar-entry)
86 (mapc #'(lambda (buffer) 292 (mapc #'(lambda (buffer)
87 (with-current-buffer buffer 293 (with-current-buffer buffer
109 crop of mice. Under XFree86 and the XSuSE X Servers, the wheel 315 crop of mice. Under XFree86 and the XSuSE X Servers, the wheel
110 events are sent as button4/button5 events, which are automatically 316 events are sent as button4/button5 events, which are automatically
111 set up to do scrolling in the expected way. The actual way that the 317 set up to do scrolling in the expected way. The actual way that the
112 scrolling works can be controlled by `mwheel-scroll-amount' and 318 scrolling works can be controlled by `mwheel-scroll-amount' and
113 `mwheel-follow-mouse'." 319 `mwheel-follow-mouse'."
114 :title "Mouse Wheel Support" 320 :short-doc "Mouse wheel support for X Windows"
115 :enable 'mwheel-install) 321 :enable 'mwheel-install)
116 322
117 (define-behavior 'recent-files 323 (define-behavior 'recent-files
118 "Recent-files adds the menu \"Recent Files\" (or whatever name you 324 "Recent-files adds the menu \"Recent Files\" (or whatever name you
119 choose, see \"Customization:\" below) to Emacs's menubar. Its 325 choose, see \"Customization:\" below) to Emacs's menubar. Its
261 unconditionally when Emacs exits. If you have two Emacs 467 unconditionally when Emacs exits. If you have two Emacs
262 processes running, the one exiting later will overwrite the 468 processes running, the one exiting later will overwrite the
263 file without merging in the new entries from the other Emacs 469 file without merging in the new entries from the other Emacs
264 process. This can be avoided by disabling the save on exit from 470 process. This can be avoided by disabling the save on exit from
265 the menu." 471 the menu."
266 :title "Recent Files Menu" 472 :short-doc "`Recent Files' menu"
267 :enable 'recent-files-initialize) 473 :enable 'recent-files-initialize)
268 474
269 (define-behavior 'filladapt 475 (define-behavior 'filladapt
270 "These functions enhance the default behavior of Emacs' Auto Fill 476 "These functions enhance the default behavior of Emacs' Auto Fill
271 mode and the commands `fill-paragraph', `lisp-fill-paragraph', 477 mode and the commands `fill-paragraph', `lisp-fill-paragraph',
279 485
280 The net result of this is that blurbs of text that are offset 486 The net result of this is that blurbs of text that are offset
281 from left margin by asterisks, dashes, and/or spaces, numbered 487 from left margin by asterisks, dashes, and/or spaces, numbered
282 examples, included text from USENET news articles, etc. are 488 examples, included text from USENET news articles, etc. are
283 generally filled correctly with no fuss." 489 generally filled correctly with no fuss."
284 :title "Adaptive Filling" 490 :short-doc "Adaptive (smart) filling"
285 :require 'filladapt 491 :require 'filladapt
286 :enable #'(lambda () 492 :enable #'(lambda ()
287 (setq-default filladapt-mode t) 493 (setq-default filladapt-mode t)
288 (mapc #'(lambda (buffer) 494 (mapc #'(lambda (buffer)
289 (with-current-buffer buffer 495 (with-current-buffer buffer