emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoload for define-ccl-program


From: Werner LEMBERG
Subject: Re: autoload for define-ccl-program
Date: Mon, 26 Nov 2001 08:31:12 +0100 (CET)

>  WL> Maybe I'm on the wrong track, so I will describe how to use it.
> 
> I think so.  Isn't autoloading coding systems what you really want?

No.  I want to autoload a CCL function :-)

>  WL> As you can see, the two ccl functions should be automatically
>  WL> loaded if euc-tw is accessed.
> 
> If you have coding system autoloads and put the CCL in a file with the
> coding system definition, you'll get that.  (I guess the real issue is
> large tables being used, rather than the CCL itself, is it?)

No large tables.  It is really to avoid cluttering the file china.el
with stuff belonging to china-util.el -- I could simply add the two
CCL functions to china.el, and everything is OK, but this is ugly.
For orthogonality, the call to make-coding-system should be in
china.el IMHO.

>  WL> While `set-language-info-alist' offers a
>  WL> `features' key which loads a file with auxiliary routines,
>  WL> `make-coding-system' lacks this possibility.  Maybe it is better to
>  WL> have this `features' key for `make-coding-system' also?
> 
> I don't think it could work the same.

Why not?  I think this would be easier than extending the autoload
mechanism; the former could be a lisp-only solution; the latter
requires source code changes also.

> However, you can kludge a hook on first use of a coding system for
> encoding or decoding with pre-write and post-read functions. e.g.:
> 
> (defun utf-8-pre-write-conversion (beg end)
>   "Semi-dummy pre-write function effectively to autoload ucs-tables."
>   ;; Ensure translation table is loaded.
>   (require 'ucs-tables)
>   ;; Don't do this again.
>   (coding-system-put 'mule-utf-8 'pre-write-conversion nil)
>   nil)

I think this won't work.  If I read the lisp code correctly,
make-coding-system checks the CCL functions for encoding and decoding
before reading the properties.  Hmmm, maybe it is better to add
a `FEATURES' parameter after EOL-TYPE.  This would be less than 10
lines of code.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]