GNU bug report logs - #35689
Customizable char-fold

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sat, 11 May 2019 21:32:01 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 35689 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> gmail.com
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 35689 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#35689: Customizable char-fold
Date: Thu, 16 May 2019 10:47:47 -0400
Juri Linkov <juri <at> linkov.net> writes:

>> We don't gave defcustoms inside eval-and/when-compile anywhere else.
>> Do we really need this?  For starters, it would defeat cus-dep.el, I think.
>
> Indeed, better to try and simplify this.  The goal is to pre-compile
> the default char-table because its calculation is compute-intensive,
> and to recalculate a new value of char-table only in case
> when customized values differ from the default values.
>
> I can't find a standard way of doing this.  So instead of using eval-and-compile
> I'll try to recalculate the value explicitly when variables are customized:
>
>   (when (or (get 'char-fold-include-base  'customized-value)
>             (get 'char-fold-include-alist 'customized-value)
>             (get 'char-fold-exclude-alist 'customized-value))
>     (setq char-fold-table (char-fold-make-table)))

Instead of looking at symbol property values, which can make for a
confusing time when setting variables outside of customize, I think it
would be nicer to do something like this:

    (eval-and-compile (defconst char-fold--include-base-default ...))

    (defcustom char-fold-include-base char-fold--include-base-default
      :initialize #'custom-initialize-changed
      :set (lambda (sym val)
             (set-default sym val)
             ;; FIXME: Maybe delay this until after-init-time,
             ;; to avoid redundant calls to char-fold-make-table.
             (setq char-fold-table (char-fold-make-table)))
      ...)

    (eval-and-compile
      (defun char-fold-make-table ()
         ...
         (or (bound-and-true-p 'char-fold-include-base)
             char-fold--include-base-default)
         ...))






This bug report was last modified 5 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.