[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

36.3 Définir des abréviations

define-abbrev est la fonction de base de bas niveau pour définir les abréviations dans une table d'abréviations indiquée. Si les modes majeurs prédéfinissent la norme des abréviations, ils devraient appeler define-abbrev et indiquer t pour system-flag. Faites attention, les abréviations non sauvés du non-“système” sont restaurées au démarrage, c.-à-d. avant que les modes majeurs sont chargés. C'est pourquoi les modes majeurs ne devraient pas assumer que, quand ils sont d'abord chargés, leurs tables d'abbréviations soient vides.

Function: define-abbrev table name expansion &optional hook count system-flag

Cette fonction définit une abréviation appelée name, dans table, à développer expansion et appeler hook. La valeur de retour est name.

La valeur count, si indiquée, initialise les abréviations usage-compter. Si count n'est pas indiqué ou est nil, l'usage du compteur est initialisée à zéro.

The argument name should be a string. The argument expansion is normally the desired expansion (a string), or nil to undefine the abbrev. If it is anything but a string or nil, then the abbreviation “expands” solely by running hook.

The argument hook is a function or nil. If hook is non-nil, then it is called with no arguments after the abbrev is replaced with expansion; point is located at the end of expansion when hook is called.

If hook is a non-nil symbol whose no-self-insert property is non-nil, hook can explicitly control whether to insert the self-inserting input character that triggered the expansion. If hook returns non-nil in this case, that inhibits insertion of the character. By contrast, if hook returns nil, expand-abbrev also returns nil, as if expansion had not really occurred.

If system-flag is non-nil, that marks the abbrev as a “system” abbrev with the system-type property. Unless system-flag has the value force, a “system” abbrev will not overwrite an existing definition for a non-“system” abbrev of the same name.

Normally the function define-abbrev sets the variable abbrevs-changed to t, if it actually changes the abbrev. (This is so that some commands will offer to save the abbrevs.) It does not do this for a “system” abbrev, since those won't be saved anyway.

User Option: only-global-abbrevs

If this variable is non-nil, it means that the user plans to use global abbrevs only. This tells the commands that define mode-specific abbrevs to define global ones instead. This variable does not alter the behavior of the functions in this section; it is examined by their callers.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.