aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-03-31 00:12:01 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-05-14 23:05:42 -0400
commitcb21ae76714f1873d3b3fb40d5135f00ec104b85 (patch)
treee9dc974235e6ec25e3ddda6338a50a52c565e636 /etc
parentb6d18fbdf6ab4a8821a58aa16587676e835001f2 (diff)
downloadguix-cb21ae76714f1873d3b3fb40d5135f00ec104b85.tar
guix-cb21ae76714f1873d3b3fb40d5135f00ec104b85.tar.gz
etc: indent-code.el: Use the --quick option.
This prevents Emacs from loading the autoload definitions found in its profile, which needlessly clutters the output. It also prevents Geiser (if installed) from blocking the script and asking the user to input the Scheme implementation to use. The trick for passing multiple arguments to Emacs is to use what is called a "sesquicolon" (see https://www.emacswiki.org/emacs/EmacsScripts). * etc/indent-code.el.in: Rename to... * etc/indent-code.el: ...this. Adapt the shebang to use a sesquicolon, and pass the --quick option to Emacs. Since this line is interpreted by the shell, simply use Emacs from the PATH instead of from a hard coded location. (main): New procedure, used as the entry point. * configure.ac: Remove the warning about Emacs. Emacs can now be installed any time by the user if they want to use the script. * .gitignore: No longer ignore changes to etc/indent-code.el.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/indent-code.el (renamed from etc/indent-code.el.in)52
1 files changed, 27 insertions, 25 deletions
diff --git a/etc/indent-code.el.in b/etc/indent-code.el
index 6102b5d1ab..255ffb126b 100755
--- a/etc/indent-code.el.in
+++ b/etc/indent-code.el
@@ -1,8 +1,9 @@
-#!@EMACS@ --script
+:;exec emacs --batch --quick --load="$0" --funcall=main "$@"
;;; indent-code.el --- Run Emacs to indent a package definition.
;; Copyright © 2017 Alex Kost <alezost@gmail.com>
;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;; This file is part of GNU Guix.
@@ -86,29 +87,30 @@
(with-syntax 1))
-(pcase command-line-args-left
- (`(,file-name ,package-name)
- ;; Indent the definition of PACKAGE-NAME in FILE-NAME.
- (find-file file-name)
- (goto-char (point-min))
- (if (re-search-forward (concat "^(define\\(-public\\) +"
- package-name)
- nil t)
- (let ((indent-tabs-mode nil))
- (beginning-of-defun)
- (indent-sexp)
- (save-buffer)
- (message "Done!"))
- (error "Package '%s' not found in '%s'"
- package-name file-name)))
- (`(,file-name)
- ;; Indent all of FILE-NAME.
- (find-file file-name)
- (let ((indent-tabs-mode nil))
- (indent-region (point-min) (point-max))
- (save-buffer)
- (message "Done!")))
- (x
- (error "Usage: indent-code.el FILE [PACKAGE]")))
+(defun main ()
+ (pcase command-line-args-left
+ (`(,file-name ,package-name)
+ ;; Indent the definition of PACKAGE-NAME in FILE-NAME.
+ (find-file file-name)
+ (goto-char (point-min))
+ (if (re-search-forward (concat "^(define\\(-public\\) +"
+ package-name)
+ nil t)
+ (let ((indent-tabs-mode nil))
+ (beginning-of-defun)
+ (indent-sexp)
+ (save-buffer)
+ (message "Done!"))
+ (error "Package '%s' not found in '%s'"
+ package-name file-name)))
+ (`(,file-name)
+ ;; Indent all of FILE-NAME.
+ (find-file file-name)
+ (let ((indent-tabs-mode nil))
+ (indent-region (point-min) (point-max))
+ (save-buffer)
+ (message "Done!")))
+ (x
+ (error "Usage: indent-code.el FILE [PACKAGE]"))))
;;; indent-code.el ends here