help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Setting 'which-key-dont-use-unicode'


From: Philip Kaludercic
Subject: Re: Setting 'which-key-dont-use-unicode'
Date: Mon, 24 Jun 2024 02:58:16 +0000

Justin Burkett <justin@burkett.cc> writes:

> Hi,
>
> First, don't set which-key-mode as a custom variable. This is a
> function that should be called after which-key is loaded.

That is actually fine, since every minor mode is also a user option.

> For your original question, the important thing is that
> which-key-dont-use-unicode is set before which-key is loaded. 

We can easily fix this by adding a custom setter:

diff --git a/lisp/which-key.el b/lisp/which-key.el
index e9567d262c6..33fa67e9bac 100644
--- a/lisp/which-key.el
+++ b/lisp/which-key.el
@@ -128,6 +128,11 @@ which-key-dont-use-unicode
   "If non-nil, don't use any unicode characters in default setup.
 For affected settings, see `which-key-replacement-alist', `which-key-ellipsis'
 `which-key-separator'."
+  :set (lambda (sym val)
+         (prog1 (custom-set-default sym val)
+           (dolist (sym '(which-key-separator
+                          which-key-ellipsis))
+             (custom-set-default sym (custom-reevaluate-setting sym)))))
   :type 'boolean
   :package-version "1.0" :version "30.1")
 
Using Emacs -Q and

(setopt which-key-mode t        ;loads which-key.el
        which-key-dont-use-unicode nil)

I get the expected behaviour.

>                                                               (c)
> definitely won't work for this reason. The fact that (d) is working,
> which takes this logic to the extreme, but the others are not suggests
> that something is causing which-key to load before the variable is
> set.
>
> Combining the two ideas, try
>
> (use-package which-key
>   :custom
>   (which-key-dont-use-unicode nil)
>   :config
>   (which-key-mode t))
>
> If that doesn't work, look for another culprit that might be loading
> which-key (perhaps because it depends on it) earlier.
>
> Justin
>
> On Sun, Jun 23, 2024 at 5:05 PM Kévin Le Gouguec
> <kevin.legouguec@gmail.com> wrote:
>>
>> Hello!
>>
>> Paging help-gnu-emacs before filing a bug because I'm not sure of the
>> intended behavior.  After seeing 2024-06-18 "Disable usage of unicode
>> for which-key by default" (cc0a3a5f65b), I promptly went to my .emacs to
>> opt in to Unicode symbols, and was surprised to meet some resistance.
>>
>> In an Emacs built from 2024-06-23 "; Fix typos" (fb11294d415) on the
>> emacs-30 branch, I tried
>>
>>   (a) this .emacs:
>>
>>     (use-package which-key
>>       :custom
>>       (which-key-dont-use-unicode nil)
>>       (which-key-mode t))
>>
>>   (b) this .emacs:
>>
>>     (custom-set-variables
>>      '(which-key-dont-use-unicode nil)
>>      '(which-key-mode t))
>>
>>   (c) an empty .emacs, then
>>
>>     M-x which-key-mode
>>     M-x toggle-option which-key-dont-use-unicode
>>
>>   (d) a combination of this .emacs:
>>
>>     (use-package which-key
>>       :custom
>>       (which-key-mode t))
>>
>>   with this .emacs.d/early-init.el:
>>
>>     (setq which-key-dont-use-unicode nil)
>>
>> and only attempt (d) yielded which-key messages with '→' instead of ':'
>> for the separator symbol (resp. '…' instead of '..'  for truncation).
>>
>> Wondering if I am doing something wrong (a definite possibility, the
>> perils of juggling ${HOME}s for repro purposes), if (d) really is the
>> intended way to effectively unset which-key-dont-use-unicode, or if this
>> is a potential bug report or feature request?

-- 
        Philip Kaludercic on peregrine

reply via email to

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