[Pkg-emacsen-addons] Bug#847690: dh-elpa: better handling of `deftheme' themes

Dmitry Bogatov KAction at gnu.org
Tue Dec 13 10:53:00 UTC 2016


[2016-12-10 09:40] Sean Whitton <spwhitton at spwhitton.name>
> Function autoloads are handled elegantly by dh-elpa.  After installing a
> package, you can just put (turn-on-some-global-minor-mode) in your
> ~/.emacs, and everything works fine.
>
> Themes defined with `deftheme' don't work so well.  After installing a
> theme, a simple call to `load-theme' in your ~/.emacs will fail.
>
> Two possible workarounds are:
>
>     (package-initialize)
>     (load-theme 'zenburn t)
>
> or
>
>     (add-hook 'after-init-hook (lambda () (load-theme 'zenburn)))
>
> but this really shouldn't be necessary.  In short, ELPA packages
> supplying themes are currently second-class citizens in the elpa-*
> namespace.
>
> I'm filing this bug against dh-elpa for the time being, but there might
> not be any sane patch to dh-elpa that will resolve the issue.  The only
> solution might be to implement autoloads for defthemes upstream.
>
> If you are hitting this bug with your package, a sample README.Debian

Thank you for filing bug.

I see two actions we can perform to improve our situation.

 1. Install README.Debian file by dh-elpa if we detect that package is
    theme and no README.Debian is already provided. If README.Debian is
    provided, we can grep it for 'package-initialize', to ensure that
    it mentions this issue.

 2. We can advice #'load-theme. Something like this:

	~~~elisp
	(defadvice load-theme
	    (before load-theme-before-enabling (theme no-confirm no-enable))
	  "Function autoloads are handled elegantly by dh-elpa.  After installing a
	package, you can just put (turn-on-some-global-minor-mode) in your
	~/.emacs, and everything works fine.

	Themes defined with `deftheme' don't work so well.  After installing a
	theme, a simple call to `load-theme' in your ~/.emacs will fail. This advice
	'require's a feature, that correspond to theme to be loaded."
	  (ignore-errors
	    (require (intern (format "%s-theme" theme)))))
	~~~

    I know that advices are dangerous, but I believe that this one can
    not have any implications, beside negligible perfomance ones.

--
X-Web-Site: https://sinsekvu.github.io | Note that I process my email in batch,
Accept-Languages: eo,ru,en             | at most once every 24 hours. If matter
Accept: text/plain, text/x-diff        | is urgent, you have my phone number.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-emacsen-addons/attachments/20161213/57bdc57f/attachment.sig>


More information about the Pkg-emacsen-addons mailing list