progfolio / elpaca

An elisp package manager
GNU General Public License v3.0
634 stars 31 forks source link

[Feature]: optionally install packages synchronously #42

Closed Luis-Henriquez-Perez closed 1 year ago

Luis-Henriquez-Perez commented 1 year ago

Feature Description

Either a certain parameter of a function or macro, or a variable (probably the former would be preferable) that forces elpaca to install packages synchronously.

when asynchronous installation is desirable

I understand that elpaca is specifically designed to work asynchronously so a synchronous install would be an "anti-feature".

Sometimes in which an asynchronous install of packages is preferable. For me this is nice when installing a package during an active emacs session. You can use elpaca-try to install one or more packages, and do other things while waiting for them to be installed.

recommended solution: put your init in elpaca-after-init-hook

The solution suggested for why did my init file execute out of order is to move all of your init file (or at least the external package dependant parts of it) into elpaca-after-init-hook. This way this code will be run only after package installation as ended.

practical problem to asynchronous installation : missing timing

Even if you follow the recommended solution, you still miss potentially the entire startup process when installing a sufficiently large number of packages. So any code you have involving after-init-hook, before-init-hook, frame-notice-user-settings, .etc has to be revised and likely modified so that it still works even if it missed timing.

stylistic and idealogical problems with suggested solution

In my opinion, requiring to move all their init file contents into a hook to accommodate a single emacs package is unreasonable. A package should require installation, configuration and installation of any dependencies it needs, but it shouldn't entail a restructuring of your entire config solely to meet its own needs.

installing packages asynchronously at startup does not benefit many users

I suspect many Emacs users like me have a config file that heavily relies on external packages--so much so that not having those packages would make emacs unusable for them. For these users, an asynchronous package installation during startup does not benefit them as much because even if emacs is unblocked, it would be too inconvenient to use until their main packages are installed.

others who have mentioned this

I am not the only one who has been concerned about this. I assert that enough users have expressed interest in a synchronous installation for it to be added as an alternative.

https://github.com/progfolio/elpaca/issues/29#issuecomment-1323506198 https://github.com/progfolio/elpaca/issues/29#issuecomment-1345689506 https://github.com/progfolio/elpaca/issues/7#issuecomment-1300662283 https://github.com/progfolio/elpaca/issues/7#issuecomment-1253367568

Confirmation

progfolio commented 1 year ago

git version 2.38.1

That's pretty close to what I have, so I doubt the error is due to the git version. There's probably an error in the constructed git clone command.

I typed in #verbosity after pressing s but the result looks the same. Is verbosity a search tag? I didn't see it in elpaca-ui-search-tags.

It is a search tag, but it is implemented in elpaca-log.el. The log buffer should have elpaca-ui-search-tags set buffer-locally to include elpaca-log-search-tags (which holds tags that only make sense in the context of a log buffer). You can check by evaluating M-x describe-variable elpaca-ui-search-tags from within the log buffer. The commands are shown in the output correctly.

From your log:

elpaca cloning $git clone Elpaca Log (41 matches) #unique !finished https://github.com/progfolio/elpaca.git /home/luis/.config/emacs/elpaca/repos/elpaca.github.progfolio/ 95.332654

Is this actually the text in the log or did you accidentally paste "Elpaca Log (41 matches) #unique !finished" into the log output?

Luis-Henriquez-Perez commented 1 year ago

You can check by evaluating M-x describe-variable elpaca-ui-search-tags from within the log buffer. The commands are shown in the output correctly.

Ok. I confirmed that it's present using describe-variable.

Is this actually the text in the log or did you accidentally paste "Elpaca Log (41 matches) #unique !finished" into the log output?

I don't think I accidentally pasted that. I copied and pasted exactly what was in the log buffer starting from when elpaca was mentioned. Also, this line visible in the picture of the log I included--it's the first line. Furthermore, it appears in separate test below. This time I included a few lines before elpaca was mentioned so it's clear. Let me know if you just want me to include the whole log.

consult                        activation           Autoloads cached                                                                 73.675521
consult                        finished             ✓ 72.152 secs                                                                    73.723465
compat                         finished             ✓ 0.402 secs                                                                     73.805087
elpaca                         cloning              $git clone Elpaca Log (41 matches)  #unique !finished https://github.com/progfolio/elpaca.git /home/luis/.config/emacs/elpaca/repos/elpaca.github.progfolio/ 73.854555
elpaca                         cloning              fatal: Too many arguments.                                                       73.854608
elpaca                         cloning              usage: git clone [<options>] [--] <repo> [<dir>]                                 73.902510
elpaca                         cloning                  -v, --verbose         be more verbose                                        73.983954
elpaca                         cloning                  -q, --quiet           be more quiet                                          74.031472
elpaca                         cloning                  --progress            force progress reporting                               74.113056
elpaca                         cloning                  --reject-shallow      don't clone shallow repository                         74.160374
elpaca                         cloning                  -n, --no-checkout     don't create a checkout                                74.207867
elpaca                         cloning                  --bare                create a bare repository                               74.289779
elpaca                         cloning                  --mirror              create a mirror repository (implies bare)              74.337240
elpaca                         cloning                  -l, --local           to clone from a local repository                       74.385252
elpaca                         cloning                  --no-hardlinks        don't use local hardlinks, always copy                 74.466608
elpaca                         cloning                  -s, --shared          setup as shared repository                             74.514407
elpaca                         cloning                  --recurse-submodules[=<pathspec>]                                            74.596541
elpaca                         cloning                                        initialize submodules in the clone                     74.643932
elpaca                         cloning                  --recursive ...       alias of --recurse-submodules                          74.691851
elpaca                         cloning                  -j, --jobs <n>        number of submodules cloned in parallel                74.773240
elpaca                         cloning                  --template <template-directory>                                              74.821117
elpaca                         cloning                                        directory from which templates will be used            74.902973
elpaca                         cloning                  --reference <repo>    reference repository                                   74.950542
elpaca                         cloning                  --reference-if-able <repo>                                                   74.998345
elpaca                         cloning                                        reference repository                                   75.080099
elpaca                         cloning                  --dissociate          use --reference only while cloning                     75.128175
elpaca                         cloning                  -o, --origin <name>   use <name> instead of 'origin' to track upstream       75.176312
elpaca                         cloning                  -b, --branch <branch>                                                        75.258753
elpaca                         cloning                                        checkout <branch> instead of the remote's HEAD         75.307596
elpaca                         cloning                  -u, --upload-pack <path>                                                     75.389548
elpaca                         cloning                                        path to git-upload-pack on the remote                  75.437637
elpaca                         cloning                  --depth <depth>       create a shallow clone of that depth                   75.485930
elpaca                         cloning                  --shallow-since <time>                                                       75.568802
elpaca                         cloning                                        create a shallow clone since a specific time           75.616806
elpaca                         cloning                  --shallow-exclude <revision>                                                 75.699528
elpaca                         cloning                                        deepen history of shallow clone, excluding rev         75.747328
elpaca                         cloning                  --single-branch       clone only one branch, HEAD or --branch                75.795718
elpaca                         cloning                  --no-tags             don't clone any tags, and make later fetches not to follow them 75.878099
elpaca                         cloning                  --shallow-submodules  any cloned submodules will be shallow                  75.935273
elpaca                         cloning                  --separate-git-dir <gitdir>                                                  76.018140
elpaca                         cloning                                        separate git dir from working tree                     76.066249
elpaca                         cloning                  -c, --config <key=value>                                                     76.114872
elpaca                         cloning                                        set config inside the new repository                   76.197058
elpaca                         cloning                  --server-option <server-specific>                                            76.245598
elpaca                         cloning                                        option to transmit                                     76.328940
elpaca                         cloning                  -4, --ipv4            use IPv4 addresses only                                76.377389
elpaca                         cloning                  -6, --ipv6            use IPv6 addresses only                                76.426159
elpaca                         cloning                  --filter <args>       object filtering                                       76.508736
elpaca                         cloning                  --also-filter-submodules                                                     76.557815
elpaca                         cloning                                        apply partial clone filters to submodules              76.640926
elpaca                         cloning                  --remote-submodules   any cloned submodules will use their remote-tracking branch 76.689328
elpaca                         cloning                  --sparse              initialize sparse-checkout file to include only files at root 76.737962
elpaca                         cloning                  --bundle-uri <uri>    a URI for downloading bundles before fetching from origin remote 76.821490
elpaca                         failed                   --bundle-uri <uri>    a URI for downloading bundles before fetching from origin remote 76.960135
elpaca                         checking-out-ref     $git -c advice.detachedHead=false checkout feat/elpaca-wait                      77.009465
elpaca                         checking-out-ref     Already on 'feat/elpaca-wait'                                                    77.009505
elpaca                         checking-out-ref     Your branch is up to date with 'origin/feat/elpaca-wait'.                        77.058867
elpaca                         ref-checked-out      feat/elpaca-wait checked out                                                     77.141904
elpaca                         cloning-deps         Cloning Dependencies                                                             77.191013
elpaca                         cloning-deps         No external dependencies detected                                                77.240834
elpaca                         linking              Linking build files                                                              77.323614
elpaca                         linking              Build files linked                                                               77.376768
elpaca                         autoloads            Generating autoloads: /home/luis/.config/emacs/elpaca/builds/elpaca              77.460250
elpaca                         autoloads            $/usr/bin/emacs -Q -L /home/luis/.config/emacs/elpaca/repos/elpaca/ -L /home/luis/.config/emacs/elpaca/builds/elpaca -l /home/luis/.config/emacs/elpaca/repos/elpaca/elpaca.el --batch --eval (progn (setq gc-cons-percentage 1.0) (elpaca-generate-autoloads "elpaca" "/home/luis/.config/emacs/elpaca/builds/elpaca")) 77.813719
elpaca                         autoloads              INFO     Scraping files for elpaca-autoloads.el...                             77.813768
elpaca                         autoloads              INFO     Scraping files for elpaca-autoloads.el...done                         77.899027
elpaca                         autoloads            Autoloads Generated                                                              77.948671
elpaca                         byte-compilation     Byte compiling                                                                   77.998125
elpaca                         failed               elpaca--byte-compile: (wrong-type-argument number-or-marker-p nil)               78.620836
progfolio commented 1 year ago

That's puzzling. If that's the case, it looks like the header-line-format intended for the log buffer made its way into the clone command string. Not sure how that would happen.

Try testing with :ref pointed to the "fix/28-clone" branch. It includes a guard that will prevent the header-line-format being set in buffers which are not derived from elpaca-ui-mode. It also includes a new command elpaca-log-write which will write the entire log + some system info to a file which you can share here.

Luis-Henriquez-Perez commented 1 year ago

I will address your previous comment but first I want to mention that there are many comments in this issue. I think the original problem in this issue has been answered with elpaca-wait. Perhaps it is appropriate to have a separate issue for specifically the header-line-format in the log buffer; or maybe, you'd prefer to consider this as a debugging-elpaca-wait type thing. Up to you.

progfolio commented 1 year ago

Yes, please file a separate issue.