all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
@ 2023-08-08 10:31 Shynur Xie
  2023-08-08 23:09 ` Mauro Aranda
  0 siblings, 1 reply; 7+ messages in thread
From: Shynur Xie @ 2023-08-08 10:31 UTC (permalink / raw)
  To: 65145

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-08 10:31 bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’ Shynur Xie
@ 2023-08-08 23:09 ` Mauro Aranda
  2023-08-09  7:23   ` Shynur Xie
  0 siblings, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2023-08-08 23:09 UTC (permalink / raw)
  To: Shynur Xie; +Cc: 65145

Shynur Xie <one.last.kiss@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?






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-08 23:09 ` Mauro Aranda
@ 2023-08-09  7:23   ` Shynur Xie
  2023-08-09  7:38     ` Shynur Xie
  2023-08-09  9:50     ` Mauro Aranda
  0 siblings, 2 replies; 7+ messages in thread
From: Shynur Xie @ 2023-08-09  7:23 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 65145@debbugs.gnu.org

> 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-09  7:23   ` Shynur Xie
@ 2023-08-09  7:38     ` Shynur Xie
  2023-08-09  9:50     ` Mauro Aranda
  1 sibling, 0 replies; 7+ messages in thread
From: Shynur Xie @ 2023-08-09  7:38 UTC (permalink / raw)
  To: Shynur Xie, Mauro Aranda; +Cc: 65145@debbugs.gnu.org

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-09  7:23   ` Shynur Xie
  2023-08-09  7:38     ` Shynur Xie
@ 2023-08-09  9:50     ` Mauro Aranda
  2023-08-09  9:59       ` Shynur Xie
  1 sibling, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2023-08-09  9:50 UTC (permalink / raw)
  To: Shynur Xie; +Cc: 65145@debbugs.gnu.org

Shynur Xie <one.last.kiss@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.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-09  9:50     ` Mauro Aranda
@ 2023-08-09  9:59       ` Shynur Xie
  2023-08-09 10:17         ` Mauro Aranda
  0 siblings, 1 reply; 7+ messages in thread
From: Shynur Xie @ 2023-08-09  9:59 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 65145@debbugs.gnu.org

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’
  2023-08-09  9:59       ` Shynur Xie
@ 2023-08-09 10:17         ` Mauro Aranda
  0 siblings, 0 replies; 7+ messages in thread
From: Mauro Aranda @ 2023-08-09 10:17 UTC (permalink / raw)
  To: Shynur Xie; +Cc: 65145@debbugs.gnu.org

tags 65145 notabug
close 65145
quit


Shynur Xie <one.last.kiss@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.






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-09 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 10:31 bug#65145: ‘enable-theme’ completion for themes loaded by ‘require-theme’ Shynur Xie
2023-08-08 23:09 ` Mauro Aranda
2023-08-09  7:23   ` Shynur Xie
2023-08-09  7:38     ` Shynur Xie
2023-08-09  9:50     ` Mauro Aranda
2023-08-09  9:59       ` Shynur Xie
2023-08-09 10:17         ` Mauro Aranda

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.