emacs/var/elfeed/db/data/b3/b3e4a092ed429a8a98cbdc994525181e9b0489e6
2022-01-03 12:49:32 -06:00

3 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>Bozhidar Batsov has a splendid tip over at <a href="https://emacsredux.com">Emacs Redux</a>. Im pretty sure hes mentioned it before but its so useful it bears repeating. The tip is <a href="https://emacsredux.com/blog/2021/09/29/make-script-files-executable-automatically/">how to make scripts executable</a>. “Scripts” means a file that has a shebang line. That is, a line that starts with <code>#!</code> followed by an application to execute.</p>
<p>The usual workflow is to write the script, save the file, and then change its permissions to make it executable. But it turns out that Emacs provides a better—or at least easier—way. The trick is to use the <code>executable-make-buffer-file-executable-if-script-p</code> command. It checks for the shebang line, makes sure that no execute bits are already set, and if not sets the execute bits respecting the umask.</p>
<p>The usual procedure is to call <code>executable-make-buffer-file-executable-if-script-p</code> from a hook function as described by Batsov in his post. If youve every written a script and tried to run it only to discover that its not executable, this tip will save you some time and frustration.</p>