File: hui-select.el.html
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, SGML and XML 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
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, hui-select-syntactical-region, for the
kinds of syntax categories handled.
Running the command, hui-select-initialize, will install the
capabilities of this package and make double or triple clicks of
the left mouse key select bigger and bigger syntactic regions.
(See the documentation of the variable, hui-select-thing-with-mouse,
for how this is done).
The command, hui-select-thing, may be bound to a key to provide the same
syntax-driven region selection functionality. {C-c RETURN} is a
reasonable site-wide choice since this key is seldom used and it
mnemonically indicates marking something; Hyperbole typically
binds this key for you. {C-c s} may be preferred as a personal binding.
Use {C-g} to unmark the region when done. Use,
hui-select-thing-with-mouse, if you want to bind this to a
different mouse key to use single clicks instead of double clicks.
Four other commands are also provided:
hui-select-and-copy-thing - mark and copy the syntactical unit to the
kill ring
hui-select-and-kill-thing - kill the syntactical unit at point
hui-select-goto-matching-tag - In modes listed in the variable,
hui-select-markup-modes, move 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. In
these modes, this is bound to {C-c .}
hui-select-at-p - predicate to test if a buffer position (or point)
starts or ends a matching syntactical region (excluding a single character).
---------------
SETUP IF USED SEPARATELY FROM HYPERBOLE (otherwise ignore):
To autoload this package via mouse usage add the following line
to one of your initialization files.
(hui-select-initialize)
This will autoload this package, bind the selection command to a double
click of the left mouse button and set up Java, C++ and hui-select-markup-modes
for proper entity selection.
For any version of Emacs you should add the following autoload entries
at your site if the auto-autoloads.el file in this directory will
not be loaded:
(autoload 'hui-select-and-kill-thing "hui-select" "Kill syntactical region selection" t) (autoload 'hui-select-and-copy-thing "hui-select" "Select and copy syntactical region" t) (autoload 'hui-select-double-click-hook "hui-select" "Double mouse click syntactical region selection" nil) (autoload 'hui-select-thing "hui-select" "Keyboard-driven syntactical region selection" t) (autoload 'hui-select-thing-with-mouse "hui-select" "Single mouse click syntactical region selection" t)
Defined variables (17)
hui-select-bigger-alist | Unordered list of (<region-type-symbol> <region-selection-function>) pairs. |
hui-select-brace-modes | List of language major modes which define things with brace delimiters. |
hui-select-char-p | If t, return single character boundaries when all else fails. |
hui-select-display-type | If t, display the thing selected with each mouse click. |
hui-select-ignore-quoted-sexp-modes | List of modes in which to ignore quoted sexpressions for syntactic matches. |
hui-select-indent-end-regexp-alist | List of (MAJOR-MODE . TERMINATOR-LINE-REGEXP) elements. |
hui-select-indent-modes | List of modes that use indentation mostly to define syntactic structure. |
hui-select-indent-non-end-regexp-alist | List of (MAJOR-MODE . NON-TERMINATOR-LINE-REGEXP) elements. |
hui-select-markup-modes | List of markup language modes that use SGML-style <tag> </tag> pairs. |
hui-select-old-region | Cons cell that contains a region (<beginning> . <end>). |
hui-select-previous | Most recent type of selection. Must be set by all hui-select functions. |
hui-select-region | Cons cell that contains a region (<beginning> . <end>). |
hui-select-rgrep-command | Grep command string and initial arguments sent to ‘hui-select-rgrep’ command. |
hui-select-syntax-alist | Unordered list of pairs of the form (<syntax-char> <function>). |
hui-select-syntax-table | Syntax table to use when selecting delimited things. |
hui-select-text-modes | List of textual modes where paragraphs may be outdented or indented. |
hui-select-whitespace | If t, groups of whitespace are considered as things. |