diff options
author | Richard M. Stallman <rms@gnu.org> | 2006-04-18 20:57:56 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2006-04-18 20:57:56 +0000 |
commit | d06d657cc711ede2aa2c729db30f5fbabf2ad4ec (patch) | |
tree | 41249ff0e8c9c6446ed9b70a7fee2344e6fc7403 /src/abbrev.c | |
parent | bd99e2429ef404f8894a428994aae78b9316c4b4 (diff) | |
download | emacs-d06d657cc711ede2aa2c729db30f5fbabf2ad4ec.tar.gz |
(Finsert_abbrev_table_description): Sort the abbrevs alphabetically.
(record_symbol): New function.
Diffstat (limited to 'src/abbrev.c')
-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) Fterpri (stream); } +static void +record_symbol (sym, list) + Lisp_Object sym, list; +{ + XSETCDR (list, Fcons (sym, XCDR (list))); +} + DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description, Sinsert_abbrev_table_description, 1, 2, 0, doc: /* Insert before point a full description of abbrev table named NAME. @@ -546,6 +553,7 @@ READABLE is non-nil, they are listed. */) Lisp_Object name, readable; { Lisp_Object table; + Lisp_Object symbols; Lisp_Object stream; CHECK_SYMBOL (name); @@ -554,12 +562,22 @@ READABLE is non-nil, they are listed. */) XSETBUFFER (stream, current_buffer); + symbols = Fcons (Qnil, Qnil); + map_obarray (table, record_symbol, symbols); + symbols = XCDR (symbols); + symbols = Fsort (symbols, Qstring_lessp); + if (!NILP (readable)) { insert_string ("("); Fprin1 (name, stream); insert_string (")\n\n"); - map_obarray (table, describe_abbrev, stream); + while (! NILP (symbols)) + { + describe_abbrev (XCAR (symbols), stream); + symbols = XCDR (symbols); + } + insert_string ("\n\n"); } else @@ -567,7 +585,11 @@ READABLE is non-nil, they are listed. */) insert_string ("(define-abbrev-table '"); Fprin1 (name, stream); insert_string (" '(\n"); - map_obarray (table, write_abbrev, stream); + while (! NILP (symbols)) + { + write_abbrev (XCAR (symbols), stream); + symbols = XCDR (symbols); + } insert_string (" ))\n\n"); } |