Created
January 15, 2022 17:29
-
-
Save DaniruKun/2af40cb1fe8ee5bac82b281f1102820d to your computer and use it in GitHub Desktop.
Example of a universal Emacs Package script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env emacs --script | |
;;; foo.el --- Foo development and productivity utils -*- lexical-binding: t; -*- | |
;;;;; Commands | |
;;;###autoload | |
(defun bar () | |
"Print foo bar." | |
(interactive) | |
(message "Foo Bar!")) | |
;;;; CLI | |
(defun foo-running-as-script-p () | |
"Return truthy if running as Elisp script." | |
(member "-scriptload" command-line-args)) | |
(defun main () | |
"Entrypoint for foo" | |
(pprint command-line-args-left) | |
(message "Do stuff here")) | |
(when (foo-running-as-script-p) | |
(main)) | |
(provide 'foo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment