diff options
| author | Dave Love | 2002-05-25 23:19:01 +0000 |
|---|---|---|
| committer | Dave Love | 2002-05-25 23:19:01 +0000 |
| commit | 8ddf5e57232fd76add711300e4bc0a4ff0dfb704 (patch) | |
| tree | c7e59e6b7e5445a25307b58f9ee4bc224b2aa363 | |
| parent | d2e832963a88e0c8c801e1aa87b16cd1b87a58e0 (diff) | |
| download | emacs-8ddf5e57232fd76add711300e4bc0a4ff0dfb704.tar.gz emacs-8ddf5e57232fd76add711300e4bc0a4ff0dfb704.zip | |
(Fcharset_priority_list, Fset_charset_priority): New
functions.
| -rw-r--r-- | src/charset.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/src/charset.c b/src/charset.c index 428723bdc78..23bf78e33d3 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -940,7 +940,6 @@ usage: (define-charset-internal ...) */) | |||
| 940 | return Qnil; | 940 | return Qnil; |
| 941 | } | 941 | } |
| 942 | 942 | ||
| 943 | /* Fixme: Should this record the alias relationships for diagnostics? */ | ||
| 944 | DEFUN ("define-charset-alias", Fdefine_charset_alias, | 943 | DEFUN ("define-charset-alias", Fdefine_charset_alias, |
| 945 | Sdefine_charset_alias, 2, 2, 0, | 944 | Sdefine_charset_alias, 2, 2, 0, |
| 946 | doc: /* Define ALIAS as an alias for charset CHARSET. */) | 945 | doc: /* Define ALIAS as an alias for charset CHARSET. */) |
| @@ -951,7 +950,6 @@ DEFUN ("define-charset-alias", Fdefine_charset_alias, | |||
| 951 | 950 | ||
| 952 | CHECK_CHARSET_GET_ATTR (charset, attr); | 951 | CHECK_CHARSET_GET_ATTR (charset, attr); |
| 953 | Fputhash (alias, attr, Vcharset_hash_table); | 952 | Fputhash (alias, attr, Vcharset_hash_table); |
| 954 | /* Fixme: should the ordered list be updated too? */ | ||
| 955 | Vcharset_list = Fcons (alias, Vcharset_list); | 953 | Vcharset_list = Fcons (alias, Vcharset_list); |
| 956 | return Qnil; | 954 | return Qnil; |
| 957 | } | 955 | } |
| @@ -1708,6 +1706,49 @@ Clear encoder and decoder of charsets that are loaded from mapfiles. */) | |||
| 1708 | return Qnil; | 1706 | return Qnil; |
| 1709 | } | 1707 | } |
| 1710 | 1708 | ||
| 1709 | DEFUN ("charset-priority-list", Fcharset_priority_list, | ||
| 1710 | Scharset_priority_list, 0, 1, 0, | ||
| 1711 | doc: /* Return the list of charsets ordered by priority. | ||
| 1712 | HIGHESTP non-nil means just return the highest priority one. */) | ||
| 1713 | (highestp) | ||
| 1714 | Lisp_Object highestp; | ||
| 1715 | { | ||
| 1716 | Lisp_Object val = Qnil, list = Vcharset_ordered_list; | ||
| 1717 | |||
| 1718 | if (!NILP (highestp)) | ||
| 1719 | return CHARSET_NAME (CHARSET_FROM_ID (Fcar (list))); | ||
| 1720 | |||
| 1721 | while (!NILP (list)) | ||
| 1722 | { | ||
| 1723 | val = Fcons (CHARSET_NAME (CHARSET_FROM_ID (XCAR (list))), val); | ||
| 1724 | list = XCDR (list); | ||
| 1725 | } | ||
| 1726 | return Fnreverse (val); | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority, | ||
| 1730 | 1, MANY, 0, | ||
| 1731 | doc: /* Assign higher priority to the charsets given as arguments. | ||
| 1732 | usage: (set-charset-priority &rest charsets) */) | ||
| 1733 | (nargs, args) | ||
| 1734 | int nargs; | ||
| 1735 | Lisp_Object *args; | ||
| 1736 | { | ||
| 1737 | Lisp_Object new_head = Qnil, old_list, id, arglist[2]; | ||
| 1738 | int i; | ||
| 1739 | |||
| 1740 | old_list = Fcopy_sequence (Vcharset_ordered_list); | ||
| 1741 | for (i = 0; i < nargs; i++) | ||
| 1742 | { | ||
| 1743 | CHECK_CHARSET_GET_ID (args[i], id); | ||
| 1744 | old_list = Fdelq (id, old_list); | ||
| 1745 | new_head = Fcons (id, new_head); | ||
| 1746 | } | ||
| 1747 | arglist[0] = Fnreverse (new_head); | ||
| 1748 | arglist[1] = old_list; | ||
| 1749 | Vcharset_ordered_list = Fnconc (2, arglist); | ||
| 1750 | return Qnil; | ||
| 1751 | } | ||
| 1711 | 1752 | ||
| 1712 | void | 1753 | void |
| 1713 | init_charset () | 1754 | init_charset () |
| @@ -1807,6 +1848,8 @@ syms_of_charset () | |||
| 1807 | defsubr (&Scharset_after); | 1848 | defsubr (&Scharset_after); |
| 1808 | defsubr (&Siso_charset); | 1849 | defsubr (&Siso_charset); |
| 1809 | defsubr (&Sclear_charset_maps); | 1850 | defsubr (&Sclear_charset_maps); |
| 1851 | defsubr (&Scharset_priority_list); | ||
| 1852 | defsubr (&Sset_charset_priority); | ||
| 1810 | 1853 | ||
| 1811 | DEFVAR_LISP ("charset-map-directory", &Vcharset_map_directory, | 1854 | DEFVAR_LISP ("charset-map-directory", &Vcharset_map_directory, |
| 1812 | doc: /* Directory of charset map files that come with GNU Emacs. | 1855 | doc: /* Directory of charset map files that come with GNU Emacs. |