diff options
| author | Pavel Janík | 2001-10-15 13:38:04 +0000 |
|---|---|---|
| committer | Pavel Janík | 2001-10-15 13:38:04 +0000 |
| commit | b39fb64b26ba9a81715ca8b57abb4208a22d7e78 (patch) | |
| tree | 6abdbe33b1dbd3be1dba7b3a615d72121e9ab4c2 /src | |
| parent | aa601ad023cf2548ef8e107475ea5ac1d3f8e9ef (diff) | |
| download | emacs-b39fb64b26ba9a81715ca8b57abb4208a22d7e78.tar.gz emacs-b39fb64b26ba9a81715ca8b57abb4208a22d7e78.zip | |
Put doc strings in comments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/abbrev.c | 171 |
1 files changed, 86 insertions, 85 deletions
diff --git a/src/abbrev.c b/src/abbrev.c index 06bb1f98e5e..b36613ddd91 100644 --- a/src/abbrev.c +++ b/src/abbrev.c | |||
| @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #define DOC_STRINGS_IN_COMMENTS | ||
| 25 | #include "lisp.h" | 26 | #include "lisp.h" |
| 26 | #include "commands.h" | 27 | #include "commands.h" |
| 27 | #include "buffer.h" | 28 | #include "buffer.h" |
| @@ -83,15 +84,15 @@ int last_abbrev_point; | |||
| 83 | Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook; | 84 | Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook; |
| 84 | 85 | ||
| 85 | DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0, | 86 | DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0, |
| 86 | "Create a new, empty abbrev table object.") | 87 | /* Create a new, empty abbrev table object. */ |
| 87 | () | 88 | ()) |
| 88 | { | 89 | { |
| 89 | return Fmake_vector (make_number (59), make_number (0)); | 90 | return Fmake_vector (make_number (59), make_number (0)); |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | DEFUN ("clear-abbrev-table", Fclear_abbrev_table, Sclear_abbrev_table, 1, 1, 0, | 93 | DEFUN ("clear-abbrev-table", Fclear_abbrev_table, Sclear_abbrev_table, 1, 1, 0, |
| 93 | "Undefine all abbrevs in abbrev table TABLE, leaving it empty.") | 94 | /* Undefine all abbrevs in abbrev table TABLE, leaving it empty. */ |
| 94 | (table) | 95 | (table)) |
| 95 | Lisp_Object table; | 96 | Lisp_Object table; |
| 96 | { | 97 | { |
| 97 | int i, size; | 98 | int i, size; |
| @@ -105,17 +106,17 @@ DEFUN ("clear-abbrev-table", Fclear_abbrev_table, Sclear_abbrev_table, 1, 1, 0, | |||
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_abbrev, 3, 5, 0, | 108 | DEFUN ("define-abbrev", Fdefine_abbrev, Sdefine_abbrev, 3, 5, 0, |
| 108 | "Define an abbrev in TABLE named NAME, to expand to EXPANSION and call HOOK.\n\ | 109 | /* Define an abbrev in TABLE named NAME, to expand to EXPANSION and call HOOK. |
| 109 | NAME must be a string.\n\ | 110 | NAME must be a string. |
| 110 | EXPANSION should usually be a string.\n\ | 111 | EXPANSION should usually be a string. |
| 111 | To undefine an abbrev, define it with EXPANSION = nil.\n\ | 112 | To undefine an abbrev, define it with EXPANSION = nil. |
| 112 | If HOOK is non-nil, it should be a function of no arguments;\n\ | 113 | If HOOK is non-nil, it should be a function of no arguments; |
| 113 | it is called after EXPANSION is inserted.\n\ | 114 | it is called after EXPANSION is inserted. |
| 114 | If EXPANSION is not a string, the abbrev is a special one,\n\ | 115 | If EXPANSION is not a string, the abbrev is a special one, |
| 115 | which does not expand in the usual way but only runs HOOK.\n\ | 116 | which does not expand in the usual way but only runs HOOK. |
| 116 | COUNT, if specified, initializes the abbrev's usage-count\n\ | 117 | COUNT, if specified, initializes the abbrev's usage-count |
| 117 | which is incremented each time the abbrev is used.") | 118 | which is incremented each time the abbrev is used. */ |
| 118 | (table, name, expansion, hook, count) | 119 | (table, name, expansion, hook, count)) |
| 119 | Lisp_Object table, name, expansion, hook, count; | 120 | Lisp_Object table, name, expansion, hook, count; |
| 120 | { | 121 | { |
| 121 | Lisp_Object sym, oexp, ohook, tem; | 122 | Lisp_Object sym, oexp, ohook, tem; |
| @@ -147,9 +148,9 @@ which is incremented each time the abbrev is used.") | |||
| 147 | } | 148 | } |
| 148 | 149 | ||
| 149 | DEFUN ("define-global-abbrev", Fdefine_global_abbrev, Sdefine_global_abbrev, 2, 2, | 150 | DEFUN ("define-global-abbrev", Fdefine_global_abbrev, Sdefine_global_abbrev, 2, 2, |
| 150 | "sDefine global abbrev: \nsExpansion for %s: ", | 151 | "sDefine global abbrev: \nsExpansion for %s: ", |
| 151 | "Define ABBREV as a global abbreviation for EXPANSION.") | 152 | /* Define ABBREV as a global abbreviation for EXPANSION. */ |
| 152 | (abbrev, expansion) | 153 | (abbrev, expansion)) |
| 153 | Lisp_Object abbrev, expansion; | 154 | Lisp_Object abbrev, expansion; |
| 154 | { | 155 | { |
| 155 | Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (abbrev), | 156 | Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (abbrev), |
| @@ -158,9 +159,9 @@ DEFUN ("define-global-abbrev", Fdefine_global_abbrev, Sdefine_global_abbrev, 2, | |||
| 158 | } | 159 | } |
| 159 | 160 | ||
| 160 | DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, Sdefine_mode_abbrev, 2, 2, | 161 | DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, Sdefine_mode_abbrev, 2, 2, |
| 161 | "sDefine mode abbrev: \nsExpansion for %s: ", | 162 | "sDefine mode abbrev: \nsExpansion for %s: ", |
| 162 | "Define ABBREV as a mode-specific abbreviation for EXPANSION.") | 163 | /* Define ABBREV as a mode-specific abbreviation for EXPANSION. */ |
| 163 | (abbrev, expansion) | 164 | (abbrev, expansion)) |
| 164 | Lisp_Object abbrev, expansion; | 165 | Lisp_Object abbrev, expansion; |
| 165 | { | 166 | { |
| 166 | if (NILP (current_buffer->abbrev_table)) | 167 | if (NILP (current_buffer->abbrev_table)) |
| @@ -172,13 +173,13 @@ DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev, Sdefine_mode_abbrev, 2, 2, | |||
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_symbol, 1, 2, 0, | 175 | DEFUN ("abbrev-symbol", Fabbrev_symbol, Sabbrev_symbol, 1, 2, 0, |
| 175 | "Return the symbol representing abbrev named ABBREV.\n\ | 176 | /* Return the symbol representing abbrev named ABBREV. |
| 176 | This symbol's name is ABBREV, but it is not the canonical symbol of that name;\n\ | 177 | This symbol's name is ABBREV, but it is not the canonical symbol of that name; |
| 177 | it is interned in an abbrev-table rather than the normal obarray.\n\ | 178 | it is interned in an abbrev-table rather than the normal obarray. |
| 178 | The value is nil if that abbrev is not defined.\n\ | 179 | The value is nil if that abbrev is not defined. |
| 179 | Optional second arg TABLE is abbrev table to look it up in.\n\ | 180 | Optional second arg TABLE is abbrev table to look it up in. |
| 180 | The default is to try buffer's mode-specific abbrev table, then global table.") | 181 | The default is to try buffer's mode-specific abbrev table, then global table. */ |
| 181 | (abbrev, table) | 182 | (abbrev, table)) |
| 182 | Lisp_Object abbrev, table; | 183 | Lisp_Object abbrev, table; |
| 183 | { | 184 | { |
| 184 | Lisp_Object sym; | 185 | Lisp_Object sym; |
| @@ -201,10 +202,10 @@ The default is to try buffer's mode-specific abbrev table, then global table.") | |||
| 201 | } | 202 | } |
| 202 | 203 | ||
| 203 | DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabbrev_expansion, 1, 2, 0, | 204 | DEFUN ("abbrev-expansion", Fabbrev_expansion, Sabbrev_expansion, 1, 2, 0, |
| 204 | "Return the string that ABBREV expands into in the current buffer.\n\ | 205 | /* Return the string that ABBREV expands into in the current buffer. |
| 205 | Optionally specify an abbrev table as second arg;\n\ | 206 | Optionally specify an abbrev table as second arg; |
| 206 | then ABBREV is looked up in that table only.") | 207 | then ABBREV is looked up in that table only. */ |
| 207 | (abbrev, table) | 208 | (abbrev, table)) |
| 208 | Lisp_Object abbrev, table; | 209 | Lisp_Object abbrev, table; |
| 209 | { | 210 | { |
| 210 | Lisp_Object sym; | 211 | Lisp_Object sym; |
| @@ -217,10 +218,10 @@ then ABBREV is looked up in that table only.") | |||
| 217 | Returns 1 if an expansion is done. */ | 218 | Returns 1 if an expansion is done. */ |
| 218 | 219 | ||
| 219 | DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_abbrev, 0, 0, "", | 220 | DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_abbrev, 0, 0, "", |
| 220 | "Expand the abbrev before point, if there is an abbrev there.\n\ | 221 | /* Expand the abbrev before point, if there is an abbrev there. |
| 221 | Effective when explicitly called even when `abbrev-mode' is nil.\n\ | 222 | Effective when explicitly called even when `abbrev-mode' is nil. |
| 222 | Returns the abbrev symbol, if expansion took place.") | 223 | Returns the abbrev symbol, if expansion took place. */ |
| 223 | () | 224 | ()) |
| 224 | { | 225 | { |
| 225 | register char *buffer, *p; | 226 | register char *buffer, *p; |
| 226 | int wordstart, wordend; | 227 | int wordstart, wordend; |
| @@ -388,10 +389,10 @@ Returns the abbrev symbol, if expansion took place.") | |||
| 388 | } | 389 | } |
| 389 | 390 | ||
| 390 | DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexpand_abbrev, 0, 0, "", | 391 | DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexpand_abbrev, 0, 0, "", |
| 391 | "Undo the expansion of the last abbrev that expanded.\n\ | 392 | /* Undo the expansion of the last abbrev that expanded. |
| 392 | This differs from ordinary undo in that other editing done since then\n\ | 393 | This differs from ordinary undo in that other editing done since then |
| 393 | is not undone.") | 394 | is not undone. */ |
| 394 | () | 395 | ()) |
| 395 | { | 396 | { |
| 396 | int opoint = PT; | 397 | int opoint = PT; |
| 397 | int adjust = 0; | 398 | int adjust = 0; |
| @@ -466,13 +467,13 @@ describe_abbrev (sym, stream) | |||
| 466 | 467 | ||
| 467 | DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description, | 468 | DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description, |
| 468 | Sinsert_abbrev_table_description, 1, 2, 0, | 469 | Sinsert_abbrev_table_description, 1, 2, 0, |
| 469 | "Insert before point a full description of abbrev table named NAME.\n\ | 470 | /* Insert before point a full description of abbrev table named NAME. |
| 470 | NAME is a symbol whose value is an abbrev table.\n\ | 471 | NAME is a symbol whose value is an abbrev table. |
| 471 | If optional 2nd arg READABLE is non-nil, a human-readable description\n\ | 472 | If optional 2nd arg READABLE is non-nil, a human-readable description |
| 472 | is inserted. Otherwise the description is an expression,\n\ | 473 | is inserted. Otherwise the description is an expression, |
| 473 | a call to `define-abbrev-table', which would\n\ | 474 | a call to `define-abbrev-table', which would |
| 474 | define the abbrev table NAME exactly as it is currently defined.") | 475 | define the abbrev table NAME exactly as it is currently defined. */ |
| 475 | (name, readable) | 476 | (name, readable)) |
| 476 | Lisp_Object name, readable; | 477 | Lisp_Object name, readable; |
| 477 | { | 478 | { |
| 478 | Lisp_Object table; | 479 | Lisp_Object table; |
| @@ -506,10 +507,10 @@ define the abbrev table NAME exactly as it is currently defined.") | |||
| 506 | 507 | ||
| 507 | DEFUN ("define-abbrev-table", Fdefine_abbrev_table, Sdefine_abbrev_table, | 508 | DEFUN ("define-abbrev-table", Fdefine_abbrev_table, Sdefine_abbrev_table, |
| 508 | 2, 2, 0, | 509 | 2, 2, 0, |
| 509 | "Define TABLENAME (a symbol) as an abbrev table name.\n\ | 510 | /* Define TABLENAME (a symbol) as an abbrev table name. |
| 510 | Define abbrevs in it according to DEFINITIONS, which is a list of elements\n\ | 511 | Define abbrevs in it according to DEFINITIONS, which is a list of elements |
| 511 | of the form (ABBREVNAME EXPANSION HOOK USECOUNT).") | 512 | of the form (ABBREVNAME EXPANSION HOOK USECOUNT). */ |
| 512 | (tablename, definitions) | 513 | (tablename, definitions)) |
| 513 | Lisp_Object tablename, definitions; | 514 | Lisp_Object tablename, definitions; |
| 514 | { | 515 | { |
| 515 | Lisp_Object name, exp, hook, count; | 516 | Lisp_Object name, exp, hook, count; |
| @@ -540,66 +541,66 @@ of the form (ABBREVNAME EXPANSION HOOK USECOUNT).") | |||
| 540 | void | 541 | void |
| 541 | syms_of_abbrev () | 542 | syms_of_abbrev () |
| 542 | { | 543 | { |
| 543 | DEFVAR_LISP ("abbrev-table-name-list", &Vabbrev_table_name_list, | 544 | DEFVAR_LISP ("abbrev-table-name-list", &Vabbrev_table_name_list |
| 544 | "List of symbols whose values are abbrev tables."); | 545 | /* List of symbols whose values are abbrev tables. */); |
| 545 | Vabbrev_table_name_list = Fcons (intern ("fundamental-mode-abbrev-table"), | 546 | Vabbrev_table_name_list = Fcons (intern ("fundamental-mode-abbrev-table"), |
| 546 | Fcons (intern ("global-abbrev-table"), | 547 | Fcons (intern ("global-abbrev-table"), |
| 547 | Qnil)); | 548 | Qnil)); |
| 548 | 549 | ||
| 549 | DEFVAR_LISP ("global-abbrev-table", &Vglobal_abbrev_table, | 550 | DEFVAR_LISP ("global-abbrev-table", &Vglobal_abbrev_table |
| 550 | "The abbrev table whose abbrevs affect all buffers.\n\ | 551 | /* The abbrev table whose abbrevs affect all buffers. |
| 551 | Each buffer may also have a local abbrev table.\n\ | 552 | Each buffer may also have a local abbrev table. |
| 552 | If it does, the local table overrides the global one\n\ | 553 | If it does, the local table overrides the global one |
| 553 | for any particular abbrev defined in both."); | 554 | for any particular abbrev defined in both. */); |
| 554 | Vglobal_abbrev_table = Fmake_abbrev_table (); | 555 | Vglobal_abbrev_table = Fmake_abbrev_table (); |
| 555 | 556 | ||
| 556 | DEFVAR_LISP ("fundamental-mode-abbrev-table", &Vfundamental_mode_abbrev_table, | 557 | DEFVAR_LISP ("fundamental-mode-abbrev-table", &Vfundamental_mode_abbrev_table |
| 557 | "The abbrev table of mode-specific abbrevs for Fundamental Mode."); | 558 | /* The abbrev table of mode-specific abbrevs for Fundamental Mode. */); |
| 558 | Vfundamental_mode_abbrev_table = Fmake_abbrev_table (); | 559 | Vfundamental_mode_abbrev_table = Fmake_abbrev_table (); |
| 559 | current_buffer->abbrev_table = Vfundamental_mode_abbrev_table; | 560 | current_buffer->abbrev_table = Vfundamental_mode_abbrev_table; |
| 560 | buffer_defaults.abbrev_table = Vfundamental_mode_abbrev_table; | 561 | buffer_defaults.abbrev_table = Vfundamental_mode_abbrev_table; |
| 561 | 562 | ||
| 562 | DEFVAR_LISP ("last-abbrev", &Vlast_abbrev, | 563 | DEFVAR_LISP ("last-abbrev", &Vlast_abbrev |
| 563 | "The abbrev-symbol of the last abbrev expanded. See `abbrev-symbol'."); | 564 | /* The abbrev-symbol of the last abbrev expanded. See `abbrev-symbol'. */); |
| 564 | 565 | ||
| 565 | DEFVAR_LISP ("last-abbrev-text", &Vlast_abbrev_text, | 566 | DEFVAR_LISP ("last-abbrev-text", &Vlast_abbrev_text |
| 566 | "The exact text of the last abbrev expanded.\n\ | 567 | /* The exact text of the last abbrev expanded. |
| 567 | nil if the abbrev has already been unexpanded."); | 568 | nil if the abbrev has already been unexpanded. */); |
| 568 | 569 | ||
| 569 | DEFVAR_INT ("last-abbrev-location", &last_abbrev_point, | 570 | DEFVAR_INT ("last-abbrev-location", &last_abbrev_point |
| 570 | "The location of the start of the last abbrev expanded."); | 571 | /* The location of the start of the last abbrev expanded. */); |
| 571 | 572 | ||
| 572 | Vlast_abbrev = Qnil; | 573 | Vlast_abbrev = Qnil; |
| 573 | Vlast_abbrev_text = Qnil; | 574 | Vlast_abbrev_text = Qnil; |
| 574 | last_abbrev_point = 0; | 575 | last_abbrev_point = 0; |
| 575 | 576 | ||
| 576 | DEFVAR_LISP ("abbrev-start-location", &Vabbrev_start_location, | 577 | DEFVAR_LISP ("abbrev-start-location", &Vabbrev_start_location |
| 577 | "Buffer position for `expand-abbrev' to use as the start of the abbrev.\n\ | 578 | /* Buffer position for `expand-abbrev' to use as the start of the abbrev. |
| 578 | nil means use the word before point as the abbrev.\n\ | 579 | nil means use the word before point as the abbrev. |
| 579 | Calling `expand-abbrev' sets this to nil."); | 580 | Calling `expand-abbrev' sets this to nil. */); |
| 580 | Vabbrev_start_location = Qnil; | 581 | Vabbrev_start_location = Qnil; |
| 581 | 582 | ||
| 582 | DEFVAR_LISP ("abbrev-start-location-buffer", &Vabbrev_start_location_buffer, | 583 | DEFVAR_LISP ("abbrev-start-location-buffer", &Vabbrev_start_location_buffer |
| 583 | "Buffer that `abbrev-start-location' has been set for.\n\ | 584 | /* Buffer that `abbrev-start-location' has been set for. |
| 584 | Trying to expand an abbrev in any other buffer clears `abbrev-start-location'."); | 585 | Trying to expand an abbrev in any other buffer clears `abbrev-start-location'. */); |
| 585 | Vabbrev_start_location_buffer = Qnil; | 586 | Vabbrev_start_location_buffer = Qnil; |
| 586 | 587 | ||
| 587 | DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, | 588 | DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil |
| 588 | "Local (mode-specific) abbrev table of current buffer."); | 589 | /* Local (mode-specific) abbrev table of current buffer. */); |
| 589 | 590 | ||
| 590 | DEFVAR_BOOL ("abbrevs-changed", &abbrevs_changed, | 591 | DEFVAR_BOOL ("abbrevs-changed", &abbrevs_changed |
| 591 | "Set non-nil by defining or altering any word abbrevs.\n\ | 592 | /* Set non-nil by defining or altering any word abbrevs. |
| 592 | This causes `save-some-buffers' to offer to save the abbrevs."); | 593 | This causes `save-some-buffers' to offer to save the abbrevs. */); |
| 593 | abbrevs_changed = 0; | 594 | abbrevs_changed = 0; |
| 594 | 595 | ||
| 595 | DEFVAR_BOOL ("abbrev-all-caps", &abbrev_all_caps, | 596 | DEFVAR_BOOL ("abbrev-all-caps", &abbrev_all_caps |
| 596 | "*Set non-nil means expand multi-word abbrevs all caps if abbrev was so."); | 597 | /* *Set non-nil means expand multi-word abbrevs all caps if abbrev was so. */); |
| 597 | abbrev_all_caps = 0; | 598 | abbrev_all_caps = 0; |
| 598 | 599 | ||
| 599 | DEFVAR_LISP ("pre-abbrev-expand-hook", &Vpre_abbrev_expand_hook, | 600 | DEFVAR_LISP ("pre-abbrev-expand-hook", &Vpre_abbrev_expand_hook |
| 600 | "Function or functions to be called before abbrev expansion is done.\n\ | 601 | /* Function or functions to be called before abbrev expansion is done. |
| 601 | This is the first thing that `expand-abbrev' does, and so this may change\n\ | 602 | This is the first thing that `expand-abbrev' does, and so this may change |
| 602 | the current abbrev table before abbrev lookup happens."); | 603 | the current abbrev table before abbrev lookup happens. */); |
| 603 | Vpre_abbrev_expand_hook = Qnil; | 604 | Vpre_abbrev_expand_hook = Qnil; |
| 604 | Qpre_abbrev_expand_hook = intern ("pre-abbrev-expand-hook"); | 605 | Qpre_abbrev_expand_hook = intern ("pre-abbrev-expand-hook"); |
| 605 | staticpro (&Qpre_abbrev_expand_hook); | 606 | staticpro (&Qpre_abbrev_expand_hook); |