all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* defcustom problem with packages (user error?)
@ 2014-11-12  5:22 Elias Mårtenson
  2014-11-12 13:20 ` Artur Malabarba
  0 siblings, 1 reply; 5+ messages in thread
From: Elias Mårtenson @ 2014-11-12  5:22 UTC (permalink / raw
  To: emacs-devel

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

In preparation for the eventual inclusion of gnu-apl-mode into ELPA, I
decided to ensure that the new-user experience is as smooth as possible. So
I started out with a minimal Emacs configuration and loaded my package from
MELPA (which is where it's located currently).

The following is the minimal configuration I started out with:

    (custom-set-variables
      ;; ....
      )
    (custom-set-faces
      ;; ...
      )
    (require 'package)
    (add-to-list 'package-archives '("elpa" . "http://tromey.com/elpa/"))
    (add-to-list 'package-archives '("marmalade" . "
http://marmalade-repo.org/packages/"))
    (add-to-list 'package-archives '("melpa" . "
http://melpa.milkbox.net/packages/"))
    (package-initialize)

Now, to make a long story short, here's the problem I encountered:

Given the configuration above, and gnu-apl-mode being the only package
loaded, I am unable to use the customisation framework to set any
variables. I mean, the variables can be customised and all, but the changes
become overridden as soon as `package-initialize' is called.

The workaround, of course, is to call `package-initialize' *before* the
call to `custom-set-variables'. However, this is not made clear anywhere.
That said, I'm not sure if there is a problem with the package, or this is
the way things are supposed to work.

So I guess my question is this: Did I make a mistake in developing the
package? If so, then is the proper way documented anywhere? And if my
package is correct, then why does the package loading override the default
values set by `custom-set-variables'?

If anyone is willing to take a look at the package, the source is available
at https://github.com/lokedhs/gnu-apl-mode

Regards,
Elias

[-- Attachment #2: Type: text/html, Size: 2863 bytes --]

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

* Re: defcustom problem with packages (user error?)
  2014-11-12  5:22 defcustom problem with packages (user error?) Elias Mårtenson
@ 2014-11-12 13:20 ` Artur Malabarba
  2014-11-12 14:45   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Artur Malabarba @ 2014-11-12 13:20 UTC (permalink / raw
  To: Elias Mårtenson; +Cc: emacs-devel

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

I'm not sure if that's the cause of your problem, but you don't need to
autoload all those defcustom s.
Just autoload the entry functions.

Artur Malabarba

[-- Attachment #2: Type: text/html, Size: 206 bytes --]

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

* Re: defcustom problem with packages (user error?)
  2014-11-12 13:20 ` Artur Malabarba
@ 2014-11-12 14:45   ` Stefan Monnier
  2014-11-13 13:03     ` Elias Mårtenson
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-11-12 14:45 UTC (permalink / raw
  To: Artur Malabarba; +Cc: Elias Mårtenson, emacs-devel

> I'm not sure if that's the cause of your problem, but you don't need to
> autoload all those defcustom s.
> Just autoload the entry functions.

Oh, indeed, autoloading variables is generally a bad idea.  And it could
explain the behavior.  I haven't seen such problem until now, but it's
probably because such autoloads are rare.  So maybe we should document
it more prominently.


        Stefan



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

* Re: defcustom problem with packages (user error?)
  2014-11-12 14:45   ` Stefan Monnier
@ 2014-11-13 13:03     ` Elias Mårtenson
  2014-11-13 17:40       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Elias Mårtenson @ 2014-11-13 13:03 UTC (permalink / raw
  To: Stefan Monnier; +Cc: Artur Malabarba, emacs-devel

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

On 12 November 2014 22:45, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > I'm not sure if that's the cause of your problem, but you don't need to
> > autoload all those defcustom s.
> > Just autoload the entry functions.
>
> Oh, indeed, autoloading variables is generally a bad idea.  And it could
> explain the behavior.  I haven't seen such problem until now, but it's
> probably because such autoloads are rare.  So maybe we should document
> it more prominently.
>

Thank you. I made this change and indeed now it works better.

That said, if it's not a good idea to autoload customisable variables, then
what is the purpose of `custom-autoload'? This is what gets inserted into
gnu-apl-mode-autoloads.el.

Regards,
Elias

[-- Attachment #2: Type: text/html, Size: 1191 bytes --]

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

* Re: defcustom problem with packages (user error?)
  2014-11-13 13:03     ` Elias Mårtenson
@ 2014-11-13 17:40       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-11-13 17:40 UTC (permalink / raw
  To: Elias Mårtenson; +Cc: Artur Malabarba, emacs-devel

> That said, if it's not a good idea to autoload customisable variables, then
> what is the purpose of `custom-autoload'? This is what gets inserted into
> gnu-apl-mode-autoloads.el.

Some variables are "autoloaded", which basically means their definition
is copied to the autoloads file.  So far this has mostly been used for
lisp/loaddefs.el, i.e. int he case for the "autoloads" file gets loaded
once and forall during the dump process, long before the user's .emacs
and customizations can be involved.

Such autoloaded variables are generally a bad idea, but occasionally
they're useful so that other packages can use the var's value without
having to `require' the package where the var happens to be declared.

This said, most of those autoloaded variables are mistakes that we live
with because once it's autoloaded, it's predefined and hence packages
and .emacs files out there rely on the variable being always defined,
and de-autoloading it would break backward compatibility.

The custom-autoload thingy exists so that autoloaded custom vars don't
cost as much as if the full defcustom was copied into the loaddefs.el
file, IIRC.


        Stefan



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

end of thread, other threads:[~2014-11-13 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12  5:22 defcustom problem with packages (user error?) Elias Mårtenson
2014-11-12 13:20 ` Artur Malabarba
2014-11-12 14:45   ` Stefan Monnier
2014-11-13 13:03     ` Elias Mårtenson
2014-11-13 17:40       ` Stefan Monnier

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.