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-modesList of generic modes that are defined by default.
generic-extras-enable-listList of generic modes to define.
generic-find-file-regexpRegular expression used by ‘generic-mode-find-file-hook’.
generic-ignore-files-regexpRegular expression used by ‘generic-mode-find-file-hook’.
generic-lines-to-scanNumber of lines that ‘generic-mode-find-file-hook’ looks at.
generic-mswindows-modesList of generic modes that are defined by default on MS-Windows.
generic-other-modesList of generic modes that are not defined by default.
generic-unix-modesList of generic modes that are defined by default on Unix.
generic-use-find-file-hookIf non-nil, add a hook to enter ‘default-generic-mode’ automatically.
named-database-time-stringTimestring for named serial numbers.

Defined functions (28)

alias-generic-mode()
ansible-inventory-generic-mode()
apache-conf-generic-mode()
apache-log-generic-mode()
default-generic-mode()
etc-fstab-generic-mode()
etc-modules-conf-generic-mode()
etc-passwd-generic-mode()
etc-services-generic-mode()
etc-sudoers-generic-mode()
fvwm-generic-mode()
generic-mode-find-file-hook()
hosts-generic-mode()
inetd-conf-generic-mode()
java-manifest-generic-mode()
java-properties-generic-mode()
mailagent-rules-generic-mode()
mailrc-generic-mode()
named-boot-generic-mode()
named-database-generic-mode()
named-database-print-serial()
prototype-generic-mode()
resolve-conf-generic-mode()
samba-generic-mode()
show-tabs-generic-mode()
vrml-generic-mode()
x-resource-generic-mode()
xmodmap-generic-mode()

Defined faces (2)

show-tabs-spaceFont Lock mode face used to highlight spaces.
show-tabs-tabFont Lock mode face used to highlight TABs.