edit-utils.texi
- Provided by: xemacs21-basesupport (Version: 2009.02.17.dfsg.2-4)
- Source: xemacs21-packages
- Report a bug
@c @copying This manual is part of XEmacs.
XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @c @end copying
@node Top, Copying, (dir), (dir) @chapter The Editing Utilities Package
@ifinfo This Info file contains the manual for the Editing Utilities package. @end ifinfo
The node name for each entry in the menu is the name of the elisp file containing the code that implements the functionality described. It is highly recommended that you briefly peruse the elisp source code since it can provide valuable information on usage and technique. This can easily be done by typing @code{C-x 4 l <filename> RET} where <filename> is the name of the elisp file to be loaded.
@menu * Copying:: Why this manual is GPL, and what that means
Buffer and Window Management * compare-w:: Comparing Windows * detached-minibuf:: Detached Minibuffers * iswitchb:: Convenient Buffer Switching * permanent-buffers:: Permanent Buffers * rsz-minibuf:: Self-Resizing Minibuffer * search-buffers:: Searching Many Buffers * uniquify:: Meaningful Unique Names * winring:: Window Configuration Rings * autorevert:: Reverting Buffers
Editing Help * foldout:: Folding Extensions for Outline-Mode * func-menu:: Jump to a Function Within a Buffer. * id-select:: Select Syntax-Driven Regions in a Buffer * outl-mouse:: Outline-Mode Mouse Commands * page-ext:: Extended Page Handling Commands * power-macros:: Power Macros - Keyboard Macros Made Easy * redo:: Redo/Undo System * scroll-in-place:: Scrolling In Place * setnu:: VI-style Line Number Mode * vertical-mode:: Vertical Mode - Editing of Vertical Text * align:: Align Text to a Specific Column, By Regexp * allout:: Extensive Outline Mode * narrow-stack:: Extending the built-in narrowing functions
File Management * backup-dir:: Specify Directories to be Used for Backup Files
Session Management * bookmark:: Create annotated bookmarks * desktop:: Save Partial Status of Emacs When Killed * recent-files:: Recent File Navigation * resume:: Resuming a Suspended Emacs Job * saveconf:: Save Buffer/Window Configuration Between Sessions * savehist:: Save Minibuffer History * saveplace:: Automatically Save Place in Files * where-was-i-db:: Keep Persistent State in Visited Files
Abbreviations * completion:: Completion * dabbrev:: Dynamic Abbreviations * hippie-exp:: Hippie Expand * icomplete:: Interactive Minibuffer Completion * tempo:: Flexible Template Insertion
Display, Faces, and Highlighting: * avoid:: Move Mouse Pointer Out of the Way of Editing * blink-cursor:: Blinking Cursor * fast-lock:: Speeding Up Font Lock Mode * lazy-lock:: Lazy Demand-Driven Fontification * lazy-shot:: Another Lazy Demand-Driven Fontification * mic-paren:: Advanced Highlighting of Matching Parentheses * paren:: Highlight (Un)matching Parens and Whole Expressions * shell-font:: Decorate a Shell Buffer With Fonts * highline:: Highlight the Current Line in the Buffer
Low-Level Editing Hacks: * after-save-commands:: Hooks Invoked After Saving a File * atomic-extents:: Indivisible Blocks of Text * array:: Table and Array Editor
Menu and Toolbar Support: * floating-toolbar:: Floating Toolbar * The Toolbar Utilities:: Creating and Managing Toolbars and Buttons.
Miscellaneous: * flow-ctrl:: Flow Control * makesum:: Generate Summary of All Key Binding * man:: Browse UNIX manual pages
Undocumented: * abbrevlist:: Abbreviation List * file-part:: Treat a Section of a Buffer as a Separate File * info-look:: Major-Mode-Sensitive Info Index Lookup Facility * live-icon:: Make Frame Icons Represent Current Frame Contents * mode-motion+:: Per Mode/Buffer Mouse Tracking With Highlighting * popper:: Shrink-Wrapped Temporary Windows * reportmail:: Display Time and Load in Mode Line * balloon-help:: Balloon Help and Tooltips * blink-paren:: Blinking Parentheses * edit-faces:: Face Editor * lispm-fonts:: lispm-fonts * big-menubar:: Big Menubar * tree-menu:: tree-menu.el
Appendices: * XEmacs License:: The GNU General Public License @end menu
@node Copying, compare-w, Top, Top @chapter Copying
This document may be redistributed, verbatim or in modified form, under the terms of the GNU General Public License, version 2 or any later version. The same terms apply to the libraries it documents. A copy of the General Public License is provided as an Appendix.
Most XEmacs documentation has its own license, which is an ancestor of the GNU Free Documentation License (@dfn{FDL}), and whose terms are quite similar to those imposed by GNU on Emacs documentation. Why is this manual licensed differently (under the GNU General Public License, or @dfn{GPL}), and why does it have to be distributed separately from the XEmacs User's Guide and the XEmacs Lisp Reference Manual?
Taking the second question first, XEmacs is @dfn{community-owned} software. That is, unlike GNU Emacs, there is no monopoly copyright holder. Many of us, including the original Lucid authors, have contributed our copyrights to the Free Software Foundation (FSF), and of course much content is derived from GNU Emacs, and therefore is held by the FSF. Another large chunk is held by Sun Microsystems, and a few individual authors hold copyright to thousands of lines each. But many individuals hold copyright to only a few dozen lines. Like the Linux kernel, copyright ownership is distributed throughout a community.
However, its license is ``copyleft,'' @emph{i.e.}, it @emph{requires} that you redistribute it under terms @emph{identical} to those under which you received it, unless you have explicit permission of the copyright holder. Because of the multiple owners, determining the ownership of any given part of XEmacs is tedious, and perhaps impossible. For practical purposes, then, the license of any substantial chunk of existing XEmacs content cannot be changed, except to a later version of the GPL, for those parts under GPL. (That is due to the @emph{explicit} permission to change to a later version of the GPL, present in every file of XEmacs.)
Unfortunately, this severe restriction means that the GPL, FDL, and the XEmacs documentation license (@dfn{XDL}) are @emph{mutually incompatible}. That is, content licensed under any of the GPL, FDL, or XDL @emph{may not} be mixed with content licensed under either of the other two without changing the license of some of the content. But this requires permission of the copyright holder, which is often difficult or impossible to get.
For example, you @emph{may not} take comments or docstrings from XEmacs code and add them to the Lispref to mend a gap in the latter's coverage. You @emph{may not} copy text from the Lispref into docstrings in the code. And you @emph{may not} copy text from the GNU Emacs Lisp Reference to the XEmacs Lisp Reference Manual. (In this case it is at least trivial to ask permission, although it is rather unclear whether it would be granted.)
In fact, parts of this document were derived by copying from XEmacs code under the GPL, without any further permission from the authors. Thus, this document must be distributed under the GPL, as a ``volume'' separate from the XEmacs documentation under the XDL. Note that the ``mere aggregation'' clauses allow us to distribute in the same tarball. But incorporating it as a node in the Lispref is prohibited, even if done by inclusion.
A bit of advocacy:
If you look carefully at the additional restrictions imposed by the soi-disant "free" documentation licenses, you discover that they are simply proprietary restrictions guaranteeing a certain amount of @emph{unpaid} political advertising to the Free Software Foundation and GNU Project (and in the case of the FDL, this is extended to commercial advertising by authors of original or derived works). Whether this is ``ethically justified'' or not is a difficult question. What is certain is that there is little social benefit to these terms (since the license documents themselves contain the advocacy and must be included with any distribution).
I conclude it makes sense for XEmacs to reduce its restrictions, where possible, to the ``least common denominator,'' the GNU General Public License.
@node compare-w, detached-minibuf, Copying, Top @chapter Comparing Windows
This package provides one entry point, compare-windows. It compares text starting from point in two adjacent windows, advancing point until it finds a difference. There are variables to permit ignoring of whitespace differences, or case differences, or both.
@node detached-minibuf, iswitchb, compare-w, Top @chapter Detached Minibuffers
This package creates a standalone minibuffer in its own frame.
To configure this package, type:
@example
M-x customize-group RET detached-minibuf RET @end example
@node iswitchb, permanent-buffers, detached-minibuf, Top @chapter Convenient Buffer Switching
With this package installed, as you type in a substring, the list of buffers currently matching the substring are displayed as you type. The list is ordered so that the most recent buffers visited come at the start of the list. The buffer at the start of the list will be the one visited when you press return. By typing more of the substring, the list is narrowed down so that gradually the buffer you want will be at the top of the list. Alternatively, you can use @kbd{C-s} and @kbd{C-r} to rotate buffer names in the list until the one you want is at the top of the list. Completion is also available so that you can see what is common to all of the matching buffers as you type.
For example, let's say we have two buffers called "123456" and "123", with "123456" the most recent. When I use @samp{iswitchb}, I first of all get presented with the list of all the buffers
@samp{iswitch @{123456,123@}}
If I then press @kbd{2}:
@samp{iswitch 2[3]@{123456,123@}}
The list in @{@} are the matching buffers, most recent first (buffers visible in the current frame are put at the end of the list by default). At any time I can select the item at the head of the list by pressing @kbd{RET}. I can also bring the put the first element at the end of the list by pressing @kbd{C-s}, or put the last element at the head of the list by pressing @kbd{C-r}. The item in [] indicates what can be added to my input by pressing @kbd{TAB}. In this case, I will get @samp{3} added to my input. So, press @kbd{TAB}:
@samp{iswitch 23@{123456,123@}}
At this point, I still have two matching buffers. If I want the first buffer in the list, I simply press @kbd{RET}. If I wanted the second in the list, I could press @kbd{C-s} to move it to the top of the list and then @kbd{RET} to select it.
However, If I type @kbd{4}, I only have one match left:
@samp{iswitch 234[123456] [Matched]}
Since there is only one matching buffer left, it is given in @samp{[]} and we see the text @samp{[Matched]} afterwards. I can now press @kbd{TAB} or @kbd{RET} to go to that buffer.
If however, I now type @kbd{a}:
@samp{iswitch 234a [No match]}
There are no matching buffers. If I press @kbd{RET} or @kbd{TAB}, I can be prompted to create a new buffer called "234a".
Of course, where this function comes in really useful is when you can specify the buffer using only a few keystrokes. In the above example, the quickest way to get to the "123456" buffer would be just to type @kbd{4} and then @kbd{RET} (assuming there isn't any newer buffer with "4" in its name).
To see a full list of all matching buffers in a separate buffer, hit @kbd{?} or press @kbd{TAB} when there are no further completions to the substring. Repeated @kbd{TAB} presses will scroll you through this separate buffer.
The buffer at the head of the list can be killed by pressing @kbd{C-k}. If the buffer needs saving, you will be queried before the buffer is killed.
If you find that the file you are after is not in a buffer, you can press @kbd{C-x C-f} to immediately drop into find-file.
To see the doc string of iswitchb for full keybindings and features, type:
@example
M-x describe-function RET iswitchb @end example
@menu * Customization: iswitchb-cust. * Changing the Display:: * Regexp Matching:: * Replacement for read-buffer:: @end menu
@node iswitchb-cust, Changing the Display, iswitchb, iswitchb @section Customization
To configure the package, type:
@example
M-x customize-group RET iswitchb RET @end example
To install this package on the default keys used for buffer switching, type:
@example
M-x iswitchb-default-keybindings RET @end example
To modify the default keybindings, use the hook provided. For example, the following code can be added to your initialization file:
@example
(add-hook 'iswitchb-define-mode-map-hook 'iswitchb-my-keys)
(defun iswitchb-my-keys ()
"Add my keybindings for iswitchb."
(define-key iswitchb-mode-map " " 'iswitchb-next-match)
) @end example
@node Changing the Display, Regexp Matching, iswitchb-cust, iswitchb @section Changing the Display
If you have many matching buffers, they may not all fit onto one line of the minibuffer. In this case, you should use @code{(resize-minibuffer-mode)} @xref{rsz-minibuf}. You can also limit iswitchb so that it only shows a certain number of lines. To do this, see the documentation for @code{iswitchb-minibuffer-setup-hook}.
By default, the list of current buffers is most recent first, oldest last, with the exception that the buffers visible in the current frame are put at the end of the list. A hook exists to allow other functions to order the list. For example, if you add:
@example
(add-hook 'iswitchb-make-buflist-hook 'iswitchb-summaries-to-end) @end
example
then all buffers matching "Summary" are moved to the end of the list. (I find this handy for keeping the INBOX Summary and so on out of the way.) It also moves buffers matching "output" to the end of the list (these are created by AUC TeX when compiling.) Other functions could be made available which alter the list of matching buffers (either deleting or rearranging elements.)
If you have font-lock loaded, the first matching buffer is highlighted. To switch this off, set @code{(setq iswitchb-use-fonts nil)}. I don't use font-lock that much, so I've hardcoded the faces. If this is too harsh, let me know. Colouring of the matching buffer name was suggested by Carsten Dominik (dominik@@strw.leidenuniv.nl)
@node Regexp Matching, Replacement for read-buffer, Changing the Display, iswitchb @section Regexp Matching
There is limited provision for regexp matching within @code{iswitchb}, enabled through @code{iswitchb-regexp}. This allows you to type @kbd{c$} for example and see all buffer names ending in `c'. This facility is quite limited though in two respects. First, you can't currently type in expressions like `[0-9]' directly -- you have to type them in when @code{iswitchb-regexp} is @code{nil} and then toggle on the regexp functionality. Likewise, don't enter an expression containing `´ in regexp mode. If you try, iswitchb gets confused, so just hit @kbd{C-g} and try again. Secondly, no completion mechanism is currently offered when regexp searching.
@node Replacement for read-buffer, , Regexp Matching, iswitchb @section Replacement for read-buffer
iswitchb-read-buffer has been written to be a drop in replacement for the normal buffer selection routine @code{read-buffer}. To use iswitch for all buffer selections in Emacs, add: @code{(setq read-buffer-function XEmacs users can get the same behaviour by doing: @code{(defalias lisp.
@node permanent-buffers, rsz-minibuf, iswitchb, Top @chapter Permanent Buffers
A permanent buffer is a buffer that you don't want to kill, mainly used for testing or temporary stuff. The *scratch* buffer is the most famous example of what could be a permanent buffer. This package allows you to define several permanent buffers (the scratch buffer can be one of them) that will never disappear. If you kill them or save their contents, they will be regenerated. You can also specify a set of lisp forms to eval in the buffer when it is (re)generated.
This package is implemented in a minor-mode fashion. You can customize the default value of @code{permanent-buffers-mode} or use @code{turn-on-permanent-buffers} at startup. Within an XEmacs session, use @code{permanent-buffers-mode} or @code{turn-o[n|ff]-permanent-buffers}. You might also want to customize @code{permanent-buffers-alist}.
To configure this package, type:
@example
M-x customize-group RET permanent-buffers RET @end example
@node rsz-minibuf, search-buffers, permanent-buffers, Top @chapter Self-Resizing Minibuffer
This package allows the entire contents (or as much as possible) of the minibuffer to be visible at once when typing. As the end of a line is reached, the minibuffer will resize itself. When the user is done typing, the minibuffer will return to its original size.
In window systems where it is possible to have a frame in which the minibuffer is the only window, the frame itself can be resized.
Note that the minibuffer and echo area are not the same! They simply happen to occupy roughly the same place on the frame. Messages put in the echo area will not cause any resizing by this package.
This package is considered a minor mode but it doesn't put anything in minor-mode-alist because this mode is specific to the minibuffer, which has no modeline.
To invoke this mode, type:
@example
M-x resize-minibuffer-mode RET @end example
To configure this package, type:
@example
M-x customize-group RET resize-minibuffer RET @end example
@node search-buffers, uniquify, rsz-minibuf, Top @chapter Searching Many Buffers
This package searches all live buffers for REGEXP and presents matching lines in a separate buffer with hyperlinks to their occurrences.
After creating countless buffers in an XEmacs session, the user can execute the following:
@example
M-x list-matches-in-buffers RET <problem> RET .* RET @end example
to find all matches of the single word "problem" in any of them. The result is presented in a buffer named "*Matches for "<problem>" in buffers*" with hyperlinks to any occurrence. User may navigate to the next (@kbd{n}) or previous (@kbd{p}) match.
@node uniquify, winring, search-buffers, Top @chapter Meaningful Unique Names
Emacs' standard method for making buffer names unique adds <2>, <3>, etc. to the end of (all but one of) the buffers. This file replaces that behavior, for buffers visiting files and dired buffers, with a uniquification that adds parts of the file name until the buffer names are unique. For instance, buffers visiting @file{/u/mernst/tmp/Makefile} and @file{/usr/projects/zaphod/Makefile} would be named @samp{Makefile|tmp} and @samp{Makefile|zaphod}, respectively (instead of @samp{Makefile} and @samp{Makefile<2>}). Other buffer name styles are also available.
To configure this package, type:
@example
M-x customize-group RET uniquify RET @end example
@node winring, autorevert, uniquify, Top @chapter Window Configuration Rings
This package provides lightweight support for circular rings of window configurations. A window configuration is the layout of windows and associated buffers within a frame. There is always at least one configuration on the ring, the current configuration. You can create new configurations and cycle through the layouts in either direction. You can also delete configurations from the ring (except the last one of course!). Window configurations are named, and you can jump to and delete named configurations.
Window configuration rings are frame specific. That is, each frame has its own ring which can be cycled through independently of other frames.
You are always looking at the current window configuration for each frame, which consists of the windows in the frame, the buffers in those windows, and point in the current buffer. As you run commands such as @kbd{C-x 4 b}, @kbd{C-x 2}, and @kbd{C-x 0} you are modifying the current window configuration. When you jump to a new configuration, the layout that existed before the jump is captured, and the ring is rotated to the selected configuration. Window configurations are captured with @code{current-window-configuration}, however winring also saves point for the current buffer.
To use, add the following to your initialization file:
@example
(winring-initialize) @end example
Note that by default, this binds the winring keymap to the @kbd{C-x 7} prefix, but you can change this by setting the value of @code{winring-keymap-prefix}, before you call @code{winring-initialize}.
The following commands are defined:
@table @kbd
@item C-x 7 n
Create a new window configuration. The new configuration will contain a single buffer, the one named in the variable @code{winring-new-config-buffer-name}.
With @kbd{C-u}, winring prompts for the name of the new configuration. If you don't use @kbd{C-u} the function in @code{winring-name-generator} will be called to get the new configuration's name.
@item C-x 7 2
Create a duplicate of the current window configuration. C-u has the same semantics as with @kbd{C-x 7 c}.
@item C-x 7 j
Jump to a named configuration (prompts for the name).
@item C-x 7 0
Kill the current window configuration and rotate to the previous layout on the ring. You cannot delete the last configuration in the ring. With @kbd{C-u}, prompts for the name of the configuration to kill.
@item C-x 7 o
Go to the next configuration on the ring.
@item C-x 7 p
Go to the previous configuration on the ring.
Note that the sequence `C-x 7 o C-x 7 p' is a no-op; it leaves you in the same configuration you were in before the sequence.
@item C-x 7 r
Rename the current window configuration.
@item C-x 7 b
Submit a bug report on winring.
@item C-x 7 v
Echo the winring version.
@end table
As mentioned, window configuration names can be displayed in the modeline. The default value of @code{winring-show-names} is currently @code{nil} by default. Set it to @code{t} to activate. If you don't like the position in the modeline where winring names are shown, you can change this by passing in your own modeline hacker function to @code{winring-initialize}.
@menu * History:: * Related Packages:: @end menu
@node History, Related Packages, winring, winring @section History
A long long time ago there was a package called `wicos' written by Heikki Suopanki, which was based on yet another earlier package called `screens' also written by Suopanki. This in turn was based on the Unix tty session manager `screen' (unrelated to Emacs) by Oliver Laumann, Juergen Weigert, and Michael Schroeder.
Wicos essentially provided fancy handling for window configurations. I liked the basic ideas, but wicos broke with later versions of Emacs and XEmacs. I re-implemented just the functionality I wanted, simplifying things in the process, and porting the code to run with XEmacs 19 and 20, and Emacs 20 (I don't know if winring works in Emacs 19.34).
Wicos used the M-o prefix which I've recently changed to C-x 7 as the default, by suggestion of RMS. Wicos also had some support for multiple frames, and saving configurations on all visible frames, but it didn't work too well, and I like frame independent rings better.
@node Related Packages, , History, winring @section Related Packages
I know of a few other related packages:
@itemize @bullet
@item
`escreen' by Noah Friedman. A much more ambitious package that does Emacs window session management. Very cool, but I wanted something more lightweight.
@item
`wconfig' by Bob Weiner as part of Hyperbole. I think wconfig is similar in spirit to winring; it seems to have also have named window configurations, but not frame-specific window rings.
@item
`winner' by Ivar Rummelhoff. This package comes with Emacs 20, and appears to differ from winring by providing undo/redo semantics to window configuration changes. winner is a minor mode and does seem to support frame-specific window rings.
@item
window-xemacs' by the XEmacs Development Team. It appears that this package, which is specific to XEmacs (and perhaps just XEmacs 20) implements stacks of window configurations which are frame independent.
@end itemize
Please feel free to email me if my rendition of history, or my explanation of the related packages, is inaccurate.
@node autorevert, backup-dir, winring, Top @chapter Reverting Buffers
Whenever a file that Emacs is editing has been changed by another program the user normally has to execute the command `revert-buffer' to load the new content of the file into Emacs.
This package is defined in autorevert.el and contains two minor modes: Global Auto-Revert Mode and Auto-Revert Mode. Both modes automatically revert buffers whenever the corresponding files have been changed on disk.
Auto-Revert Mode can be activated for individual buffers. Global Auto-Revert Mode applies to all file buffers.
Both modes operate by checking the time stamp of all files at intervals of `auto-revert-interval'. The default is every five seconds. The check is aborted whenever the user actually uses Emacs. You should never even notice that this package is active (except that your buffers will be reverted, of course).
@menu * Auto-Revert Usage:: How to use the package. @end menu
@node Auto-Revert Usage, , autorevert, autorevert @section Auto-Revert Usage
To configure the package, type:
@example
M-x customize-group RET auto-revert RET @end example
To activate Auto-Revert for a specific buffer, go to the buffer and type:
@example
M-x auto-revert-mode RET @end example
To activate Global Auto-Revert Mode, type:
@example
M-x global-auto-revert-mode RET @end example
To activate Global Auto-Revert Mode every time Emacs is started customize the option `global-auto-revert-mode' or the following line could be added to your initialization file:
@example
(global-auto-revert-mode 1) @end example
The function `turn-on-auto-revert-mode' could be added to any major mode hook to activate Auto-Revert Mode for all buffers in that mode. For example, the following line will activate Auto-Revert Mode in all C mode buffers:
@example
(add-hook 'c-mode-hook 'turn-on-auto-revert-mode) @end example
@node backup-dir, bookmark, autorevert, Top @chapter Specify Directories to be Used for Backup Files
Allows backup files to be optionally stored in some directories, based on the value of the alist, @code{bkup-backup-directory-info}. This variable is a list of lists of the form @code{(FILE-REGEXP BACKUP-DIR OPTIONS ...)}. If the filename to be backed up matches @code{FILE-REGEXP}, or @code{FILE-REGEXP} is @code{t}, then @code{BACKUP-DIR} is used as the path for its backups. Directories may begin with "/" to specify an absolute pathname.
If @code{BACKUP-DIR} does not exist and @code{OPTIONS} contains the symbol @code{ok-create}, then it is created if possible. Otherwise the usual behavior (backup in the same directory as the file) results.
If @code{OPTIONS} contains the symbol @code{full-path}, then the full path of the file being backed up is prepended to the backup file name, with each "/" replaced by a "!". This is intended for cases where an absolute backup path is used. If @code{OPTIONS} contains @code{prepend-name} in addition to @code{full-path}, then the file name is prepended rather than appended to the path component when forming the backup name.
If @code{OPTIONS} contains the symbol @code{search-upward} and the backup directory @code{BACKUP-DIR} is a relative path, then a directory with that name is searched for starting at the current directory and proceeding upward (.., ../.., etc) until one is found of that name or the root is reached, and if one is found it is used as the backup directory.
Finally, if no @code{FILE-REGEXP} matches the file name being backed up, then the usual behavior results.
These lines from my initialization file load this library and set the values I like:
@example
(require 'backup-dir)
(setq bkup-backup-directory-info
'(("/home/greg/.*" "/~/.backups/" ok-create full-path
prepend-name)
("^/[^/:]+:" ".backups/") ; handle EFS files specially:
don't
("^/[^/:]+:" "./") ; search-upward... its very slow
(t ".backups/"
full-path prepend-name search-upward))) @end example
The package also provides a new function, @code{find-file-latest-backup} to find the latest backup file for the current buffer's file.
This package is based on @file{files.el} from XEmacs 20.3 and overrides functions defined there.
@node bookmark, desktop, backup-dir, Top @chapter Create annotated bookmarks
This package is for setting "bookmarks" in files. A bookmark associates a string with a location in a certain file. Thus, you can navigate your way to that location by providing the string.
To configure this package, type:
@example
M-x customize-group RET bookmark RET @end example
@node desktop, recent-files, bookmark, Top @chapter Save Partial Status of Emacs When Killed
Save the Desktop, i.e.,
@itemize @bullet
@item some global variables
@item the list of buffers with associated files. For each buffer also
@itemize @bullet
@item the major mode
@item the default directory
@item the point
@item the mark & mark-active
@item buffer-read-only
@item some local variables
@end itemize
@end itemize
To use this, first put these two lines at the bottom of your initialization file (the later the better):
@example
(desktop-load-default)
(desktop-read) @end example
Between these two lines you may wish to add something that updates the variables @code{desktop-globals-to-save} and/or @code{desktop-locals-to-save}. If for instance you want to save the local variable @code{foobar} for every buffer in which it is local, you could add the line
@example
(setq desktop-locals-to-save (cons 'foobar desktop-locals-to-save)) @end
example
To avoid saving excessive amounts of data you may also wish to add something like the following
@example
(add-hook 'kill-emacs-hook
'(lambda ()
(desktop-truncate search-ring 3)
(desktop-truncate regexp-search-ring 3))) @end example
which will make sure that no more than three search items are saved. You must place this line @emph{after} the @code{(desktop-load-default)} line. See also the variable @code{desktop-save-hook}.
Start Emacs in the root directory of your "project". The desktop saver is inactive by default. You activate it by typing @code{M-x desktop-save RET}. When you exit the next time the above data will be saved. This ensures that all the files you were editing will be reloaded the next time you start Emacs from the same directory and that points will be set where you left them. If you save a desktop file in your home directory it will act as a default desktop when you start Emacs from a directory that doesn't have its own. I never do this, but you may want to.
Some words on minor modes: Most minor modes are controlled by buffer-local variables, which have a standard save / restore mechanism. To handle all minor modes, we take the following approach: (1) check whether the variable name from @code{minor-mode-alist} is also a function; and (2) use translation table @code{desktop-minor-mode-table} in the case where the two names are not the same.
By the way: don't use @file{desktop.el} to customize Emacs -- the standard XEmacs initialization file is used for that. Saving global default values for buffers is an example of misuse.
PLEASE NOTE: The kill ring can be saved as specified by the variable @code{desktop-globals-to-save} (by default it isn't). This may result in saving things you did not mean to keep. Use @code{M-x desktop-clear RET}.
To configure this package, type:
@example
M-x customize-group RET desktop RET @end example
@node recent-files, resume, desktop, Top @chapter Recent File Navigation
To install @file{recent-files}, put the following statements into your initialization file
@example
(recent-files-initialize) @end example
@file{recent-files} adds the menu "Recent Files" (or whatever name you choose, (@pxref{recentf-cust,Customization}) to Emacs's menubar. Its entries are the files (and directories) that have recently been opened by Emacs. You can open one of these files again by selecting its entry in the "Recent Files" menu. The list of file entries in this menu is preserved from one Emacs session to another. You can prevent Emacs from saving this list by selecting "Don't save recent-files list on exit" from the menu. If you have disabled saving, you can re-enable it by selecting "Save recent-files list on exit".
The menu has permanent and non-permanent entries. Permanent entries are marked with an asterisk in front of the filename. The non-permanent entries are hidden in a submenu.
Each time you open a file in Emacs, it is added as a non-permanent entry to the menu. The value of @code{recent-files-number-of-entries} determines how many non-permanent entries are held in the menu. When the number of non-permanent entries reaches this value, the least recently added non-permanent entry is removed from the menu when another non-permanent entry is added. It is not removed from the list, though; it may reappear when entries are deleted from the list. The number of entries saved to disk is the value of the variable @code{recent-files-number-of-saved-entries}.
Permanent entries are not removed from the menu. You can make a file entry permanent by selecting "Make <buffer> permanent" (where <buffer> is the name of the current buffer) when the current buffer holds this file. "Make <buffer> non-permanent" makes the file entry of the current buffer non-permanent.
The command "Kill buffer <buffer> and delete entry" is handy when you have accidentally opened a file but want to keep neither the buffer nor the entry.
You can erase the list of non-permanent entries by selecting "Erase non-permanent entries" from the menu.
@menu * Customization: recentf-cust. @end menu
@node recentf-cust, , recent-files, recent-files @section Customization
There are lots of variables to control the behaviour of recent-files. You do not have to change any of them if you like it as it comes out of the box. However, you may want to look at these options to make it behave different.
@table @code
@item recent-files-number-of-entries Controls how many non-permanent entries are shown in the recent-files list. The default is 15.
@item recent-files-number-of-saved-entries Controls how many non-permanent entries are saved to disk when Emacs exits or recent-files-save-the-list is called. The default is 50.
@item recent-files-save-file The name of the file where the recent-files list is saved between Emacs session. You probably don't need to change this. The default is ".recent-files.el" in your home directory.
@item recent-files-dont-include A list of regular expressions for files that should not be included into the recent-files list. This list is empty by default. For instance, a list to exclude all .newsrc files, all auto-save-files, and all files in the /tmp directory (but not the /tmp directory itself) would look like this:
@example
(setq recent-files-dont-include
'("/\.newsrc" "~$" "^/tmp/.")) @end example
The default is empty.
@item recent-files-use-full-names If the value of this variable is non-nil, the full pathnames of the files are shown in the recent-files menu. Otherwise only the filename part (or the last name component if it is a directory) is shown in the menu. The default it t, i.e. show full names.
@item recent-files-filename-replacements This is a list of pairs of regular expressions and replacement strings. If a filename matches one of the regular expressions, the matching part is replaced by the replacement string for display in the recent-files menu. Example: My home directory is "/users/mmc/nickel/". I want to replace it with "~/". I also want to replace the directory "/imports/teleservices/mmc/avc2/", where I work a lot, with ".../avc2/". The list then looks like
@example
(setq recent-files-filename-replacements
'(("/users/mmc/nickel/" . "~/")
("/imports/teleservices/mmc/avc2/" . ".../avc2/"))) @end
example
Only the first match is replaced. So, if you have several entries in this list that may match a filename simultaneously, put the one you want to match (usually the most special) in front of the others. The default is to replace the home directory with "~".
@item recent-files-sort-function Contains a function symbol to sort the display of filenames in the recent-files menu. Supplied are two functions, @code{recent-files-dont-sort} and @code{recent-files-sort-alphabetically}. The first, which is the default, preserves the order of "most recent on top".
@item recent-files-permanent-submenu If this variable is non-nil, the permanent entries are put into a separate submenu of the recent-files menu. The default is nil.
@item recent-files-non-permanent-submenu If this variable is non-nil, the non-permanent entries are put into a separate submenu of the recent-files menu. The default is currently t, but probably should be nil, and we may change it back. (You can set both @code{recent-files-permanent-submenu} and @code{recent-files-non-permanent-submenu} to t to have both lists in separate submenus.)
@item recent-files-commands-submenu If this variable is non-nil, the commands if recent-files are placed in a submenu of the recent-files menu. The default is nil.
@item recent-files-commands-submenu-title If the commands are placed in a submenu, this string is used as the title of the submenu. The default is "Commands...".
@item recent-files-actions-on-top If this variable is non-nil, the "action" menu entries ("Make <buffer> permanent" etc.) are put on top of the menu. Otherwise they appear below the file entries or submenus. The default is nil.
@item recent-files-permanent-first If this variable is t, the permanent entries are put first in the recent-files menu, i.e. above the non-permanent entries. If the value is nil, non-permanent entries appear first. If the value is neither t nor nil, the entries are sorted according to recent-files-sort-function. The default is 'sort.
@item recent-files-find-file-command This variable contains the command to execute when a file entry is selected from the menu. Usually this will be @code{find-file}, which is the default.
@end table
@node resume, saveconf, recent-files, Top @chapter Resuming a Suspended Emacs Job
This library not documented. Please contribute!
@node saveconf, savehist, resume, Top @chapter Save Buffer/Window Configuration Between Sessions
This package of functions gives Emacs the ability to remember which files were being visited, the windows that were on them, and the value of point in their buffers the last Emacs session in the same directory. This is an emulation of an old Gosling Emacs feature.
The relevant commands are @code{save-context} and @code{recover-context}.
Most of the time you'll want an Emacs session's context saved even if you choose not to recover it later. To avoid having to manually @code{M-x save-context} at each emacs exit, put the line:
@example
(setq auto-save-and-recover-context t) @end example
in your initialization file or in @file{default.el} in the lisp directory of the Emacs distribution. The context will then automatically be saved when Emacs exits.
By default only the contexts of visible buffers (buffers with windows on them) are saved. Setting the variable save-buffer-context to t causes the contexts of all buffers to be saved.
To use the package put these lines
@example
(require 'saveconf)
(if (null (cdr command-line-args))
(setq inihibit-startup-message (recover-context))) @end example
at the end of your initialization file or the @file{default.el} file in the lisp directory of the Emacs distribution. This causes the context saved in the current directory to be recovered whenever Emacs is invoked without any arguments.
@node savehist, saveplace, saveconf, Top @chapter Save Minibuffer History
Many editors (e.g. Vim) have the feature of saving minibuffer history to an external file after exit. This package provides the same feature in Emacs. When Emacs is about the exit, @code{savehist-save} will dump the contents of various minibuffer histories (as determined by @code{savehist-history-variables}) to a save file (@file{~/.emacs-history} by default). Although the package was designed for saving the minibuffer histories, any variables can be saved that way.
To use savehist, put the following in your initialization file:
@example
(savehist-load) @end example
To configure this package, type:
@example
M-x customize-group RET savehist RET @end example
@node saveplace, where-was-i-db, savehist, Top @chapter Automatically Save Place in Files
Automatically save place in files, so that visiting them later (even during a different Emacs session) automatically moves point to the saved position, when the file is first found. Uses the value of buffer-local variable @code{save-place} to determine whether to save position or not.
To use this package, put the following in your initialization file:
@example
(require 'saveplace) @end example
To configure this package, type:
@example
M-x customize-group RET saveplace RET @end example
@node where-was-i-db, completion, saveplace, Top @chapter Keep Persistent State in Visited Files
This library will make XEmacs keep track of where you were last time you visited a file. It hopes to become a standard and favored XEmacs feature on setups with Berkeley DB installed.
It works by installing functions on the @code{find-file-hooks} and on the buffer-local @code{kill-buffer-hook}. When a buffer is killed, if it was visiting a file, and place saving has been enabled for it, a database entry is made, saving the location of @code{point}. When you visit a file, the database is queried, keyed on @code{buffer-file-name}, and if an entry is found, point is set to the value retrieved, and place saving is enabled again for that buffer.
There is a command, which is initially not bound to a keystroke in this incarnation; and may never be, since I think completion works well enough:
@example
M-x toggle-where-was-i @end example
which, using auto-completion, can be entered as
@example
M-x tog TAB w TAB @end example
that will turn place saving on and off on a per-file, buffer- local basis. If @code{where-was-i-db} has been turned off in a buffer and then you kill it, or exit XEmacs, any record for that file will be purged from the database, and you'll start at the top of the file next time you open it, with place saving turned off there.
Place saving is automatically still `on' when you visit a file you'd toggled it on for in a previous session or visitation. (That's the point of it, after all.)
Toggling place saving on in a buffer visiting a file is all that is required to cause the @code{where-was-i-db} feature to be autoloaded, as @code{toggle-where-was-i} will call on @code{install-where-was-i} if the `wwi-ffh' has not yet been installed. That WILL NOT cause this feature to be automatically enabled in your next XEmacs invocation, however. For that, you must customize and save @code{wwi-auto-install-on-startup-flag}. There is more information about this in its docstring.
This feature can be unloaded with:
@example
C-u M-x install-where-was-i @end example
which will call @code{unload-feature}, as well as traverse the @code{buffer-list} removing the buffer-local @code{kill-buffer-hook} installed by this program. Note that any buffers that got place saving enabled by having had an entry in the database for them when they were first visited (thus restoring point to where it was the last time you had visited the file), will not have an updated entry made, nor the old entry removed (as would happen if you @code{toggle-where-was-i} to off in just that buffer), after you uninstall this feature like that.
If you toggle it on again in a buffer visiting a file, then kill that buffer, the point will be saved for it. When you kill the other buffers that had place saving enabled before you uninstalled the feature with @kbd{C-u M-x install-where-was-i}, no @code{where-was-i-db} database update will happen for them, since their buffer-local @code{kill-buffer-hook} will have been cleaned of the member @code{wwi-save-where-i-am}, the function that writes the @code{point} entry to the database when a buffer is killed. If you then re-visit one of those files, point will get restored to the location it did the last time you visited that file with @code{where-was-i-db} installed.
To remove a file from the place saving database, simply visit it, @kbd{M-x toggle-where-was-i} to switch @code{where-was-i-db} off, then kill that buffer. You can see how this works by looking at the definition of @code{wwi-save-where-i-am}.
After a period of time, the database of saved file positions will become cluttered with the names of files that no longer exist. You may vacume out the crumbs using:
@example
M-x wwi-vacume-where-was-i-db @end example
which will prompt you for an optional regular expression to match files you want records removed for. It will traverse the database and remove entries for file names that either match the regexp, or that are @code{(not (file-exists-p file-name))}. The main reason for this command is the removal of stale entries, for files that no longer exist on the filesystem.
Note also that running @code{wwi-vacume-where-was-i-db} will cause EFS traffic, if you've saved your place in any remote files. Don't be surprised if your dialing daemon picks up the phone when you run the vacume function. You should be able to purge the database of all EFS entries with a simple regular expression passed to @code{wwi-vacume-where-was-i-db}. Of course, you might not want to do that, for obvious reasons.
To configure this package, type:
@example
M-x customize-group RET where-was-i RET @end example
@node completion, dabbrev, where-was-i-db, Top @chapter Completion
To load this package, add the following to your initialization file:
@example
(require 'completion) @end example
After you type a few characters, pressing the "complete" key inserts the rest of the word you are likely to type.
This watches all the words that you type and remembers them. When typing a new word, pressing "complete" (@kbd{C-return}) "completes" the word by inserting the most recently used word that begins with the same characters. If you press meta-return repeatedly, it cycles through all the words it knows about.
If you like the completion then just continue typing, it is as if you entered the text by hand. If you want the inserted extra characters to go away, type @kbd{C-w} or delete. More options are described below.
The guesses are made in the order of the most recently "used". Typing in a word and then typing a separator character (such as a space) "uses" the word. So does moving a cursor over the word. If no words are found, it uses an extended version of dynamic abbreviation @xref{dabbrev}.
Completions are automatically saved to a file between sessions.
Completion enables programmers to enter longer, more descriptive variable names while typing fewer keystrokes than they normally would.
To configure this package, type:
@example
M-x customize-group RET completion RET @end example
@node dabbrev, hippie-exp, completion, Top @chapter Dynamic Abbreviations
The purpose with this package is to let you write just a few characters of words you've written earlier to be able to expand them.
To expand a word, just put the point right after the word and press @kbd{M-/} (@code{dabbrev-expand}) or @kbd{M-C-/} (@code{dabbrev-completion}).
Check out the customizable variables to learn about all the features of this package.
To configure this package, type:
@example
M-x customize-group RET dabbrev RET @end example
@node hippie-exp, icomplete, dabbrev, Top @chapter Hippie Expand
@code{hippie-expand} is a single function for a lot of different kinds of completions and expansions. Called repeatedly it tries all possible completions in succession. Which kinds of completions to try, and in which order, is determined by the contents of @code{hippie-expand-try-functions-list}. Much customization of @code{hippie-expand} can be made by changing the order of, removing, or inserting new functions in this list. Given a positive numeric argument, @code{hippie-expand} jumps directly ARG functions forward in this list. Given some other argument (a negative argument or just @kbd{C-u}) it undoes the tried completion.
If the variable @code{hippie-expand-verbose} is non-nil, @code{hippie-expand} outputs in a message which try-function in the list that is used currently (ie. was used currently and will be tried first the next time).
The variable @code{hippie-expand-max-buffers} determines in how many buffers, apart from the current, to search for expansions in. It is used by the try-functions named "-all-buffers". The variable @code{hippie-expand-ignore-buffers} is a list of regexps matching buffer names (as strings) or major modes (as atoms) of buffers that should not be searched by the try-functions named "-all-buffers". See also the macro @code{make-hippie-expand-function} below.
A short description of the current try-functions in this file:
@table @code
@item try-complete-file-name Very convenient to have in any buffer, and not just in the minibuffer or (some) shell-mode. It goes through all possible completions instead of just completing as much as is unique.
@item try-complete-file-name-partially To insert in the list just before @code{try-complete-file-name} for those who want first to get a file name completed only as many characters as is unique.
@item try-expand-all-abbrevs Can be removed if you don't use abbrevs. Otherwise it looks through all abbrev-tables, starting with the local followed by the global.
@item try-expand-line Searches the buffer for an entire line that begins exactly as the current line. Convenient sometimes, for example as a substitute for (or complement to) the history list in shell-like buffers. At other times, only confusing.
@item try-expand-line-all-buffers Like @code{try-expand-line} but searches in all buffers (except the current). (This may be a little slow, don't use it unless you are really fond of @code{hippie-expand}.)
@item `try-expand-list Tries to expand the text back to the nearest open delimiter, to a whole list from the buffer. Convenient for example when writing lisp or TeX.
@item try-expand-list-all-buffers Like @code{try-expand-list} but searches in all buffers (except the current).
@item try-expand-dabbrev Works exactly as @code{dabbrev-expand} (but of course in a way compatible with the other try-functions).
@item try-expand-dabbrev-all-buffers Perhaps the most useful of them, like @code{dabbrev-expand} but searches all Emacs buffers (except the current) for matching words. (No, I don't find this one particularly slow.)
@item try-expand-dabbrev-visible Searches the currently visible parts of all windows. Can be put before @code{try-expand-dabbrev-all-buffers} to first try the expansions you can see.
@item try-expand-dabbrev-from-kill Searches the kill ring for a suitable completion of the word. Good to have, just in case the word was not found elsewhere.
@item try-expand-whole-kill Tries to complete text with a whole entry from the kill ring. May be good if you don't know how far up in the kill-ring the required entry is, and don't want to mess with "Choose Next Paste".
@item try-complete-lisp-symbol Like @code{lisp-complete-symbol}, but goes through all possibilities instead of completing what is unique. Might be tedious (usually a lot of possible completions) and since its function is much like @code{lisp-complete-symbol}, which already has a key of its own, you might want to remove this.
@item try-complete-lisp-symbol-partially To insert in the list just before @code{try-complete-lisp-symbol} for those who first want to get completion of what is unique in the name.
@end table
Not all of the above functions are by default in @code{hippie-expand-try-functions-list}. This variable is better set in your initialization file to make @code{hippie-expand} behave maximally convenient according to personal taste. Also, instead of loading the variable with all kinds of try-functions above, it might be an idea to use @code{make-hippie-expand-function} to construct different @code{hippie-expand}-like functions, with different try-lists and bound to different keys. It is also possible to make @code{hippie-expand-try-functions-list} a buffer local variable, and let it depend on the mode (by setting it in the mode-hooks).
@node icomplete, tempo, hippie-exp, Top @chapter Interactive Minibuffer Completion
Loading this package implements a more fine-grained minibuffer completion feedback scheme. Prospective completions are concisely indicated within the minibuffer itself, with each successive keystroke.
See @code{icomplete-completions} docstring for a description of the icomplete display format.
See the @code{icomplete-minibuffer-setup-hook} docstring for a means to customize icomplete setup for interoperation with other minibuffer-oriented packages.
To activate @code{icomplete mode}, load the package and use the @code{icomplete-mode} function. You can subsequently deactivate it by invoking the function @code{icomplete-mode} with a negative prefix-arg @kbd{(C-U -1 ESC-x icomplete-mode}). Also, you can prevent activation of the mode during package load by first setting the variable @code{icomplete-mode} to nil. Icompletion can be enabled any time after the package is loaded by invoking @code{icomplete-mode} without a prefix arg.
To configure this package, type:
@example
M-x customize-group RET icomplete RET @end example
@node tempo, avoid, icomplete, Top @chapter Flexible Template Insertion
This file provides a simple way to define powerful templates, or macros, if you wish. It is mainly intended for, but not limited to, other programmers to be used for creating shortcuts for editing certain kind of documents. It was originally written to be used by a HTML editing mode written by Nelson Minar <nelson@@santafe.edu>, and his @file{html-helper-mode.el} is probably the best example of how to use this program.
A template is defined as a list of items to be inserted in the current buffer at point. Some of the items can be simple strings, while other can control formatting or define special points of interest in the inserted text.
If a template defines a "point of interest" that point is inserted in a buffer-local list of "points of interest" that the user can jump between with the commands @code{tempo-backward-mark} and @code{tempo-forward-mark}. If the template definer provides a prompt for the point, and the variable @code{tempo-interactive} is non-nil, the user will be prompted for a string to be inserted in the buffer, using the minibuffer.
The template can also define one point to be replaced with the current region if the template command is called with a prefix (or a non-nil argument).
More flexible templates can be created by including lisp symbols, which will be evaluated as variables, or lists, which will be evaluated as lisp expressions.
See the documentation for @code{tempo-define-template} for the different items that can be used to define a tempo template.
One of the more powerful features of tempo templates are automatic completion. With every template can be assigned a special tag that should be recognized by @code{tempo-complete-tag} and expanded to the complete template. By default the tags are added to a global list of template tags, and are matched against the last word before point. But if you assign your tags to a specific list, you can also specify another method for matching text in the buffer against the tags. In the HTML mode, for instance, the tags are matched against the text between the last `<' and point.
When defining a template named @code{foo}, a symbol named @code{tempo-template-foo} will be created whose value as a variable will be the template definition, and its function value will be an interactive function that inserts the template at the point.
To configure this package, type:
@example
M-x customize-group RET tempo RET @end example
@node avoid, blink-cursor, tempo, Top @chapter Move Mouse Pointer Out of the Way of Editing
For those who are annoyed by the mouse pointer obscuring text, this mode moves the mouse pointer - either just a little out of the way, or all the way to the corner of the frame. To use, type @code{M-x mouse-avoidance-mode}. To set up permanently, add the following to your initialization file:
@example
(if window-system (mouse-avoidance-mode 'animate)) @end example
The @code{'animate} can be @code{'jump} or @code{'banish} or @code{'exile} or @code{'protean} if you prefer. See the documentation for function @code{mouse-avoidance-mode} for details of the different modes.
For added silliness, make the animatee animate by put something similar to the following into your initialization file:
@example
(if window-system
(mouse-avoidance-set-pointer-shape
(eval (nth (random 4)
'(x-pointer-man x-pointer-spider
x-pointer-gobbler x-pointer-gumby))))) @end example
For completely random pointer shape, replace the @code{setq} above with @code{(setq x-pointer-shape (mouse-avoidance-random-shape))}.
To configure this package, type:
@example
M-x customize-group RET avoid RET @end example
@node blink-cursor, fast-lock, avoid, Top @chapter Blinking Cursor
To activate this package, type:
@example
M-x blink-cursor-mode RET @end example
To configure this package, type:
@example
M-x customize-group RET blink-cursor RET @end example
@node fast-lock, lazy-lock, blink-cursor, Top @chapter Speeding Up Font Lock Mode
Lazy Lock mode is a Font Lock support mode. It makes visiting a file in Font Lock mode faster by restoring its face text properties from automatically saved associated Font Lock cache files.
See also the lazy-lock package. (But don't use the two at the same time!)
To use this package, add the following to your initialization file:
@example
(setq font-lock-support-mode 'fast-lock-mode) @end example
Start up a new Emacs and use font-lock as usual (except that you can use the so-called "gaudier" fontification regexps on big files without frustration).
When you visit a file (which has @code{font-lock-mode} enabled) that has a corresponding Font Lock cache file associated with it, the Font Lock cache will be loaded from that file instead of being generated by Font Lock code.
To configure this package, type:
@example
M-x customize-group RET fast-lock RET @end example
@node lazy-lock, lazy-shot, fast-lock, Top @chapter Lazy Demand-Driven Fontification
The purpose of this library is to make visiting buffers in @code{font-lock-mode} faster by making fontification demand-driven and stealthy. Fontification only occurs when, and where, necessary.
See also the fast-lock and lazy-shot packages. (But don't use them at the same time as lazy-lock!)
To use this package, add the following to your initialization file:
@example
(setq font-lock-support-mode 'lazy-lock-mode) @end example
Start up a new XEmacs and use font-lock as usual (except that you can use the so-called "gaudier" fontification regexps on big files without frustration).
In a buffer (which has @code{font-lock-mode} enabled) which is at least @code{lazy-lock-minimum-size} characters long, only the visible portion of the buffer will be fontified. Motion around the buffer will fontify those visible portions that were not previous fontified.
If stealth fontification is enabled, fontification will occur in invisible parts of the buffer after @code{lazy-lock-stealth-time} seconds of idle time.
To configure this package, type:
@example
M-x customize-group RET lazy-lock RET @end example
@node lazy-shot, mic-paren, lazy-lock, Top @chapter Another Lazy Demand-Driven Fontification
This is an experimental demand based font-lock implementation. It is experimental in the sense that it relies on C support from the redisplay engine, that is experimental. The code in this file is more or less finished. The C code support experimental because the current design is rumoured to be ugly. Secondly because XEmacs does actually display the "un-font-locked" parts of the buffer first, the user notices flashing as the buffer is repainted with color/fonts.
To use this package, add the following to your initialization file:
@example
(add-hook 'font-lock-mode-hook 'turn-on-lazy-shot) @end example
Do not use in combination with @code{lazy-lock}.
@example
M-x customize-group RET lazy-shot RET @end example
@node mic-paren, paren, lazy-shot, Top @chapter Advanced Highlighting of Matching Parentheses
Load this file, activate it and Emacs will display highlighting on whatever parenthesis (and paired delimiter if you like this) matches the one before or after point. This is an extension to the paren.el file distributed with Emacs. The default behaviour is similar to paren.el but more sophisticated. Normally you can try all default settings to enjoy mic-paren.
Or - if you are a LaTeX writer like the current maintainer - try the following additional setup in your initialization file:
@example
;; In LaTeX-mode we want this
(add-hook 'LaTeX-mode-hook
(function (lambda ()
(paren-toggle-matching-quoted-paren 1)
(paren-toggle-matching-paired-delimiter 1)))) @end example
Or - if you are programming in C like languages - try also:
@example
(add-hook 'c-mode-common-hook
(function (lambda ()
(paren-toggle-open-paren-context 1)))) @end example
@file{mic-paren.el} is an extension and replacement to the packages @file{paren.el} and @file{stig-paren.el} for Emacs. When mic-paren is active Emacs normal parenthesis matching is deactivated. Instead parenthesis matching will be performed as soon as the cursor is positioned at a parenthesis. The matching parenthesis (or the entire expression between the parentheses) is highlighted until the cursor is moved away from the parenthesis.
Features include:
@itemize @bullet
@item
Both forward and backward parenthesis matching (simultaneously if cursor is between two expressions).
@item
Indication of mismatched parentheses.
@item
Recognition of "escaped" (also often called "quoted") parentheses.
@item
Option to match "escaped" parens too, especially in (La)TeX-mode (e.g. matches expressions like "‹o bar" properly).
@item
Offers two functions as replacement for @code{forward-sexp} and @code{backward-sexp} which handle properly quoted parens (s.a.). These new functions can automatically be bounded to the original binding of the standard @code{forward-sexp} and @code{backward-sexp} functions.
@item
Option to activate matching of paired delimiter (i.e. characters with syntax
@item
Option to select in which situations (always, never, if match, if mismatch) the entire expression should be highlighted or only the matching parenthesis.
@item
Message describing the match when the matching parenthesis is off-screen (vertical and/or horizontal). Message contains either the linenumber or the number of lines between the two matching parens. Option to select in which cases this message should be displayed.
@item
Optional delayed highlighting (useful on slow systems),
@item
Functions to activate/deactivate @file{mic-paren.el} are provided.
@item
Numerous options to control the behaviour and appearance of @file{mic-paren.el}.
@end itemize
To configure this package, type:
@example
M-x customize-group RET mic-paren-matching RET @end example
@node paren, shell-font, mic-paren, Top @chapter Highlight (Un)matching Parens and Whole Expressions
This package highlights matching parens (or whole sexps) for easier editing of source code, particularly lisp source code.
The @code{paren-highlight} hook function runs after each command and checks to see if the cursor is at a parenthesis. If so, then it highlights, in one of several ways, the matching parenthesis.
Priority is given to matching parentheses right before the cursor because that's what makes sense when you're typing a lot of closed parentheses. This is especially intuitive if you frequently use @code{forward-sexp} (@kbd{M-C-f}) and @code{backward-sexp} (@kbd{M-C-b}) to maneuver around in source code.
Different faces are used for matching and mismatching parens so that it is easier to see mistakes as you type them. Audible feedback is optional.
If a (mis)matching paren is offscreen, then a message is sent to the modeline.
If @code{paren-mode} is @code{sexp}, entire S-expressions are highlighted instead of just matching parens.
To configure this package, type:
@example
M-x customize-group RET paren-matching RET @end example
@node shell-font, highline, paren, Top @chapter Decorate a Shell Buffer With Fonts
Do this: @code{(add-hook 'shell-mode-hook 'install-shell-fonts)} and the prompt in your shell-buffers will appear bold-italic, process output will appear in normal face, and typein will appear in bold.
The faces @code{shell-prompt}, @code{shell-input} and @code{shell-output} can be modified as desired, for example, @code{(copy-face 'italic
@node highline, after-save-commands, shell-font, Top @chapter Highlight the Current Line in the Buffer
This package is a minor mode to highlight the current line in buffer.
The mode supports the following modes of operation:
@itemize @bullet
@item LOCAL highline @item GLOBAL highline @item INDIRECT highline
@end itemize
Both Local and Global minor modes may be in use at the same time.
Indirect highline (@code{highline-view-on}, @code{highline-view-off} and @code{highline-view-mode}) is useful when you wish to have various "visions" of the same buffer. Indirect highline uses an indirect buffer to get the "vision" of the buffer. So, if you kill an indirect buffer, the base buffer is not affected; if you kill the base buffer, all indirect buffer related with the base buffer is automagically killed. Also, any text insertion/deletion in any indirect or base buffer is updated in all related buffers.
@menu * Key Bindings and Example Usage: highline-keys. * Hooks: highline-hooks. * Options: highline-options. @end menu
@node highline-keys, highline-hooks, highline, highline @section Key Bindings and Example Usage
It might be useful to set up some global key bindings as follows:
@example
(global-set-key "-c-a" 'highline-on)
(global-set-key "-c-b" 'highline-off)
(global-set-key "-c-l" 'highline-local-mode)
(global-set-key "-c-d" 'highline-mode-on)
(global-set-key "-c-e" 'highline-mode-off)
(global-set-key "-c-g" 'highline-mode)
(global-set-key "-c-c" 'highline-customize)
(global-set-key "-c-v-n" 'highline-view-on)
(global-set-key "-c-v-f" 'highline-view-off)
(global-set-key "-c-v-t" 'highline-view-mode) @end example
As an example, try to insert this in your .emacs file:
@example
(require 'highline)
;; Turn on local highlighting for Dired (C-x d)
(add-hook 'dired-after-readin-hook 'highline-on)
;; Turn on local highlighting for list-buffers (C-x C-b)
(defadvice list-buffers (after highlight-line activate)
(save-excursion
(set-buffer "*Buffer List*")
(highline-on))) @end example
@node highline-hooks, highline-options, highline-keys, highline @section Hooks
highline has the following hook variables:
@table @code
@item highline-hook It is evaluated always when highline is turned on globally.
@item highline-local-hook It is evaluated always when highline is turned on locally.
@item highline-view-hook It is evaluated always when indirect highline is turned on.
@item highline-load-hook It is evaluated after highline package is loaded.
@end table
@node highline-options, , highline-hooks, highline @section Options
This is a brief description of highline options. Please see the options declarations in the code for more detail.
@table @code
@item highline-face Specify face used to highlight the current line.
@item highline-vertical-face Specify face used to highlight other than current line.
@item highline-line Specify which part of line should be highlighted.
@item highline-vertical Specify how many vertical lines should be highlighted.
@item highline-verbose Non-nil means generate messages.
@item highline-ignore-regexp Specify regexp for buffers to ignore.
@item highline-priority Specify highline overlay priority.
@item highline-selected-window Non-nil means highlight current line on current window.
@end table
To configure this package, type:
@example
M-x highline-customize RET @end example
@node after-save-commands, atomic-extents, highline, Top @chapter Hooks Invoked After Saving a File
Set up a list of file-name matching regular expressions associated with shell commands or lisp forms to run after saving the file.
This is good for things like running @code{newaliases(1)} on @file{/etc/aliases}, @code{xrdb(1)} on @file{~/.Xresources}, installing a new @file{~/.crontab}, as well as for sending signals to daemons whose configuration files you've just finished editing.
It is much safer and more powerful than using exec statements in "Local Variables" sections, and can safely be used by root for system administration tasks. The shell command can run about anything you can think of.
See variable @code{After-save-alist} for more information.
@node atomic-extents, array, after-save-commands, Top @chapter Indivisible Blocks of Text
Point is not allowed to fall inside of an atomic extent. This has the effect of making all text covered by an atomic extent be treated as a single object. Normally point will be adjusted to an end of an atomic extent in the direction of motion. If point appears inside of an atomic extent (via @code{goto-char} for example), point will be adjusted to the side closest to the entry point.
To make this feature available, add the following to your initialization file:
@example
(require 'atomic-extents) @end example
To make an extent atomic use the command:
@example
(set-extent-property #<extent obj> 'atomic t) @end example
@node array, floating-toolbar, atomic-extents, Top @chapter Table and Array Editor
Commands for editing a buffer interpreted as a rectangular array or matrix of whitespace-separated strings. You specify the array dimensions and some other parameters at startup time.
@node floating-toolbar, The Toolbar Utilities, array, Top @chapter Floating Toolbar
The command @code{floating-toolbar} pops up a small frame containing a toolbar. The command should be bound to a button-press event. If the mouse press happens over an extent that has a non-nil @code{'floating-toolbar} property, the value of that property is the toolbar instantiator that will be displayed. Otherwise the toolbar displayed is taken from the variable @code{floating-toolbar}. This variable can be made buffer local to produce buffer local floating toolbars.
@code{floating-toolbar-or-popup-mode-menu} works like @code{floating-toolbar} except that if no toolbar is found, @code{popup-mode-menu} is called.
@code{floating-toolbar-from-extent-or-popup-mode-menu} works like @code{floating-toolbar-or-popup-mode-menu} except only extent local toolbars are used; the value of floating-toolbar is not used.
Add the following line to your initialization file:
@example
(require 'floating-toolbar) @end example
You will also need to bind a mouse click to @code{floating-toolbar} or to @code{floating-toolbar-or-popup-mode-menu}.
@node The Toolbar Utilities, foldout, floating-toolbar, Top @chapter The Toolbar Utilities @cindex toolbar
The toolbar utilities are a set of Emacs commands and Lisp functions for convenient creation and management of toolbars. Common usages such as creating and adding toolbar buttons to invoke commands and keyboard macros are implemented as user commands. Convenience APIs are provided to create buttons, add them to toolbars, kill them from toolbars, and finding a particular button, or a button with certain content, in a toolbar.
The toolbar utilities are implemented in three files:
@table @file @item toolbar-utils.el
The toolbar utility APIs and user commands.
@item edit-toolbar.el
The near-WYSIWYG toolbar editor by Peter D. Pezaris.
@item xemacs-toolbar.el
The XEmacs compatibility API for programs that should also run under GNU Emacs. @end table
The author would like to thank Jeff Miller and Peter D. Pezaris for the original API and the toolbar editor, respectively, and David Kastrup and Jamie Zawinski for the pedal-gluteal impetus that resulted in the recent revision of these libraries described in this manual.
@menu * Adding Buttons on the Fly:: Quick and convenient. * The Toolbar Editor:: Power tools for customization. * APIs for Adding and Killing:: For Lisp programmers. * APIs for Search:: Button, button, who's got the button? * Toolbar Portability:: The @file{xemacs-toolbar.el} library. @end menu
@node Adding Buttons on the Fly, The Toolbar Editor, The Toolbar Utilities, The Toolbar Utilities @section Adding Buttons on the Fly
@defvr Group edit-toolbar
Customize group of tools for interactive editing and non-interactive management of toolbars. @end defvr
@defvar toolbar-button-default-position Default position for adding toolbar buttons on the fly. The value may be a non-negative integer (0 is leftmost), or one of the symbols @code{left}, @code{right}, or @code{extreme-right}. @code{left} is synonymous with 0, and @code{extreme-right} is synonymous with @code{(length toolbar)}. @code{right} specifies placing a new item at the right end of the flush-left group of buttons.
Default value: @code{right}. Customize type: sexp.
See also @samp{toolbar-add-button}, @ref{APIs for Adding and Killing}. @end defvar
@deffn Command toolbar-add-button-on-the-fly description command label &optional position locale
Add an button at @var{position} to the default toolbar of the selected window. Returns @code{t}.
The return value may change. Tell stephen@@xemacs.org what value you think would be (most) useful.
@table @var @item description A string describing the action, and displayed as help.
@item command An interactive command (ie, a symbol with an interactive function definition) implementing the action.
@item label A string used to label the button.
@item position Optional. A position (a non-negative integer, or one of the symbols @code{left}, @code{right}, or @code{extreme-right}.
Default: @code{right}.
@item locale Optional. A specifier locale, defaulting to the current buffer. If current-buffer-only is not what you want, and you don't understand specifier locales, use @code{global}. It's safe and probably does what you want. @end table @end deffn
@deffn Command toolbar-add-kbd-macro mac icon is-file Add a button invoking a keyboard macro to the toolbar. The button is added at the end of the left group.
@table @var @item mac A keyboard macro name, or the empty string or nil to use a copy of the last keyboard macro defined.
@item icon A string specifying the icon to be used. If @var{is-file} is non-@code{nil}, it is interpreted as the name of an image file, and searched for using @code{locate-data-file}. Otherwise it is used verbatim as a label.
@item is-file Determines the treatment of @var{icon} (q.v.). @end table
Used interactively, prompts for the macro name @var{mac} and an @var{icon}. @var{is-file} is non-@code{nil} if a prefix argument was used. @end deffn
@defun toolbar-add-execute-macro-button
Add a button to the global toolbar to execute the last keyboard macro.
Unlike @code{toolbar-add-kbd-macro}, this does not copy the macro. The macro executed will change with redefinitions.
Due to a simple implementation, this button will not appear in buffers with local toolbars if invoked after the toolbar is installed. If you like this button, it's probably best to invoke this function in your init file. @end defun
@defun toolbar-execute-last-kbd-macro Toolbar thunk which executes the most recently defined keyboard macro. @end defun
@deffn Command restore-initial-toolbar Restores the default toolbar defined by @code{initial-toolbar-spec}.
There is also a cache of killed buttons in @code{button-palette}. @end deffn
@node The Toolbar Editor, APIs for Adding and Killing, Adding Buttons on the Fly, The Toolbar Utilities @section The Toolbar Editor
To use @file{edit-toolbar.el}, simply type @kbd{M-x edit-toolbar RET}.
For help on the various commands you can type @key{?} in a @samp{edit-toolbar} buffer. To save a modified toolbar type @kbd{C-x C-s} in an @samp{edit-toolbar} buffer. If you want to use a saved toolbar in your future XEmacs sessions, add the following line of code to your init file:
@example
(load "~/.xemacs/.toolbar") @end example
Here is a table of commands and bindings available in @samp{edit-toolbar-mode}. These commands are also available from the @samp{Edit Toolbar} menu.
@table @kbd @item q
@samp{edit-toolbar-quit}: Bury the @samp{edit-toolbar} buffer.
@item p @itemx DEL
@samp{edit-toolbar-previous}: Select the previous item (line).
@item n @itemx SPC @itemx RET
@samp{edit-toolbar-next}: Select the next item (line).
@item ?
@samp{describe-mode}: Help.
@item f
@samp{edit-toolbar-set-function}: Set the command for the current button.
@item h
@samp{edit-toolbar-set-help}: Set the help string for the current button.
@item a
@samp{edit-toolbar-add-button}: Add a new empty button.
@item 2
@samp{edit-toolbar-add-separator-2D-narrow}: Add a new narrow 2D fixed-width spacer.
@item @@
@samp{edit-toolbar-add-separator-2D-wide}: Add a new wide 2D fixed-width spacer.
@item 3
@samp{edit-toolbar-add-separator-3D-narrow}: Add a new narrow 3D fixed-width spacer.
@item #
@samp{edit-toolbar-add-separator-3D-wide}: Add a new wide 3D fixed-width spacer.
@item R
@samp{edit-toolbar-add-separator-right-left}: Place the filler separator, which expands to create a flush-left group of buttons and spacers and a flush-right group.
@item c
@samp{edit-toolbar-copy}: Copy the selected button.
@item d
@samp{edit-toolbar-down}: Reorder the buttons by moving the selected button down (to the right on a horizontal toolbar).
@item u
@samp{edit-toolbar-up}: Reorder the buttons by moving the selected button up (to the left on a horizontal toolbar).
@item k
@samp{edit-toolbar-kill}: Kill the selected button.
@item s @itemx C-x C-s
@samp{edit-toolbar-save}: Save the current buffer to @file{~/.xemacs/.toolbar} in a format that allows it to be reloaded.
@item r
@samp{edit-toolbar-restore}: Restore the original toolbar (ie, before this editing session started).
@end table
@node APIs for Adding and Killing, APIs for Search, The Toolbar Editor, The Toolbar Utilities @section APIs for Adding and Killing
@defvar button-palette List of buttons cut from toolbars.
Note this is actually a toolbar descriptor. @end defvar
@defun toolbar-add-item toolbar-spec item &optional position Add @var{item} to @var{toolbar-spec} at @var{position}, and return @var{toolbar-spec}. Uses functions that alter list structure.
@table @var @item item A toolbar button or spacer specification (eg, from @code{toolbar-new-button} or @code{toolbar-new-spacer}). @item toolbar-spec A toolbar descriptor (eg, from @code{toolbar-new-toolbar}). @item position Optional. A non-negative integer, with 0 being the extreme left and ngth @var{toolbar-spec}) the extreme right. The symbols @code{left}, @code{right}, and @code{extreme-right} are also accepted. @code{left} is synonymous with 0. @code{right} places @var{item} at the right end of the left group of buttons. @code{extreme-right} places @var{item} at the extreme right of the toolbar, creating a right group if one does not exist. @end table
#### This function does not yet support inserting the group delimiter nil as an explicit item.
@var{position} may be greater than (length @var{toolbar-spec}), in which case it is truncated to (length @var{toolbar-spec}). Note that @code{(length @var{toolbar-spec})} is not synonymous with @code{right} or @code{extreme-right} (@code{extreme-right} will create a right group if it doesn't already exist). @end defun
@defun toolbar-new-button icon-spec command help-string &optional initially-disabled Return a checked toolbar button specification.
@table @var @item icon-spec A list of glyphs (from @code{make-glyph}), a glyph, or a string to use as the button's icon. If a string or single glyph, it will be used for the button-up glyph. If a list, it may contain 1 to 6 glyphs, which XEmacs will use for button up, button down, button disabled, button up with caption, button down with caption, and button disabled with caption, in that order. Missing or nil glyphs will be defaulted. (#### Strings as list elements are not supported but could be.)
@item command The (interactive) command to invoke when the button is pressed.
@item help-string A string briefly describing the command, displayed in the echo area or as balloon help when the pointer enters the button.
@item initially-disabled Optional. If non-@code{nil}, specifies that the button should initially be disabled.
See @code{default-toolbar} or the Lispref (@pxref{Toolbars, , , lispref}) for more information. @end table @end defun
@defun toolbar-new-spacer style &optional size Returns a checked toolbar spacer ``button''.
@table @var @item style One of the symbols @code{2d} or @code{3d}, indicating whether the area is displayed without shadows (giving it a flat appearance), or with shadows (giving it a raised, 3-D appearance). There is no default. #### We may set a default style. Tell stephen@@xemacs.org which you use.
@item size Specifies the length, in pixels, of the blank area. If omitted, it defaults to a device-specific value (8 pixels for X devices). @end table @end defun
@defun make-toolbar-instantiator &optional toolbar-spec domain Return a checked toolbar instantiator, a list of vectors.
@table @var @item toolbar-spec May be a list of buttons (ie, a toolbar descriptor, see @code{default-toolbar}), a toolbar specifier object, a symbol whose value is a toolbar specifier object, or @code{nil}. If @code{nil}, returns a null list. If a toolbar specifier object or variable containing one, the specification for DOMAIN is used. If non-nil, DOMAIN must be a window, a frame, or a device, otherwise it defaults to the selected window (see @code{specifier-instance}). The list thus generated is checked and returned.
If @var{toolbar-spec} is a list, it is copied; it is safe to pass other packages' toolbar initializers to this function. However, you probably do not want to change any of the objects in the returned specification. They are returned as is, not copied.
See @code{default-toolbar} or the Lispref (@pxref{Toolbars, , , lispref}) for more information. @end table @end defun
@defun toolbar-kill-item-pos pos &optional toolbar locale Kill the item at position @var{pos} of @var{toolbar} in @var{locale}. Killed buttons are prepended to @code{button-palette}.
@var{locale} defaults to @code{global}. If there are multiple specs for @var{locale}, take the first one.
This function currently does not accept symbolic positions a la @code{toolbar-add-item}. Use @code{toolbar-find-item} to locate whole buttons and spacers, and @code{toolbar-find-button} to locate buttons by characteristics. See also @code{toolbar-find-button-by-icon}, @code{toolbar-find-button-by-command}, and @code{toolbar-find-button-by-help-string}. @end defun
@node APIs for Search, Toolbar Portability, APIs for Adding and Killing, The Toolbar Utilities @section APIs for Search
@defun toolbar-find-button item &optional toolbar locale Return the position of a button containing @var{item} in its specification.
@table @var @item item May specify a button, spacer, icon, command, help string, or nil. If @var{item} is nil, find the separator between the group of buttons to be left justified, and the group to be right justified. (Distinctions among the various ``search key types'' are somewhat heuristic but are probably reliable enough to use in library code.)
@item toolbar If non-@code{nil}, search it; otherwise search the default toolbar.
@item locale If non-@code{nil}, get @var{toolbar}'s descriptor in that locale, otherwise use the @code{global} locale. @end table @end defun
@defun toolbar-find-item item &optional toolbar locale Return the position of @var{item}, a button, spacer, or nil. @var{toolbar} and @var{locale} determine the descriptor to be searched.
If @var{item} is nil, find the separator between the group of buttons to be left justified, and the group to be right justified. If there are several matching items, the first is returned. If none is found, return nil. @end defun
@defun toolbar-find-button-by-icon icon &optional toolbar locale Return the position of a button with icon @var{icon}. @var{icon} must be a list of glyphs or a symbols whose value is a list of glyphs. @var{toolbar} and @var{locale} determine the descriptor to be searched.
If there are several matching buttons, the first is returned. @end defun
@defun toolbar-find-button-by-command cmd &optional toolbar locale Return the position of a button invoking command CMD. @var{toolbar} and @var{locale} determine the descriptor to be searched.
If there are several matching buttons, the first is returned. @end defun
@defun toolbar-find-button-by-help-string str &optional toolbar locale
Return the position of a button with help-string @var{str}. @var{toolbar} and @var{locale} determine the descriptor to be searched.
If there are several matching buttons, the first is returned. This function will not find spacers. @end defun
@defun toolbar-find-button-by-element object index toolbar locale &optional thunk Return the position of a button containing @var{object} in element @var{index}. @var{toolbar} and @var{locale} determine the descriptor to be searched.
Optional argument @var{thunk} is a function of one argument which is used to normalize @var{object} for comparison.
If there are several matching buttons, the first is returned. This function will not find spacers. @end defun
@node Toolbar Portability, , APIs for Search, The Toolbar Utilities @section Toolbar API Portability to GNU Emacs @cindex GNU Emacs compatibility @cindex compatibility libraries, GNU Emacs
The @file{xemacs-toolbar.el} library provides XEmacs toolbar compatibility functions for GNU Emacs.
Third-party maintainers may use the same APIs in GNU Emacs as in XEmacs. Simply provide this library with your own code, and load it conditionally:
@example
(if (featurep 'xemacs)
(require 'toolbar-utils)
(require 'toolbar-utils "xemacs-toolbar")) @end example
XEmacs features that are not present in GNU Emacs will be ignored, and various arguments with different semantics will be defaulted appropriately.
User commands such as @code{toolbar-add-kbd-macro} and advanced features such as the toolbar editor and the button cache are not presently provided.
@node foldout, func-menu, The Toolbar Utilities, Top @chapter Folding Extensions for Outline-Mode
This file provides folding editor extensions for @code{outline-mode} and @code{outline-minor-mode} buffers. What's a "folding editor"? Read on...
Imagine you're in an @code{outline-mode} buffer and you've hidden all the text and subheadings under your level-1 headings. You now want to look at the stuff hidden under one of these headings. Normally you'd do @kbd{C-c C-e} @code{(show-entry)} to expose the body or @kbd{C-c C-i} to expose the child (level-2) headings.
With foldout, you do @kbd{C-c C-z} (@code{foldout-zoom-subtree}). This exposes the body and child subheadings and narrows the buffer so that only the level-1 heading, the body and the level-2 headings are visible. If you now want to look under one of the level-2 headings, position the cursor on it and do @kbd{C-c C-z} again. This exposes the level-2 body and its level-3 child subheadings and narrows the buffer again. You can keep on zooming in on successive subheadings as much as you like. A string in the modeline tells you how deep you've gone.
When zooming in on a heading you might only want to see the child subheadings. You do this by specifying a numeric argument: @kbd{C-u C-c C-z}. You can specify the number of levels of children too (c.f. @code{show-children}): e.g. @kbd{M-2 C-c C-z} exposes two levels of child subheadings. Alternatively, you might only be interested in the body. You do this by specifying a negative argument: @kbd{M-- C-c C-z}. You can also cause the whole subtree to be expanded, similar to @kbd{C-c C-s} (@code{show-subtree}), by specifying a zero argument: @kbd{M-0 C-c C-z}.
While you're zoomed in you can still use outline-mode's exposure and hiding functions. It won't upset foldout at all. Also, since the buffer is narrowed, "global" editing actions will only affect the stuff under the zoomed-in heading. This is useful for restricting changes to a particular chapter or section of your document.
You unzoom (exit) a fold by doing @kbd{C-c C-x} (@code{foldout-exit-fold}). This hides all the text and subheadings under the top-level heading and returns you to the previous view of the buffer. Specifying a numeric argument exits that many folds. Specifying a zero argument exits *all* folds.
You might want to exit a fold *without* hiding the text and subheadings. You do this by specifying a negative argument. For example, @kbd{M--2 C-c C-x} exits two folds and leaves the text and subheadings exposed.
Foldout also provides mouse bindings for entering and exiting folds and for showing and hiding text. Hold down Meta and Control, then click a mouse button as follows:-
@itemize @bullet
@item mouse-1 (@code{foldout-mouse-zoom}) zooms in on the heading clicked on:
@itemize @minus
@item single click -- expose body
@item double click -- expose subheadings
@item triple click -- expose body and subheadings
@item quad click -- expose entire subtree
@end itemize
@item mouse-2 (@code{foldout-mouse-show}) exposes text under the heading clicked on:
@itemize @minus
@item single click -- expose body
@item double click -- expose subheadings
@item triple click -- expose body and subheadings
@item quad click -- expose entire subtree
@end itemize
@item mouse-3 (@code{foldout-mouse-hide-or-exit}) hides text under the heading clicked on or exits the fold:
@itemize @minus
@item single click -- hide subtree
@item double click -- exit fold and hide text
@item triple click -- exit fold without hiding text
@item quad click -- exit all folds and hide text
@end itemize
@end itemize
You can change the modifier keys used by setting @code{foldout-mouse-modifiers}.
To use foldout, put this in your initialization file:
@example
(require 'foldout) @end example
If you don't want it loaded until you need it, try this instead:
@example
(eval-after-load "outline" '(require 'foldout)) @end example
@node func-menu, id-select, foldout, Top @chapter Jump to a Function Within a Buffer.
Suppose you have a file with a lot of functions in it. Well, this package makes it easy to jump to any of those functions. The names of the functions in the current buffer are automatically put into a menubar menu, you select one of the function-names and the point is moved to that very function. The mark is pushed on the mark-ring, so you can easily go back to where you were. Alternatively, you can use enter the name of the desired function via the minibuffer which offers completing read input. In addition, the name of the function before point is optionally displayed in the modeline.
The following modes are supported:
Ada, Assembly, BibTex, C++, C, Dired, Ehdm, ELisp, FORTRAN, Ksh, Latex, Lelisp, Makefile, Maple, Modula2, Modula3, Outline, Objective-C, Pascal, Perl, Postscript, Prolog, PVS, Python, SGML, Scheme, Tcl, Verilog, Manual, Ruby, JavaScript
To install this package, add the following to your initialization file:
@example
(add-hook 'find-file-hooks 'fume-setup-buffer)
(add-hook 'Manual-mode-hook 'turn-on-fume-mode) @end example
@node id-select, outl-mouse, func-menu, Top @chapter Select Syntax-Driven Regions in a Buffer
This is a radically cool, drop in mouse and keyboard-based library for selecting successively bigger syntactical regions within a buffer. Simply load this library and you are ready to try it out by double-clicking on various kinds of characters in different buffer major modes. You'll quickly get the hang of it. (It also provides a command to jump between beginning and end tags within HTML and SGML buffers.)
A great deal of smarts are built-in so that it does the right thing almost all of the time; many other attempts at similar behavior such as @file{thing.el} fail to deal with many file format complexities.
Double clicks of the Selection Key (left mouse key) at the same point will select bigger and bigger regions with each successive use. The first double click selects a region based upon the character at the point of the click. For example, with the point over an opening or closing grouping character, such as @{ or @}, the whole grouping is selected, e.g. a C function. When on an _ or - within a programming language variable name, the whole name is selected. The type of selection is displayed in the minibuffer as feedback. When using a language based mainly on indenting, like Bourne shell, a double click on the first alpha character of a line, such as an if statement, selects the whole statement.
This whole package is driven by a single function, available in mouse and keyboard forms, that first marks a region based on the syntax category of the character following point. Successive invocations mark larger and larger regions until the whole buffer is marked. See the documentation for the function, @code{id-select-syntactical-region}, for the kinds of syntax categories handled.
Loading this package automatically installs its functionality on double-clicks (or higher) of the left mouse key. (See the documentation for the variable, @code{mouse-track-click-hook}, for how this is done.) A single click of the left button will remove the region and reset point.
The function, @code{id-select-thing}, may be bound to a key to provide the same syntax-driven region selection functionality. @kbd{C-c C-m} is a reasonable site-wide choice since this key is seldom used and it mnemonically indicates marking something. @kbd{C-c s} may be preferred as a personal binding.
Use @kbd{C-g} to unmark the region when done. Use, @code{id-select-thing-with-mouse}, if you want to bind this to a mouse key and thereby use single clicks instead of double clicks.
Three other commands are also provided:
@table @code
@item id-select-and-copy-thing mark and copy the syntactical unit to the kill ring
@item id-select-and-kill-thing kill the syntactical unit at point
@item id-select-goto-matching-tag In HTML and SGML modes (actually any listed in the variable, `id-select-markup-modes'), moves point to the start of the tag paired with the closest tag that point is within or which it precedes, so you can quickly jump back and forth between open and close tags.
@end table
To autoload this package via mouse usage, add the following line to one of your initialization files:
@example
(add-hook 'mouse-track-click-hook 'id-select-double-click-hook) @end
example
To configure this package, type:
@example
M-x customize-group RET id-select RET @end example
@node outl-mouse, page-ext, id-select, Top @chapter Outline-Mode Mouse Commands
Defines @kbd{mouse button one} to hide blocks when clicked on outline-up-arrow and expand blocks when clicked on outline-down-arrow. Features are activated when @code{outline-minor-mode} or @code{outline-mode} are turned on. There is also a menu for each glyph on @kbd{mouse button 3}.
To use, add the following to your initialization file:
@example
(require 'outl-mouse) @end example
If you use func-menu all the time and want outl-mouse on all the time as well then specify @code{(setq outline-sync-with-func-menu t)}. Outlining will then be turned on when func-menu is activated.
If you want mac-style outlining then set @code{outline-mac-style} to t. If you want the outline arrows on the left then set @code{outline-glyphs-on-left} to t. If you have xpm then arrows are much better defined.
To configure this package, type:
@example
M-x customize-group RET outl-mouse RET @end example
@node page-ext, power-macros, outl-mouse, Top @chapter Extended Page Handling Commands
The page commands are helpful in several different contexts. For example, programmers often divide source files into sections using the @code{page-delimiter}; you can use the @code{pages-directory} command to list the sections.
You may use the page commands to handle an address list or other small data base. Put each address or entry on its own page. The first line of text in each page is a `header line' and is listed by the @code{pages-directory} or @code{pages-directory-for-addresses} command.
@menu * Key Assignments: page-ext-keys. * Using the Page Commands: page-ext-using. * Address List or Small Database: page-ext-addr. @end menu
@node page-ext-keys, page-ext-using, page-ext, page-ext @section Key Assignments
The current page commands are:
@multitable {pages-directory-for-addresses} {C-x C-p (change this to C-x C-p C-m)}
@item forward-page @tab C-x ] @item backward-page @tab C-x [ @item narrow-to-page @tab C-x p @item count-lines-page @tab C-x l @item mark-page @tab C-x C-p (change this to C-x C-p C-m) @item sort-pages @tab not bound @item what-page @tab not bound
@end multitable
The new page handling commands all use @kbd{C-x C-p} as a prefix. This means that the key binding for @code{mark-page} must be changed. Otherwise, no other changes are made to the current commands or their bindings.
The extended page handling commands are:
@multitable {pages-directory-for-addresses} {C-x C-p (change this to C-x C-p C-m)}
@item next-page @tab C-x C-p C-n @item previous-page @tab C-x C-p C-p @item search-pages @tab C-x C-p C-s @item add-new-page @tab C-x C-p C-a @item sort-pages-buffer @tab C-x C-p s @item set-page-delimiter @tab C-x C-p C-l @item pages-directory @tab C-x C-p C-d @item pages-directory-for-addresses @tab C-x C-p d @item pages-directory-goto @tab C-c C-c
@end multitable
@node page-ext-using, page-ext-addr, page-ext-keys, page-ext @section Using the Page Commands
The page commands are helpful in several different contexts. For example, programmers often divide source files into sections using the @code{page-delimiter}; you can use the @code{pages-directory} command to list the sections.
You may change the buffer local value of the @code{page-delimiter} with the @code{set-page-delimiter} command. This command is bound to @kbd{C-x C-p C-l}. The command prompts you for a new value for the @code{page-delimiter}. Called with a prefix-arg, the command resets the value of the page-delimiter to its original value.
You may set several user options:
@table @code
@item pages-directory-buffer-narrowing-p Causes the @code{pages-directory-goto} command to narrow to the destination page.
@item pages-directory-for-adding-page-narrowing-p Causes the @code{add-new-page} command to narrow to the new entry.
@item pages-directory-for-adding-new-page-before-current-page-p Causes the @code{add-new-page} command to insert a new page before current page.
@end table
These variables are all true by default.
@node page-ext-addr, , page-ext-using, page-ext @section Address List or Small Database
You may use the page commands to handle an address list or other small data base. Put each address or entry on its own page. The first line of text in each page is a `header line' and is listed by the @code{pages-directory} or @code{pages-directory-for-addresses} command.
Specifically:
@enumerate
@item
Begin each entry with a `page-delimiter' (which is, by default, `^L' at the beginning of the line).
@item
The first line of text in each entry is the `heading line'; it will appear in the pages-directory-buffer which is constructed using the @kbd{C-x C-p C-d} (@code{pages-directory}) command or the @kbd{C-x C-p d} (@code{pages-directory-for-addresses}) command.
The heading line may be on the same line as the page-delimiter or it may follow after. It is the first non-blank line on the page. Conventionally, the heading line is placed on the line immediately following the line containing page-delimiter.
@item
Follow the heading line with the body of the entry. The body extends up to the next `page-delimiter'. The body may be of any length. It is conventional to place a blank line after the last line of the body.
@end enumerate
For example, a file might look like this:
@example
FSF
Free Software Foundation
59 Temple Place - Suite 330
Boston, MA 02111-1307 USA.
(617) 542-5942
gnu@@prep.ai.mit.edu
?
House Subcommittee on Intellectual Property,
U.S. House of Representatives,
Washington, DC 20515
Congressional committee concerned with permitting or preventing
monopolistic restrictions on the use of software technology.
?
George Lakoff
``Women, Fire, and Dangerous Things:
What Categories Reveal about the Mind''
1987, Univ. of Chicago Press
About philosophy, Whorfian effects, and linguistics.
?
OBI (On line text collection.)
Open Book Initiative
c/o Software Tool & Die
1330 Beacon St, Brookline, MA 02146 USA
(617) 739-0202
obi@@world.std.com @end example
In this example, the heading lines are:
@example
FSF
House Subcommittee on Intellectual Property
George Lakoff
OBI (On line text collection.) @end example
The @kbd{C-x C-p s} (@code{sort-pages-buffer}) command sorts the entries in the buffer alphabetically.
You may use any of the page commands, including the @code{next-page}, @code{previous-page}, @code{add-new-page}, @code{mark-page}, and @code{search-pages} commands.
You may use either the @kbd{C-x C-p d} (@code{pages-directory-for-addresses}) or the @kbd{C-x C-p C-d} (@code{pages-directory}) command to construct and display a directory of all the heading lines.
In the directory, you may position the cursor over a heading line and type @kbd{C-c C-c} (@code{pages-directory-goto}) to go to the entry to which it refers in the pages buffer.
You can type @kbd{C-c C-p C-a} (@code{add-new-page}) to add a new entry in the pages buffer or address file. This is the same command you use to add a new entry when you are in the pages buffer or address file.
If you wish, you may create several different directories, one for each different buffer.
@code{`pages-directory-for-addresses} assumes a default addresses file. You do not need to specify the addresses file but merely type @kbd{C-x C-p d} from any buffer. The command finds the file, constructs a directory for it, and switches you to the directory. If you call the command with a prefix arg, @kbd{C-u C-x C-p d}, it prompts you for a file name.
You may customize the addresses commands:
@table @code
@item pages-addresses-file-name Determines the name of the addresses file; by default it is "~/addresses".
@item pages-directory-for-addresses-goto-narrowing-p Determines whether @code{pages-directory-goto} narrows the addresses buffer to the entry, which it does by default.
@item pages-directory-for-addresses-buffer-keep-windows-p Determines whether @code{pages-directory-for-addresses} deletes other windows to show as many lines as possible on the screen or works in the usual Emacs manner and keeps other windows. Default is to keep other windows.
@item pages-directory-for-adding-addresses-narrowing-p Determines whether @code{pages-directory-for-addresses} narrows the addresses buffer to a new entry when you are adding that entry. Default is to narrow to new entry, which means you see a blank screen before you write the new entry.
@end table
Call the @code{pages-directory} command from the buffer for which you want a directory created; it creates a directory for the buffer and pops you to the directory.
The @code{pages-directory} command has several options:
@enumerate
@item
Called with a prefix arg, @kbd{C-u C-x C-p C-d}, the @code{pages-directory} prompts you for a regular expression and only lists only those header lines that are part of pages that contain matches to the regexp. In the example above, @kbd{C-u C-x C-p C-d 617 RET} would match the telephone area code of the first and fourth entries, so only the header lines of those two entries would appear in the pages-directory-buffer.
@item
Called with a numeric argument, the @code{pages-directory} command lists the number of lines in each page. This is helpful when you are printing hardcopy.
@item
Called with a negative numeric argument, the @code{pages-directory} command lists the lengths of pages whose contents match a regexp.
@end enumerate
To configure this package, type:
@example
M-x customize-group RET pages RET @end example
@node power-macros, redo, page-ext, Top @chapter Power Macros - Keyboard Macros Made Easy
Keyboard Macros are a very powerful tool, if you know how to use them the right way! Without this extension it is, however, a bit difficult in Emacs to define and maintain several macros at a time. This problem is solved with this package.
When you have loaded this package Emacs will, upon completion of macro definition, ask you which key you want to assign this macro to and ask for a description of the macro. If something is already bound to this key, Emacs will ask you whether you want to override this binding. Furthermore, this package also takes care of saving the macro to your initialization file for later Emacs sessions.
The description for all the defined macros may be obtained with the function `pm-manage-macros'. Using this function you can also manage your power-macros.
To execute this function, type:
@example
M-x pm-manage-macros RET @end example
To configure the package, type:
@example
M-x customize-group RET power-macros RET @end example
@node redo, scroll-in-place, power-macros, Top @chapter Redo/Undo System
Emacs' normal undo system allows you to undo an arbitrary number of buffer changes. These undos are recorded as ordinary buffer changes themselves. So when you break the chain of undos by issuing some other command, you can then undo all the undos. The chain of recorded buffer modifications therefore grows without bound, truncated only at garbage collection time.
The redo/undo system is different in two ways:
@enumerate
@item
The undo/redo command chain is only broken by a buffer modification. You can move around the buffer or switch buffers and still come back and do more undos or redos.
@item
The @code{redo} command rescinds the most recent undo without recording the change as a _new_ buffer change. It completely reverses the effect of the undo, which includes making the chain of buffer modification records shorter by one, to counteract the effect of the undo command making the record list longer by one.
@end enumerate
To use this package, add the following to your initialization file:
@example
(require 'redo) @end example
@node scroll-in-place, setnu, redo, Top @chapter Scrolling In Place
This library provides improved vertical scrolling commands for GNU Emacs.
@menu * Features: sip-features. * Commands and Functions: sip-commands. * Installation: sip-install. * Advanced Customization: sip-customize @end menu
@node sip-features, sip-commands, scroll-in-place, scroll-in-place @section Features
The new vertical scrolling commands offer the following features:
@itemize @bullet
@item
When a scrolling command is executed, GNU Emacs tries to keep point as close as possible to its original window position (window line and column). This is what "scroll in place" means: point stays "in place" within the window. (There are times when point must be moved from its original window position in order to execute the scroll; see below.)
The variable @code{scroll-in-place}, which is true by default, determines whether or not the standard GNU Emacs scrolling commands (@code{scroll-down}, @code{scroll-up}, @code{scroll-other-window-down}, and @code{scroll-other-window}) use the "in place" features listed here. When @code{scroll-in-place} is nil the standard GNU Emacs scrolling commands essentially just call the original versions of themselves. (Note that even when @code{scroll-in-place} is nil the new versions of @code{scroll-down} and @code{scroll-up} have slightly different behavior when a minibuffer window is the selected window. See below.)
It is possible to turn off (or turn on) "in place" scrolling for certain buffers by making buffer-local bindings of the variable @code{scroll-in-place} for those buffers. The variable @code{scroll-in-place} is not usually buffer-local, but you can make it so if you desire.
@item
Because the improved scrolling commands keep point at its original window position, these scrolling commands are "reversible." The @code{scroll-up} command undoes the effect of the immediately previous @code{scroll-down} command (if any) and vice versa. In other words, if you scroll up and then immediately scroll back down, the window configuration is restored to its exact original state. This allows you to browse through a buffer more easily, as you can always get back to the original configuration.
Note, however, that the improved scrolling commands are guaranteed to be reversible only if there are no intervening non-scrolling commands. Also, if you give a prefix argument to a scrolling command (in order to specify the number of lines to scroll by), previous scrolling commands may no longer be reversible. More specifically, if the new prefix argument has a different magnitude than the previous scrolling distance, then any previous scrolling commands are not reversible. The new prefix argument takes precedence.
You might find it useful to think of the scrolling commands as forming "chains." A scrolling command either starts or continues a chain. By issuing a non-scrolling command or by changing the number of lines to be scrolled, you break the chain. (Note that simply changing the scrolling direction won't break the chain; changing the absolute number of lines to be scrolled is what breaks the chain.) Scrolling commands are guaranteed to be reversible only within the current chain. Hopefully that's clear enough.
@item
When a scrolling command is given a prefix argument (which specifies the number of lines to scroll by), then that argument becomes the default scrolling distance for all immediately subsequent scrolling commands. This means that you can easily set the scrolling distance for a chain of scrolling commands. Note that a new prefix argument or any non- scrolling command breaks the chain (as described above), and any further scrolling commands will use the usual defaults (or the prefix argument you specify at that time, of course).
However, there are cases in which one doesn't want the current scrolling command to use the default scrolling distance that was set by the previous scrolling command. For example, suppose that you had special commands that scrolled one line up and one line down. When you invoke one of these commands, the "in place" scrolling routines set the default scrolling distance to be just one line. Now suppose that you use one of your special commands and then immediately invoke @code{scroll-up} (@kbd{C-v}), expecting it to scroll by a near windowful of text. You would be disappointed --- because the previous command set the default scrolling distance to be just one line, @code{scroll-up} just scrolls by one line.
To solve this problem, "scroll-in-place" allows you to divide scrolling commands into separate "groups." Commands in a group can only form chains with (and therefore, inherit defaults from) commands in the same group. (Note that no command can be in more than one group.) If you invoke a scrolling command that is not in the same group as that of the immediately previous scrolling command, then the previous chain is broken and you start a new chain --- with a new set of defaults.
So to solve the problem described above, you could put your one-line scrolling commands in their own group. Once that is done, the standard scrolling commands will not form chains with your one-line scrolling commands, and therefore will not use the default scrolling distance set by those commands. Problem solved!
By default, all "in place" scrolling commands are in a single group. If you want to partition some commands into separate groups, you must do that yourself @emph{before} any "in place" commands are invoked. For more information about grouping commands, see the documentation for the variables @code{scroll-command-groups} and @code{scroll-default-command-group}.
@item
The improved scrolling commands will avoid displaying empty lines past the end of the buffer when possible. In other words, just as you can't see "dead space" before the beginning of the buffer text, the new scrolling commands try to avoid displaying "dead space" past the end of the buffer text. This behavior is somewhat configurable; see the documentation for the variable @code{scroll-allow-blank-lines-past-eob}.
Dead space will be displayed if it is necessary in order to make a previous scrolling action reversible, however.
@item
If the scrolling commands cannot keep point at its initial window position (because a buffer boundary is on screen and the window can't be scrolled as far as necessary to keep point at the right place), point is allowed to temporarily stray from its initial window position. That is, point moves the correct number of window lines, even if it means that it has to stray from its desired window position. This straying is undone when (and if) the scrolling action is reversed.
@item
If a scrolling command tries to move point past a buffer boundary, point is instead moved to the boundary (the beginning or the end of the buffer as appropriate) and an appropriate message is displayed. This motion is reversible, of course.
However, if point was already at the buffer boundary when the scrolling command was invoked, the command signals an appropriate error instead.
@item
When a minibuffer window is the selected window, the new versions of @code{scroll-up} and @code{scroll-down} either scroll the window in the variable @code{minibuffer-scroll-window} (which is usually the window of completions) or the @code{next-window} if there is no @code{minibuffer-scroll-window}. This is usually much more useful than scrolling the minibuffer itself. (Note that this feature is available even when the variable @code{scroll-in-place} is nil.)
@item
When a scrolling command is scrolling a window other than the selected window, it will signal an appropriate buffer boundary error if the window cannot be scrolled (because the appropriate buffer boundary is already visible). This means that an error is signalled even in cases that would be allowed (by "straying" point or by moving it to the buffer boundary) if the window were selected.
(If an error were not signalled in these cases, then there would be many cases in which the last scroll in a particular direction would appear to do nothing because only the point position would change --- the displayed text would stay the same! To avoid these cases the scrolling commands signal boundary errors "prematurely" when the window to be scrolled is not selected.)
@end itemize
@node sip-commands, sip-install, sip-features, scroll-in-place @section Command and Functions
This library provides the following "in place" versions of GNU Emacs' standard vertical scrolling commands:
@itemize @bullet @item scroll-down-in-place @item scroll-up-in-place @item scroll-other-window-down-in-place @item scroll-other-window-in-place @end itemize
The variable @code{scroll-in-place}, which is true by default, determines whether or not the new versions of the standard GNU Emacs scrolling commands (@code{scroll-down}, @code{scroll-up}, @code{scroll-other-window-down}, and @code{scroll-other-window}) use the "in place" features listed above. When @code{scroll-in-place} is nil the standard GNU Emacs scrolling commands essentially just call the original versions of themselves. (Note that even when @code{scroll-in-place} is nil the new versions of @code{scroll-down} and @code{scroll-up} have slightly different behavior when a minibuffer window is the selected window. See the feature list above.)
NOTE that this package redefines the standard GNU Emacs commands @code{scroll-down}, @code{scroll-up}, @code{scroll-other-window-down}, and @code{scroll-other-window} (in order to check the variable @code{scroll-in-place}, as described above). The command @code{scroll-other-window-down} first appeared as a standard command in the FSF's GNU Emacs 19.26.
This package also provides the following functions and variables which are of use to programmers:
@itemize @bullet @item scroll-window @item scroll-window-in-place @item scroll-window-in-place-continue-sequence @item scroll-default-lines (variable) @item scroll-command-groups (variable) @end itemize
The @code{scroll-window-in-place} function is the heart of the "in place" scrolling commands. @code{scroll-window} is a function that checks the variable @code{scroll-in-place} and calls the appropriate scrolling function (either @code{scroll-window-in-place} or one of the original versions of @code{scroll-down} and @code{scroll-up}). The function @code{scroll-window-in-place-continue-sequence} is provided in order to preserve running "chains" of scrolling commands as described above.
The variable @code{scroll-default-lines} determines the default scrolling distance when a new chain of "in place" scrolling commands begins. If this variable is not a number, then the default distance is the height of the window to be scrolled minus @code{next-screen-context-lines}. The variable @code{scroll-command-groups} contains the explicit groups of "in place" scrolling commands; for more information read the variable documentation.
@node sip-install, sip-customize, sip-commands, scroll-in-place @section Installation
To use this package, you simply need to load it from within your initialization file:
@example
(require 'scroll-in-place) @end example
By default, this package provides for the standard GNU Emacs vertical scrolling commands (@code{scroll-down}, @code{scroll-up}, @code{scroll-other-window-down}, and @code{scroll-other-window}) to use the "in place" features. If you would rather not have this, set the variable @code{(setq scroll-in-place nil)}.
When @code{scroll-in-place} is nil you will have to bind keys in order to call the "in place" scrolling commands. For example, you might want to do the following:
@example
(global-set-key "v" 'scroll-down-in-place)
(global-set-key "-v" 'scroll-up-in-place) @end example
@node sip-customize, , sip-install, scroll-in-place @section Advanced Customization
If you want to partition certain "in place" scrolling commands into separate groups, you should do something like the following:
@example
;; Make one group containing the commands `scroll-down-one-line' and
;; `scroll-up-one-line'. (These are not standard GNU Emacs commands.)
(setq scroll-command-groups
(list '(scroll-down-one-line scroll-up-one-line))) @end example
You could write the `scroll-down-one-line' command like this:
@example
(defun scroll-down-one-line (arg)
"Scroll down one line, or number of lines specified by prefix arg."
(interactive "P")
(let ((scroll-default-lines 1))
(scroll-down-in-place arg))) @end example
If you want to disable "in place" scrolling for windows that display a particular buffer (while leaving it available in other windows), you can make @code{scroll-in-place} a buffer-local variable for that buffer and then bind that local copy of @code{scroll-in-place} to nil. This is the kind of thing that one generally does in a major mode hook. For example, you can disable "in place" scrolling of GNUS article windows with the following code:
@example
(setq gnus-article-mode-hook
(function (lambda ()
(make-local-variable 'scroll-in-place)
(setq scroll-in-place nil))))
;; Set the variable `gnus-Article-mode-hook' instead if you are using
;; an old version of GNUS, say version 3.13 or 3.14. @end example
The variable @code{scroll-allow-blank-lines-past-eob} can also be made local to particular buffers, if you desire. (But why would you want to do that?)
@node setnu, vertical-mode, scroll-in-place, Top @chapter VI-style Line Number Mode
This library activates VI-style line numbering for a buffer.
@code{M-x setnu-mode} toggles the line number mode on and off.
@code{turn-on-setnu-mode} is useful for adding to a major-mode hook variable.
@example
(add-hook 'text-mode-hook 'turn-on-setnu-mode) @end example
to automatically turn on line numbering when entering text-mode.
@node vertical-mode, align, setnu, Top @chapter Vertical Mode - Editing of Vertical Text
This minor mode allows you to conveniently edit things that are oriented vertically (like tables in computer programs): after each action, cursor moves down. Therefore, to move block of text to the right, you simply enter vertical mode and then hold @kbd{spacebar}, waiting for autorepeat to do the job for you.
@node align, allout, vertical-mode, Top @chapter Align Text to a Specific Column, By Regexp
This mode allows you to align regions in a context-sensitive fashion. The classic use is to align assignments:
@example
int a = 1;
short foo = 2;
double blah = 4; @end example
becomes
@example
int a = 1;
short foo = 2;
double blah = 4; @end example
@menu * Align Usage:: How to use the package. @end menu
@node Align Usage, , align, align @section Align Usage
To configure the package, type:
@example
M-x customize-group RET align RET @end example
There are several variables which define how certain "categories" of syntax are to be treated. These variables go by the name `align-CATEGORY-modes'. For example, "c++" is such a category. There are several rules which apply to c++, but since several other languages have a syntax similar to c++ (e.g., c, java, etc), these modes are treated as belonging to the same category.
If you want to add a new mode under a certain category, just customize that list, or add the new mode manually. For example, to make jde-mode a c++ category mode, use this code in your initialization file:
@example
(setq align-c++-modes (cons 'jde-mode align-c++-modes)) @end example
In some programming modes, it's useful to have the aligner run only after indentation is performed. To achieve this, customize or set the variable `align-indent-before-aligning' to t.
@node allout, narrow-stack, align, Top @chapter Extensive Outline Mode
Allout outline mode provides extensive outline formatting and manipulation beyond standard emacs outline mode (@pxref{Outline Mode,,,xemacs}). It provides for structured editing of outlines, as well as navigation and exposure. It also provides for syntax-sensitive text like programming languages. (For an example, see the allout code itself, which is organized in ;; an outline framework.)
In addition to outline navigation and exposure, allout includes:
@itemize @bullet
@item topic-oriented repositioning, cut, and paste
@item integral outline exposure-layout
@item incremental search with dynamic exposure and reconcealment of hidden text
@item automatic topic-number maintenance
@item "Hot-spot" operation, for single-keystroke maneuvering and exposure control. (See the outline-mode docstring.)
@end itemize
and many other features.
To configure the package, type:
@example
M-x customize-group RET allout RET @end example
To use the allout package in place of the standard outline package, add the following bit of code
@lisp (require 'outline "allout") @end lisp
to your initialization file. This will ensure that all the functions provided by the outline package will be loaded from the new allout package instead.
The outline menubar additions provide quick reference to many of the features, and see the docstring of the variable `outline-init' for instructions on priming your emacs session for automatic activation of outline-mode.
See the docstring of the variables `outline-layout' and `outline-auto-activation' for details on automatic activation of allout outline-mode as a minor mode.
By default, allout mode does not fontify the buffer. To get Font Lock to work put the following into your initialization file (adapted from the standard outline mode):
@example
(defvar rf-allout-font-lock-keywords
'(;;
;; Highlight headings according to the level.
(eval . (list (concat "^\(" outline-regexp "\).+")
0 '(or (cdr (assq (outline-depth)
'((1 . font-lock-function-name-face)
(2 . font-lock-variable-name-face)
(3 . font-lock-keyword-face)
(4 . font-lock-builtin-face)
(5 . font-lock-comment-face)
(6 . font-lock-constant-face)
(7 . font-lock-type-face)
(8 . font-lock-string-face))))
font-lock-warning-face)
nil t)))
"Additional expressions to highlight in Outline mode.")
;; add font-lock to allout mode
(defun rf-allout-font-lock-hook ()
(set (make-local-variable 'font-lock-defaults)
'(rf-allout-font-lock-keywords t nil nil
outline-back-to-current-heading)))
(add-hook 'outline-mode-hook 'rf-allout-font-lock-hook) @end example
@node narrow-stack, flow-ctrl, allout, Top @chapter Extending the built-in narrowing functions
Narrowing, as implemented in Emacs has one limitation, namely that it is not possible to narrow within a narrowing, and then widen again to the previous narrowing. This package implements an extension to narrowing, which makes this possible.
To activate this extension type @code{M-x narrow-stack-mode} or add @code{(narrow-stack-mode)} to your initialization file.
@node flow-ctrl, makesum, narrow-stack, Top @chapter Flow Control
Terminals that use XON/XOFF flow control can cause problems with GNU Emacs users. This file contains Emacs Lisp code that makes it easy for a user to deal with this problem, when using such a terminal.
To invoke these adjustments, a user need only invoke the function @code{enable-flow-control-on} with a list of terminal types specified in the initialization file. As arguments, give it the names of one or more terminal types in use by that user which require flow control adjustments. Here's an example:
@example
(enable-flow-control-on "vt200" "vt300" "vt101"
"vt131") @end example
Portability note: This uses @code{(getenv "TERM")}, and therefore probably won't work outside of UNIX-like environments.
@node makesum, man, flow-ctrl, Top @chapter Generate Summary of All Key Binding
Displays a nice human-readable summary of all keybindings in a two-column format.
To invoke this command, type:
@example
M-x make-command-summary RET @end example
@node man, abbrevlist, makesum, Top @chapter Browse UNIX manual pages
This library defines the command @code{manual-entry} to browse Unix manual pages.
To invoke this command, type:
@example
M-x manual-entry RET @end example
For ease of use, autocompletion on @code{M-x man} will work just fine.
To configure this package, type:
@example
M-x customize-group RET man RET @end example
@node abbrevlist, file-part, man, Top @chapter Abbreviation List
This library not documented. Please contribute!
@node file-part, info-look, abbrevlist, Top @chapter Treat a Section of a Buffer as a Separate File
This library not documented. Please contribute!
@node info-look, live-icon, file-part, Top @chapter Major-Mode-Sensitive Info Index Lookup Facility
This library not documented. Please contribute!
@node live-icon, mode-motion+, info-look, Top @chapter Make Frame Icons Represent Current Frame Contents
This library not documented. Please contribute!
@node mode-motion+, popper, live-icon, Top @chapter Per Mode/Buffer Mouse Tracking With Highlighting
This library not documented. Please contribute!
@node popper, reportmail, mode-motion+, Top @chapter Shrink-Wrapped Temporary Windows
This library not documented. Please contribute!
@node reportmail, balloon-help, popper, Top @chapter Display Time and Load in Mode Line
This library not documented. Please contribute!
@node balloon-help, blink-paren, reportmail, Top @chapter Balloon Help and Tooltips
This library not documented. Please contribute!
@node blink-paren, edit-faces, balloon-help, Top @chapter Blinking Parentheses
This library not documented. Please contribute!
@node edit-faces, lispm-fonts, blink-paren, Top @chapter Face Editor
This library not documented. Please contribute!
@node lispm-fonts, big-menubar, edit-faces, Top @chapter lispm-fonts
This library not documented. Please contribute!
@node big-menubar, tree-menu, lispm-fonts, Top @chapter Big Menubar
This library not documented. Please contribute!
@node tree-menu, XEmacs License, big-menubar, Top @chapter tree-menu
This library not documented. Please contribute!
@node XEmacs License, , tree-menu, Top @chapter XEmacs License @unnumbered GNU GENERAL PUBLIC LICENSE @center Version 2, June 1991
@display Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display
@unnumberedsec Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public License is intended
to guarantee your freedom to share and change free software---to make sure
the software is free for all its users. This General Public License applies
to most of the Free Software Foundation's software and to any other program
whose authors commit to using it. (Some other Free Software Foundation
software is covered by the GNU Library General Public License instead.) You
can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These
restrictions translate to certain responsibilities for you if you distribute
copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its
recipients to know that what they have is not the original, so that any
problems introduced by others will not reflect on the original authors'
reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program
proprietary. To prevent this, we have made it clear that any patent must be
licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
@iftex @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @end iftex @ifinfo @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @end ifinfo
@enumerate 0 @item This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The ``Program'', below, refers to any such program or work, and a ``work based on the Program'' means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term ``modification''.) Each licensee is addressed as ``you''.
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
@item You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
@item You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
@enumerate a @item You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
@item You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
@item If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) @end enumerate
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
@item You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
@enumerate a @item Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
@item Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
@item Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) @end enumerate
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
@item You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
@item You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
@item Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
@item If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
@item If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
@item The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and ``any later version'', you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
@item If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
@iftex @heading NO WARRANTY @end iftex @ifinfo @center NO WARRANTY @end ifinfo
@item BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW@. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE@. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU@. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
@item IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. @end enumerate
@iftex @heading END OF TERMS AND CONDITIONS @end iftex @ifinfo @center END OF TERMS AND CONDITIONS @end ifinfo
@page @unnumberedsec How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the
exclusion of warranty; and each file should have at least the ``copyright''
line and a pointer to where the full notice is found.
@smallexample @var{one line to give the program's name and an idea of what it does.} Copyright (C) 19@var{yy} @var{name of author}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @end smallexample
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
@smallexample Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @end smallexample
The hypothetical commands @samp{show w} and @samp{show c} should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than @samp{show w} and @samp{show c}; they could even be mouse-clicks or menu items---whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here is a sample; alter the names:
@smallexample @group Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
@var{signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice @end group @end smallexample
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.