unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Justin Burkett <justin@burkett.cc>
Cc: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>, help-gnu-emacs@gnu.org
Subject: Re: Setting 'which-key-dont-use-unicode'
Date: Mon, 24 Jun 2024 02:58:16 +0000	[thread overview]
Message-ID: <87sex3caif.fsf@posteo.net> (raw)
In-Reply-To: <CAF8XuLh_ima5DjsaRAPVUow7Ezo3pYzqPwkJ1Dnhxs+HRwBt6A@mail.gmail.com> (Justin Burkett's message of "Sun, 23 Jun 2024 21:44:44 -0400")

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

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:


[-- Attachment #2: Type: text/plain, Size: 661 bytes --]

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")
 

[-- Attachment #3: Type: text/plain, Size: 2368 bytes --]


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	other threads:[~2024-06-24  2:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 21:05 Setting 'which-key-dont-use-unicode' Kévin Le Gouguec
2024-06-24  1:44 ` Justin Burkett
2024-06-24  2:58   ` Philip Kaludercic [this message]
2024-06-24  6:06     ` Kévin Le Gouguec
2024-06-24  7:12       ` Philip Kaludercic
2024-06-24 13:02         ` Robert Pluim
2024-06-25  5:52           ` Kévin Le Gouguec
2024-06-26 13:38             ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sex3caif.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=justin@burkett.cc \
    --cc=kevin.legouguec@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).