File: generic-x.el.html
This file contains a collection of generic modes.
INSTALLATION:
Add this line to your init file:
(require 'generic-x)
You can decide which modes to load by setting the variable
generic-extras-enable-list. Its default value is platform-
specific. The recommended way to set this variable is through
customize:
M-x customize-option RET generic-extras-enable-list RET
This lets you select generic modes from the list of available
modes. If you manually set generic-extras-enable-list in your
.emacs, do it BEFORE loading generic-x with (require 'generic-x).
You can also send in new modes; if the file types are reasonably common, we would like to install them.
DEFAULT GENERIC MODE:
This file provides a hook which automatically puts a file into
default-generic-mode if the first few lines of a file in
fundamental mode start with a hash comment character. To disable
this functionality, set the variable generic-use-find-file-hook
to nil BEFORE loading generic-x. See the variables
generic-lines-to-scan and generic-find-file-regexp for
customization options.
PROBLEMS WHEN USED WITH FOLDING MODE:
[The following relates to the obsolete selective-display technique.
Folding mode should use invisible text properties instead. -- Dave
Love]
From Anders Lindgren
Problem summary: Wayne Adams has found a problem when using folding mode in conjunction with font-lock for a mode defined in generic-x.el.
The problem, as Wayne described it, was that error messages of the following form appeared when both font-lock and folding are used:
> - various msgs including "Fontifying region...(error Stack
> overflow in regexp matcher)" appear
I have just tracked down the cause of the problem. The regexp's in
generic-x.el do not take into account the way that folding hides
sections of the buffer. The technique is known as
selective-display and has been available for a very long time (I
started using it back in the good old Emacs 18 days). Basically, a
section is hidden by creating one very long line were the newline
character (C-j) is replaced by a linefeed (C-m) character.
Many other hiding packages, besides folding, use the same technique, the problem should occur when using them as well.
The erroneous lines in generic-x.el look like the following (this
example is from the ini section):
'(("^\\\\(\\\\[.*\\\\]\\\\)" 1 'font-lock-constant-face)
("^\\\\(.*\\\\)=" 1 'font-lock-variable-name-face)
The intention of these lines is to highlight lines of the following form:
[foo]
bar = xxx
However, since the . regexp symbol matches the linefeed character
the entire folded section is searched, resulting in a regexp stack
overflow.
Solution suggestion: Instead of using ".", use the sequence
"[^\\n\\r]". This will make the rules behave just as before, but
they will work together with selective-display.
Defined variables (10)
generic-default-modes | List of generic modes that are defined by default. |
generic-extras-enable-list | List of generic modes to define. |
generic-find-file-regexp | Regular expression used by ‘generic-mode-find-file-hook’. |
generic-ignore-files-regexp | Regular expression used by ‘generic-mode-find-file-hook’. |
generic-lines-to-scan | Number of lines that ‘generic-mode-find-file-hook’ looks at. |
generic-mswindows-modes | List of generic modes that are defined by default on MS-Windows. |
generic-other-modes | List of generic modes that are not defined by default. |
generic-unix-modes | List of generic modes that are defined by default on Unix. |
generic-use-find-file-hook | If non-nil, add a hook to enter ‘default-generic-mode’ automatically. |
named-database-time-string | Timestring for named serial numbers. |
Defined functions (28)
Defined faces (2)
show-tabs-space | Font Lock mode face used to highlight spaces. |
show-tabs-tab | Font Lock mode face used to highlight TABs. |