GNU bug report logs - #65145
‘enable-theme’ completion for themes loaded by ‘require-theme’

Previous Next

Package: emacs;

Reported by: Shynur Xie <one.last.kiss <at> outlook.com>

Date: Tue, 8 Aug 2023 10:37:01 UTC

Severity: normal

Tags: notabug

Done: Mauro Aranda <maurooaranda <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65145 in the body.
You can then email your comments to 65145 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Tue, 08 Aug 2023 10:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shynur Xie <one.last.kiss <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 08 Aug 2023 10:37:02 GMT) Full text and rfc822 format available.

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

From: Shynur Xie <one.last.kiss <at> outlook.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Tue, 8 Aug 2023 10:31:01 +0000
Hi, friends.  I find that if we use

    (require-theme 'X-theme)

to load ‘X-theme’, minibuffer doesn’t provide the completion for
‘X-theme’ when calling ‘enable-theme’ interactively.  But the
following code

    (require-theme 'X-theme)
    (enable-theme 'X)

works fine.

Is it an intended behavior that ‘enable-theme’ doesn’t provide
completion for those themes loaded by ‘require-theme’?
If so, please ignore this report and excuse my intrusion.  If not, can
we fix it?

Thanks!

--
shynur



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Tue, 08 Aug 2023 23:10:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Shynur Xie <one.last.kiss <at> outlook.com>
Cc: 65145 <at> debbugs.gnu.org
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Tue, 8 Aug 2023 20:09:29 -0300
Shynur Xie <one.last.kiss <at> outlook.com> writes:

> Hi, friends.  I find that if we use
>
>     (require-theme 'X-theme)
>
> to load ‘X-theme’, minibuffer doesn’t provide the completion for
> ‘X-theme’ when calling ‘enable-theme’ interactively.  But the
> following code
>
>     (require-theme 'X-theme)
>     (enable-theme 'X)
>
> works fine.

I can't reproduce it.  I did:
emacs -Q
(require-theme 'leuven-theme)
M-x enable-theme
TAB

And "leuven" was inserted at the minibuffer.

I tried on Emacs 28, Emacs 29 and master.

> Is it an intended behavior that ‘enable-theme’ doesn’t provide
> completion for those themes loaded by ‘require-theme’?
> If so, please ignore this report and excuse my intrusion. If not, can
> we fix it?

It should offer the completion, and at least it does for me. What were
the steps that you followed? And on which Emacs version?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Wed, 09 Aug 2023 07:24:02 GMT) Full text and rfc822 format available.

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

From: Shynur Xie <one.last.kiss <at> outlook.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: "65145 <at> debbugs.gnu.org" <65145 <at> debbugs.gnu.org>
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Wed, 9 Aug 2023 07:23:18 +0000
> I can't reproduce it.  I did:
> emacs -Q
> (require-theme 'leuven-theme)
> M-x enable-theme

Oh Oh, sorry, Mauro.  I forgot to say that, this occurs only when
using a third-party theme, e.g., you create a file named ‘X-theme.el’,
which is under ‘/tmp/’ and contains the following code:

    (deftheme X)
    (provide 'X-theme)

Then evaluate

    (let ((custom-theme-load-path '("/tmp/")))
      (require-theme 'X-theme))

Then call ‘enable-theme’ interactively.

> It should offer the completion, and at least it does for me. What
> were the steps that you followed? And on which Emacs version?

- emacs-version: 29.1;    system-configuration: x86_64-w64-mingw32
- emacs-version: 30.0.50; system-configuration: x86_64-pc-linux-gnu



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Wed, 09 Aug 2023 07:39:02 GMT) Full text and rfc822 format available.

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

From: Shynur Xie <one.last.kiss <at> outlook.com>
To: Shynur Xie <one.last.kiss <at> outlook.com>, Mauro Aranda
 <maurooaranda <at> gmail.com>
Cc: "65145 <at> debbugs.gnu.org" <65145 <at> debbugs.gnu.org>
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Wed, 9 Aug 2023 07:38:34 +0000
> which is under ‘/tmp/’ and contains the following code:
>
>     (deftheme X)
>   > (provide 'X-theme) <
      ^^^^^^^^^^^^^^^^^^ typo here

Should be “(provide-theme 'X)”.

(Though both reproduce that behavior.)



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Wed, 09 Aug 2023 09:51:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Shynur Xie <one.last.kiss <at> outlook.com>
Cc: "65145 <at> debbugs.gnu.org" <65145 <at> debbugs.gnu.org>
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Wed, 9 Aug 2023 06:50:47 -0300
Shynur Xie <one.last.kiss <at> outlook.com> writes:

>> I can't reproduce it.  I did:
>> emacs -Q
>> (require-theme 'leuven-theme)
>> M-x enable-theme
>
> Oh Oh, sorry, Mauro.  I forgot to say that, this occurs only when
> using a third-party theme, e.g., you create a file named ‘X-theme.el’,
> which is under ‘/tmp/’ and contains the following code:
>
>     (deftheme X)
>     (provide 'X-theme)
>
> Then evaluate
>
>     (let ((custom-theme-load-path '("/tmp/")))
>       (require-theme 'X-theme))
>
> Then call ‘enable-theme’ interactively.

Thanks, I see it now.  Note that if you change the X-theme.el file to
something like this:

(deftheme X)

(let ((class '((class color) (min-colors 89))))
  (custom-theme-set-faces
   'X
   `(default ((,class (:background "#222222" :foreground "#f6f6f6"))))))

(provide-theme 'X)

Then there's completion for "X".  The reason is that, for completion,
Custom looks for a non-nil theme-settings property.  Your empty theme
recipe doesn't have settings, so theme-settings is nil, while if you
change it to a non-empty theme, theme-settings will be non-nil.

I don't really see a need to change the code here.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Wed, 09 Aug 2023 10:00:01 GMT) Full text and rfc822 format available.

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

From: Shynur Xie <one.last.kiss <at> outlook.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: "65145 <at> debbugs.gnu.org" <65145 <at> debbugs.gnu.org>
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Wed, 9 Aug 2023 09:59:46 +0000
> The reason is that, for completion, Custom looks for a non-nil
> theme-settings property.  Your empty theme recipe doesn't have
> settings, so theme-settings is nil, while if you change it to a
> non-empty theme, theme-settings will be non-nil.

Thank you, Mauro.  No further question now.  :)

(I defined an empty theme because I plan to do this work later.)



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65145; Package emacs. (Wed, 09 Aug 2023 10:18:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Shynur Xie <one.last.kiss <at> outlook.com>
Cc: "65145 <at> debbugs.gnu.org" <65145 <at> debbugs.gnu.org>
Subject: Re: bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
Date: Wed, 9 Aug 2023 07:17:30 -0300
tags 65145 notabug
close 65145
quit


Shynur Xie <one.last.kiss <at> outlook.com> writes:

>> The reason is that, for completion, Custom looks for a non-nil
>> theme-settings property.  Your empty theme recipe doesn't have
>> settings, so theme-settings is nil, while if you change it to a
>> non-empty theme, theme-settings will be non-nil.
>
> Thank you, Mauro.  No further question now.  :)
>
> (I defined an empty theme because I plan to do this work later.)

No problem :)

I'm closing this bug report.  If anyone disagrees, feel free to reopen.





Added tag(s) notabug. Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 09 Aug 2023 10:18:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 65145 <at> debbugs.gnu.org and Shynur Xie <one.last.kiss <at> outlook.com> Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 09 Aug 2023 10:18:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Sep 2023 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 291 days ago.

Previous Next


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