diff options
| author | Richard M. Stallman | 2006-04-18 20:57:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-04-18 20:57:56 +0000 |
| commit | d06d657cc711ede2aa2c729db30f5fbabf2ad4ec (patch) | |
| tree | 41249ff0e8c9c6446ed9b70a7fee2344e6fc7403 | |
| parent | bd99e2429ef404f8894a428994aae78b9316c4b4 (diff) | |
| download | emacs-d06d657cc711ede2aa2c729db30f5fbabf2ad4ec.tar.gz emacs-d06d657cc711ede2aa2c729db30f5fbabf2ad4ec.zip | |
(Finsert_abbrev_table_description): Sort the abbrevs alphabetically.
(record_symbol): New function.
| -rw-r--r-- | src/abbrev.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/abbrev.c b/src/abbrev.c index e7dcec3a43a..e371797f139 100644 --- a/src/abbrev.c +++ b/src/abbrev.c | |||
| @@ -531,6 +531,13 @@ describe_abbrev (sym, stream) | |||
| 531 | Fterpri (stream); | 531 | Fterpri (stream); |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static void | ||
| 535 | record_symbol (sym, list) | ||
| 536 | Lisp_Object sym, list; | ||
| 537 | { | ||
| 538 | XSETCDR (list, Fcons (sym, XCDR (list))); | ||
| 539 | } | ||
| 540 | |||
| 534 | DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description, | 541 | DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description, |
| 535 | Sinsert_abbrev_table_description, 1, 2, 0, | 542 | Sinsert_abbrev_table_description, 1, 2, 0, |
| 536 | doc: /* Insert before point a full description of abbrev table named NAME. | 543 | doc: /* Insert before point a full description of abbrev table named NAME. |
| @@ -546,6 +553,7 @@ READABLE is non-nil, they are listed. */) | |||
| 546 | Lisp_Object name, readable; | 553 | Lisp_Object name, readable; |
| 547 | { | 554 | { |
| 548 | Lisp_Object table; | 555 | Lisp_Object table; |
| 556 | Lisp_Object symbols; | ||
| 549 | Lisp_Object stream; | 557 | Lisp_Object stream; |
| 550 | 558 | ||
| 551 | CHECK_SYMBOL (name); | 559 | CHECK_SYMBOL (name); |
| @@ -554,12 +562,22 @@ READABLE is non-nil, they are listed. */) | |||
| 554 | 562 | ||
| 555 | XSETBUFFER (stream, current_buffer); | 563 | XSETBUFFER (stream, current_buffer); |
| 556 | 564 | ||
| 565 | symbols = Fcons (Qnil, Qnil); | ||
| 566 | map_obarray (table, record_symbol, symbols); | ||
| 567 | symbols = XCDR (symbols); | ||
| 568 | symbols = Fsort (symbols, Qstring_lessp); | ||
| 569 | |||
| 557 | if (!NILP (readable)) | 570 | if (!NILP (readable)) |
| 558 | { | 571 | { |
| 559 | insert_string ("("); | 572 | insert_string ("("); |
| 560 | Fprin1 (name, stream); | 573 | Fprin1 (name, stream); |
| 561 | insert_string (")\n\n"); | 574 | insert_string (")\n\n"); |
| 562 | map_obarray (table, describe_abbrev, stream); | 575 | while (! NILP (symbols)) |
| 576 | { | ||
| 577 | describe_abbrev (XCAR (symbols), stream); | ||
| 578 | symbols = XCDR (symbols); | ||
| 579 | } | ||
| 580 | |||
| 563 | insert_string ("\n\n"); | 581 | insert_string ("\n\n"); |
| 564 | } | 582 | } |
| 565 | else | 583 | else |
| @@ -567,7 +585,11 @@ READABLE is non-nil, they are listed. */) | |||
| 567 | insert_string ("(define-abbrev-table '"); | 585 | insert_string ("(define-abbrev-table '"); |
| 568 | Fprin1 (name, stream); | 586 | Fprin1 (name, stream); |
| 569 | insert_string (" '(\n"); | 587 | insert_string (" '(\n"); |
| 570 | map_obarray (table, write_abbrev, stream); | 588 | while (! NILP (symbols)) |
| 589 | { | ||
| 590 | write_abbrev (XCAR (symbols), stream); | ||
| 591 | symbols = XCDR (symbols); | ||
| 592 | } | ||
| 571 | insert_string (" ))\n\n"); | 593 | insert_string (" ))\n\n"); |
| 572 | } | 594 | } |
| 573 | 595 | ||