Skip to content

An emacs package that will facilitate hot reloading of custom process or command

License

Notifications You must be signed in to change notification settings

SamuelVanie/entr-runner.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Emacs Version GitHub License

entr-runner.el

A complete “hot reload” package that let you choose a command to run on watched files.

This package is based on entr. Check out that great package.

❓ Why?

I was coding a website with thymeleaf on springboot but I wasn’t able to make the hotreload functionality work properly for me.

That lead me to this package. It permits to choose one or multiple files/directories or both then write a custom command that will run each time these files are changed.

💾 Installation

Melpa

To be added !

Straight

(use-package entr-runner
  :straight (entr-runner :type git :host github :repo "SamuelVanie/entr-runner.el"))

Doom Emacs

(package! entr-runner
  :recipe (:host github :repo "SamuelVanie/entr-runner.el"))

⚠️ After the package installation

You should then run the interactive command entr-runner-install, this will automatically download and compile the entr package if it’s not present on your computer, or setup some variable if it’s already the case.

The installation script depends on which, which is normally install on most unix machines.

💻 Usage

Two possibilities :

  • You can mark your files or directories inside dired (use the “*” key to do so), then run the command entr-runner-dired. That command will prompt you info about the flags that you wish to add to the command and there it is. (see demo)
  • You can also use the command entr-runner-regex that will prompt you for regex that will select all the files from the default-directory and run the command that you will choose on them.

You can stop the process by running the command entr-runner-kill-process. That will kill the process in charge of watching the files.

When you run one of the entr commands, a special buffer will be created that is called entr-runner. This is the buffer in which you can check the logs of the command you ran.

💬 Use Cases

Why I created the package

Using thymeleaf on springboot you can set up an autoreload that didn’t work for me. I just use entr with the option “-r” with the command “gradlew bootRun” on my static files.

Sync your files do google drive automatically

You can use rclone to automatically sync a directory to your google drive, or any cloud base storage.

The command I use is : rclone mount --vfs-cache-mode full org_google:/ ~/.org/. This command mount your remote file system to a local directory(in this case .org).

Recompiling automatically your project

Using make or a gcc command you can automatically compile and run your project. Command similar to the simple gcc *.c -o project && ./project

Writing a latex document that will be automatically compiled and showed

Using a program like zathura that automatically load back the file on disk if its changes on disk. A command like pdflatex file.tex -o file.pdf could help you

Reloading a web page

If you can access you browser window through the command line, you could automatically reload the web page you’re programming. (You can use tool like xdotool)

🤔 Ideas

Instead of entr that doesn’t work on windows, you could use some other command line utility like watchmedo(in watchdog) that is made in python and can also run on windows.

entr only works on UNIX systems, you must have a linux machine or a mac or WSL if that is possible.

👊 Contributing

  • If you find a bug or have an idea for an improvement, please open an issue about it.
  • If you want to contribute, you can open a pull request and I will be happy to review it.
  • If you want to add a new feature, please open an issue first to discuss about it.
  • If you want to support me, you can star the repository.

About

An emacs package that will facilitate hot reloading of custom process or command

Resources

License

Stars

Watchers

Forks

Packages

No packages published