Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(re-)load a project #1838

Open
mooseyboots opened this issue Apr 12, 2023 · 3 comments
Open

(re-)load a project #1838

mooseyboots opened this issue Apr 12, 2023 · 3 comments

Comments

@mooseyboots
Copy link

this is more just a query about how to re-load a project. i wonder if this functionality is implemented, and if not, whether users have some other way of handling this. i'm only a very basic user of projectile.el.

when working on an elisp project, i often need to change branches, then re-load my project's code. i.e. i switch to dired, nav to the code dir, call t to invert all marks (mark all if none marked), then call L to load all marked files.

does projectile.el have a way to do this?

@bbatsov
Copy link
Owner

bbatsov commented Apr 12, 2023

Does this help with what you're trying to achieve?

(global-auto-revert-mode t)

Projectile currently can close Projectile buffers, but there's no functionality to recreate special buffers.

@mooseyboots
Copy link
Author

mooseyboots commented Apr 12, 2023

i don't think so, no. i'm not worried about whether buffers are open or updated or not (my buffers update when i switch branches).

i'm interested in loading the code inside them after switching git branches. say i work on a branch in an elisp project, but then i want to return to develop branch in order to actually use the project in my own emacs set up, while not working on it. so i save/close the project's buffers and switch branches in magit, but the feature branch is still the code that is loaded into my emacs session. so i have to manually go to the code in dired and load it with dired-do-load as i mentioned.

it's no problem if it's not a feature in projectile, i just wondered also how others deal with this issue. i guess it's only an issue for elisp devs.

@mooseyboots
Copy link
Author

mooseyboots commented May 4, 2023

i cooked up a hack to do this, but it isn't general, it just loads .el files:

(defun mb/projectile-load-source-files ()
    ""
    (interactive)
    (let* ((projectile-root (projectile-acquire-root))
           (subdir (read-directory-name "Load dir: " projectile-root))
           (regex (rx bos
                      (not ".") ; don't load hidden files
                      (* (any alnum "-" "_"))
                      ".el"
                      eos))
           (files (directory-files subdir nil regex)))
      (dolist (file files)
        (load file))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants