Subject: Re: bug#35689: Customizable char-fold

From: Juri Linkov <[email-masked]>
Date: Mon, 24 Jun 2019 23:40:17 +0300

>> +(defcustom char-fold-symmetric char-fold--symmetric-default
>> +  "Include symmetric mappings from composite character back to base letter."
>> +  :type 'boolean
>> +  :initialize #'custom-initialize-changed
>> +  :set (lambda (sym val)
>> +         (set-default sym val)
>> +         ;; FIXME: Maybe delay this until after-init-hook,
>> +         ;; to avoid redundant calls to char-fold-make-table.
>> +         (setq char-fold-table (char-fold-make-table)))
>
> OK, here's an uninformed suggestion -- instead of doing all this to
> ensure that we have an updated char-fold-table when the user changes
> these defaults, why not call char-fold-make-table when needed?
>
> That is, instead of the char-fold-table variable, you'd have a
> char-fold-data, which could be, say, something like this:
>
> (defvar char-fold-data :uninitialized)
>
> `char-fold-to-regexp' (and others) would then start with a call to
> char-fold-update which would
>
> be
>
> (let ((new (list :additional char-fold--include-alist-default
>                  :exclude char-fold--exclude-alist-default
>                  ...)))
>   (unless (equal char-fold-data new)
>     (setq char-fold-table (char-fold-make-table)
>           char-fold-data new)))
>
> or something along those lines.  That is, check whether anything has
> changed, and if not, do nothing, but if it has, recompute?

Thanks for the idea, I'll try to use such composite value to detect
updates in one of three variables.