progfolio / elpaca

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

[Feature]: Don't require symbolic links on Windows #72

Closed mestinso closed 1 year ago

mestinso commented 1 year ago

Feature Description

Straight has the straight-use-symlinks setting that is set to nil on windows by default. Is there any plan to add an equivalent feature for elpaca to use copying instead? Note that I'd like to switch to elpaca from straight but this is preventing me due to how my windows environment is configured.

Confirmation

progfolio commented 1 year ago

It would depend on how much complexity it adds to the code base. If I recall, straight leaves some edge cases unaccounted for when simulating links.

I don't use Windows very often, and when I do I enable symlinks, so this is a low priority feature for now.

mestinso commented 1 year ago

Got it, understood. I would note that I'm in a corporate windows environment and I don't have admin privileges in order to enable symlinks. I expect many other corporate windows users to be in a similar situation (and it's usually not by choice!). My emacs lisp skills are lacking, otherwise, I might take a crack at it. Maybe for a future day...

progfolio commented 1 year ago

@mestinso:

I've implemented a WIP feature branch which allows for avoiding symlinks on Windows. It implements a global minor-mode which, when enabled, copies files directly to their build directories. It also adds a hook to find-file-hook which will visit the corresponding source file in the package's repo when a build file is visited (similar to how a symlink would behave). I'm not sure I'll turn it on for users by default depending on their OS, but it can be easily configured. See the following test case:

Test Case ```emacs-lisp (elpaca-test :ref "feat/no-symlink" ;; This line doesn't necessarily need to be early-init.el. :; It just needs to be before elpaca queues any packages ;; (including itself at the end of the isntaller). ;; If you're interested in only using the feature when the underlying OS is Windows, ;; it could be wrapped in a conditional: e.g. ;; ;; (when (member system-type '(ms-dos windows-nt)) ;; (with-eval-after-load 'elpaca (elpaca-no-symlink-mode))) :early-init (with-eval-after-load 'elpaca (elpaca-no-symlink-mode)) :init (elpaca doct) (elpaca-wait) (elpaca-with-dir 'doct build (print (elpaca-process-output "ls" "-lah")))) ```
Host Env
elpacaf3df95f HEAD -> feat/no-symlink, origin/feat/no-symlink
isntaller0.5
emacsGNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-07-25
gitgit version 2.41.0
Output ```emacs-lisp INFO Scraping files for loaddefs... INFO Scraping files for loaddefs...done GEN ../elpaca-autoloads.el Cloning into '/tmp/elpaca.5UT1AS/elpaca/repos/elpaca'... Switched to a new branch 'feat/no-symlink' branch 'feat/no-symlink' set up to track 'origin/feat/no-symlink'. Checking /tmp/elpaca.5UT1AS/elpaca/repos/elpaca... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-info.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-log.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-manager.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-menu-elpa.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-menu-melpa.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-menu-org.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-process.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-test.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca-ui.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/elpaca.el... Checking /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/doc... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/doc/early-init.el... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/doc/init.el... Checking /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/extensions... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/extensions/elpaca-use-package.el... Checking /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/images... Checking /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/test... Compiling /tmp/elpaca.5UT1AS/elpaca/repos/elpaca/test/elpaca-test.el... Done (Total of 11 files compiled, 3 skipped in 4 directories) Downloading MELPA recipes... Downloading MELPA recipes...100% Downloading NonGNU-devel ELPA... Downloading GNU-devel ELPA... Downloading NonGNU ELPA... Downloading GNU ELPA... "total 112K drwxr-xr-x 2 n n 100 Jul 30 15:32 . drwxr-xr-x 4 n n 80 Jul 30 15:32 .. -rw-r--r-- 1 n n 16K Jul 30 15:32 doct-autoloads.el -rw-r--r-- 1 n n 49K Jul 30 15:32 doct.el -rw-r--r-- 1 n n 42K Jul 30 15:32 doct.elc " Test Env Elpaca f3df95f HEAD -> feat/no-symlink, origin/feat/no-symlink installer: 0.5 emacs-version: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-07-25 git --version: git version 2.41.0 ```

You can start a temporary test session using this branch and your config by evaluating the following in your scratch buffer:

(elpaca-test :ref "feat/no-symlink" :early-init user :init user :interactive t)

Testing is appreciated.

D4rk5py commented 1 year ago

I've been testing the "feat/no-symlink" / elpaca-no-symlink-mode in Microsoft Windows in a corporate setting, meaning that I've got limitations, and is working alright.

progfolio commented 1 year ago

I've been testing the "feat/no-symlink" / elpaca-no-symlink-mode in Microsoft Windows in a corporate setting, meaning that I've got limitations, and is working alright.

Noted. Thank you for testing!

progfolio commented 1 year ago

I've merged elpaca-no-symlink-mode into master. As always, testing is appreciated. Thanks.