unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Calling (package-initialize) sooner during initialization
@ 2015-04-11 23:10 Vasilij Schneidermann
  2015-04-12  1:00 ` Artur Malabarba
  2015-04-12  3:56 ` Stefan Monnier
  0 siblings, 2 replies; 104+ messages in thread
From: Vasilij Schneidermann @ 2015-04-11 23:10 UTC (permalink / raw)
  To: emacs-devel

Hello,

I am surprised that option #2 is being favoured and has been met with a
fair amount of discussion considering it's the hackier solution (why
*add* text to the init file if one could merely *do* the package
initialization step in startup.el, completely bypassing issues like init
code possibly getting added multiple times to the file and the general
annoyance as this cluttering cannot be disabled at all and can happen at
every installation) and involves more work.

Since option #1 wasn't discussed in the prior discussion, I'd suggest a
third one, enabling packages in startup.el unless an Emacs-specific
environment variable is set (or Emacs is started up in a special mode of
operation).  Doing so works cross-platform, avoids cluttering anything
(be it an existing or new file) and is simple to get right.

Any thoughts on this proposal?



^ permalink raw reply	[flat|nested] 104+ messages in thread
* Re: Calling (package-initialize) sooner during initialization
@ 2015-04-18 12:25 Taylan Ulrich Bayırlı/Kammer
  2015-04-18 13:32 ` Artur Malabarba
  0 siblings, 1 reply; 104+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-04-18 12:25 UTC (permalink / raw)
  To: emacs-devel

Hi,

has it been considered yet to simply support an optional

  ~/.emacs.d/pre-package-init.el

file that always gets executed before packages are initialized (just
like the current init.el), then packages get initialized, and then
init.el or ~/.emacs is loaded?

So startup looks like:

  1. Load ~/.emacs.d/pre-package-init.el if it exists.
  2. Initialize packages.
  3. Load ~/.emacs or ~/.emacs.d/init.el if one exists.

Are there any disadvantages to this approach?

Taylan


P.S.: We can even support a setting which further delays package
initialization, i.e. change the order of steps 2 and 3, if really
desired.  It should be as simple as setting a variable in
pre-package-init.el.



^ permalink raw reply	[flat|nested] 104+ messages in thread
* Re: Calling (package-initialize) sooner during initialization
@ 2015-04-12 12:09 Jorgen Schäfer
  2015-04-12 14:26 ` Artur Malabarba
                   ` (2 more replies)
  0 siblings, 3 replies; 104+ messages in thread
From: Jorgen Schäfer @ 2015-04-12 12:09 UTC (permalink / raw)
  To: v.schneidermann, emacs-devel

Hello.
I think a major part of the problem here is that package-initialize does
a lot more things than it needs to. All that has to happen before the
user init file is loaded is to load the autoload files from ~/.emacs.d/elpa/.
Everything else can happen on demand or after the init file is loaded,
because it is not necessary to make packages available.

If package.el provided some sort of (package-load-directory DIR), and
ran that on ~/.emacs.d/elpa/, that should fix most use cases already:

> - package-enable-at-startup: Would be equivalent to the proposed
>   environment variable.

That's usually set when the user runs package-initialize manually, but
if the user does not want to enable packages at startup, they can simply
not have anything in ~/.emacs.d/elpa/.

> - package-load-list: Needs to be configured before.

If the user does not want to enable certain packages, they can move
them out of ~/.emacs.d/elpa/. If necessary, they can move the packages
into, say, ~/.emacs.d/held/ and run
(package-load-directory "~/.emacs.d/held") after configuring this variable.

> - package-archives: Needs to be configured before for
>   non-interactive package installation.
> - package-pinned-packages: Needs to be configured before for
>   non-interactive package installation.
> - package-check-signature and package-unsigned-archives: Can be
>   customized afterwards
> - package-directory-list: Needs to be configured before.

These are all only relevant for package installation, not for package
initialization. The user can configure them before installing packages in
their init file, if desired.

> - package-user-dir: Needs to be configured before.

In the new approach, changing this only means the new directory is not
loaded before the user init file is loaded. The user can simply do this
manually using (package-load-directory NEW-DIR) when they need the
new packages, which more or less replicates the current setup of requiring
a package-initialize before packages become available, but arguable more
obvious as the user has to set the variable in their init file already.


That is, Emacs just needs to adjust the load-path and load auto-loads
for the default location before the user init file is run to solve the original
problem of user confusion. None of the config options are necessary for this,
so the race condition that caused the original desire of not running
package-initialize before the user init file is gone. The user can set the
config options as necessary in their init file while simply using packages as
expected.

Regards,
Jorgen



^ permalink raw reply	[flat|nested] 104+ messages in thread
* Calling (package-initialize) sooner during initialization
@ 2015-03-30 19:01 Artur Malabarba
  2015-03-30 20:44 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 104+ messages in thread
From: Artur Malabarba @ 2015-03-30 19:01 UTC (permalink / raw)
  To: emacs-devel

On the "Customizable modes..." thread I suggested we run
(package-initialize) sooner than the way it's currently done. Right
now, it's called after loading the init file. Which means any user who
tries to customize an installed package by pasting some code into his
init file will be confronted with errors.
This happens A LOT.

Stefan kindly explains why it can't just be done before loading the init file:
> [...] the user may need/want to run some Elisp
> code of his own choosing *before* package-initialize is called.
> E.g. [...] set package-load-list and package-directory-list

But I'm asking that we try a little harder to find a better solution.
This package.el-induced "cannot find load file" error is the most
predominant issue I see people run into in the wild. Some people file
issues for this stuff on github (and waste developer time), others go
to the relevant forums, and others (I can only imagine) probably just
give up on configuring packages (or give up Emacs!) entirely.

So I hope we can try to converge on an actual solution instead of just
resigning to something that harms the majority of the users. I propose
here a couple of suggestions which still preserve the use-case outline
by Stefan, and I'm perfectly open to other ideas.
Even if we can't find an ideal solution, try to keep in mind how
absurdly unideal the current situation is.

Option 1) Check if the file `~/.emacs,d/.package-delay-init' exists.
If it does, just do it the way we currently do. If it doesn't exist,
do package-initialize first and then load the init-file. This
`.package-delay-init' file is not loaded, Emacs would only check if it
exists.

Option 2) Instead of us manually telling users to add
`(package-initialize)' to their init-files, we have Emacs do that
automatically. Similar to how `custom.el' adds a call to
`custom-set-variables' the first time you save a variable; package.el
could add a call to `package-initialize' the first time you install a
package. This would be a one-time-thing (and would take some
intelligent coding to prevent annoyiances).

Thank you all,
Artur



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

end of thread, other threads:[~2015-04-29 13:09 UTC | newest]

Thread overview: 104+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-11 23:10 Calling (package-initialize) sooner during initialization Vasilij Schneidermann
2015-04-12  1:00 ` Artur Malabarba
2015-04-12 16:46   ` Mark Oteiza
2015-04-12 19:43     ` Artur Malabarba
2015-04-12 20:05       ` Mark Oteiza
2015-04-12 20:28         ` Artur Malabarba
2015-04-12  3:56 ` Stefan Monnier
2015-04-12  9:58   ` Artur Malabarba
2015-04-12 12:02     ` Stefan Monnier
     [not found]   ` <20150412082125.GA490@odonien>
2015-04-12 10:07     ` Vasilij Schneidermann
2015-04-12 10:28       ` Artur Malabarba
  -- strict thread matches above, loose matches on Subject: below --
2015-04-18 12:25 Taylan Ulrich Bayırlı/Kammer
2015-04-18 13:32 ` Artur Malabarba
2015-04-18 14:24   ` Nic Ferrier
2015-04-18 15:16     ` Taylan Ulrich Bayırlı/Kammer
2015-04-18 17:35       ` Artur Malabarba
2015-04-18 18:25         ` Nic Ferrier
2015-04-18 18:48           ` Artur Malabarba
2015-04-18 15:11   ` Taylan Ulrich Bayırlı/Kammer
2015-04-18 17:16   ` Stefan Monnier
2015-04-18 17:56     ` Dmitry Gutov
2015-04-18 18:16       ` Taylan Ulrich Bayırlı/Kammer
2015-04-18 18:32         ` Artur Malabarba
2015-04-19  0:24           ` Drew Adams
2015-04-19  0:38             ` Artur Malabarba
2015-04-18 18:24       ` Artur Malabarba
2015-04-18 18:32         ` Dmitry Gutov
2015-04-19  8:19           ` Artur Malabarba
2015-04-18 18:04     ` Taylan Ulrich Bayırlı/Kammer
2015-04-18 18:23       ` Artur Malabarba
2015-04-19  3:07       ` Stefan Monnier
2015-04-19  6:44       ` Philipp Stephani
2015-04-19  8:11         ` Artur Malabarba
2015-04-18 22:37     ` chad
2015-04-19  6:40     ` Philipp Stephani
2015-04-19  8:04       ` Artur Malabarba
2015-04-20  0:43         ` Stefan Monnier
2015-04-20  7:54           ` Taylan Ulrich Bayırlı/Kammer
2015-04-20 12:42             ` Stefan Monnier
2015-04-20 14:31               ` Taylan Ulrich Bayırlı/Kammer
2015-04-20 16:01                 ` Artur Malabarba
2015-04-20 17:29                   ` chad
2015-04-20 18:38                     ` Artur Malabarba
2015-04-20 19:40                       ` chad
2015-04-20 19:07                 ` Stefan Monnier
2015-04-20 15:19               ` Mark Oteiza
2015-04-27  9:52               ` Thierry Volpiatto
2015-04-27 11:03                 ` Taylan Ulrich Bayırlı/Kammer
2015-04-27 14:01                   ` Drew Adams
2015-04-27 12:32                 ` Artur Malabarba
2015-04-27 14:10                   ` Drew Adams
2015-04-27 14:15                     ` Artur Malabarba
2015-04-27 14:36                   ` Thierry Volpiatto
2015-04-27 12:46                 ` Stefan Monnier
2015-04-27 13:43                   ` Andy Moreton
2015-04-27 15:46                     ` Stefan Monnier
2015-04-28 10:11                       ` Artur Malabarba
2015-04-28  7:25                     ` Oleh Krehel
2015-04-28  7:39                       ` Artur Malabarba
2015-04-28  7:42                         ` Oleh Krehel
2015-04-28 14:54                           ` Wolfgang Jenkner
2015-04-28 16:46                             ` Drew Adams
2015-04-28 17:29                               ` Wolfgang Jenkner
2015-04-28 18:52                                 ` Artur Malabarba
2015-04-29  1:20                                   ` Stefan Monnier
2015-04-28 15:32                           ` raman
2015-04-29  8:25                           ` Thierry Volpiatto
2015-04-28 15:26                       ` raman
2015-04-27 14:13                   ` Drew Adams
2015-04-27 14:46                   ` Thierry Volpiatto
2015-04-27 15:15                     ` Artur Malabarba
2015-04-27 15:52                     ` Stefan Monnier
2015-04-28  0:30                       ` Stephen J. Turnbull
2015-04-29  8:01                       ` Thierry Volpiatto
2015-04-29 13:09                         ` Stefan Monnier
2015-04-28  0:25                     ` Stephen J. Turnbull
2015-04-12 12:09 Jorgen Schäfer
2015-04-12 14:26 ` Artur Malabarba
2015-04-12 14:45   ` Jorgen Schäfer
2015-04-12 20:46     ` Stefan Monnier
2015-04-12 14:40 ` Aneesh Kumar K.V
2015-04-12 16:23   ` Artur Malabarba
2015-04-12 20:44 ` Stefan Monnier
2015-04-12 21:02   ` Jorgen Schäfer
2015-04-12 23:22     ` Stefan Monnier
2015-04-13 22:52       ` Artur Malabarba
2015-04-13 22:49     ` Artur Malabarba
2015-03-30 19:01 Artur Malabarba
2015-03-30 20:44 ` Stefan Monnier
2015-03-31 10:52   ` Artur Malabarba
2015-03-31 12:34     ` Stefan Monnier
2015-04-18 10:46   ` Ted Zlatanov
2015-03-31  8:53 ` Thierry Volpiatto
2015-03-31 10:55   ` Artur Malabarba
2015-03-31 12:29   ` Stefan Monnier
2015-03-31 12:48     ` Dmitry Gutov
2015-03-31 13:19     ` Thierry Volpiatto
2015-03-31 13:47       ` Thierry Volpiatto
2015-03-31 14:03         ` Thierry Volpiatto
2015-03-31 14:56           ` Artur Malabarba
2015-04-01  6:04             ` Thierry Volpiatto
2015-03-31 14:51 ` Sebastian Wiesner
2015-03-31 15:40   ` Artur Malabarba
2015-03-31 20:46   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

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