diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/defining-abbrevs.html | |
new repository
Diffstat (limited to 'devdocs/elisp/defining-abbrevs.html')
| -rw-r--r-- | devdocs/elisp/defining-abbrevs.html | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/defining-abbrevs.html b/devdocs/elisp/defining-abbrevs.html new file mode 100644 index 00000000..f93810e8 --- /dev/null +++ b/devdocs/elisp/defining-abbrevs.html @@ -0,0 +1,12 @@ + <h3 class="section">Defining Abbrevs</h3> <p><code>define-abbrev</code> is the low-level basic function for defining an abbrev in an abbrev table. </p> <p>When a major mode defines a system abbrev, it should call <code>define-abbrev</code> and specify <code>t</code> for the <code>:system</code> property. Be aware that any saved non-system abbrevs are restored at startup, i.e., before some major modes are loaded. Therefore, major modes should not assume that their abbrev tables are empty when they are first loaded. </p> <dl> <dt id="define-abbrev">Function: <strong>define-abbrev</strong> <em>abbrev-table name expansion &optional hook &rest props</em> +</dt> <dd> +<p>This function defines an abbrev named <var>name</var>, in <var>abbrev-table</var>, to expand to <var>expansion</var> and call <var>hook</var>, with properties <var>props</var> (see <a href="abbrev-properties">Abbrev Properties</a>). The return value is <var>name</var>. The <code>:system</code> property in <var>props</var> is treated specially here: if it has the value <code>force</code>, then it will overwrite an existing definition even for a non-system abbrev of the same name. </p> <p><var>name</var> should be a string. The argument <var>expansion</var> is normally the desired expansion (a string), or <code>nil</code> to undefine the abbrev. If it is anything but a string or <code>nil</code>, then the abbreviation expands solely by running <var>hook</var>. </p> <p>The argument <var>hook</var> is a function or <code>nil</code>. If <var>hook</var> is non-<code>nil</code>, then it is called with no arguments after the abbrev is replaced with <var>expansion</var>; point is located at the end of <var>expansion</var> when <var>hook</var> is called. </p> <p>If <var>hook</var> is a non-<code>nil</code> symbol whose <code>no-self-insert</code> property is non-<code>nil</code>, <var>hook</var> can explicitly control whether to insert the self-inserting input character that triggered the expansion. If <var>hook</var> returns non-<code>nil</code> in this case, that inhibits insertion of the character. By contrast, if <var>hook</var> returns <code>nil</code>, <code>expand-abbrev</code> (or <code>abbrev-insert</code>) also returns <code>nil</code>, as if expansion had not really occurred. </p> <p>Normally, <code>define-abbrev</code> sets the variable <code>abbrevs-changed</code> to <code>t</code>, 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 aren’t saved anyway. </p> +</dd> +</dl> <dl> <dt id="only-global-abbrevs">User Option: <strong>only-global-abbrevs</strong> +</dt> <dd><p>If this variable is non-<code>nil</code>, 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. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Abbrevs.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Abbrevs.html</a> + </p> +</div> |
