From ce30a6ceb76595ce0ba87eeb54f0b6624485354f Mon Sep 17 00:00:00 2001
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
The trick for passing multiple arguments to Emacs is to use what is called a
* 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.
etc/{indent-code.el.in => indent-code.el} | 52 ++++++++++++-----------
3 files changed, 27 insertions(+), 35 deletions(-)
rename etc/{indent-code.el.in => indent-code.el} (71%)
Toggle diff (107 lines)
diff --git a/.gitignore b/.gitignore
index fd2cf56098..cc5ceb5e10 100644
@@ -149,7 +149,6 @@ stamp-h[0-9]
/doc/os-config-lightweight-desktop.texi
diff --git a/configure.ac b/configure.ac
index 6a6a020585..5ed2cf7aa0 100644
@@ -284,15 +284,6 @@ dnl Documentation translation.
AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
-dnl Emacs (optional), for 'etc/indent-code.el'.
-AC_PATH_PROG([EMACS], [emacs])
-if test "x$EMACS" = x; then
- AC_MSG_WARN([Please install GNU Emacs to use etc/indent-code.el.])
- AC_CONFIG_FILES([etc/indent-code.el], [chmod +x etc/indent-code.el])
diff --git a/etc/indent-code.el.in b/etc/indent-code.el
rename from etc/indent-code.el.in
rename to etc/indent-code.el
index 6102b5d1ab..255ffb126b 100755
--- a/etc/indent-code.el.in
+:;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.
-(pcase command-line-args-left
- (`(,file-name ,package-name)
- ;; Indent the definition of PACKAGE-NAME in FILE-NAME.
- (goto-char (point-min))
- (if (re-search-forward (concat "^(define\\(-public\\) +"
- (let ((indent-tabs-mode nil))
- (error "Package '%s' not found in '%s'"
- package-name file-name)))
- ;; Indent all of FILE-NAME.
- (let ((indent-tabs-mode nil))
- (indent-region (point-min) (point-max))
- (error "Usage: indent-code.el FILE [PACKAGE]")))
+ (pcase command-line-args-left
+ (`(,file-name ,package-name)
+ ;; Indent the definition of PACKAGE-NAME in FILE-NAME.
+ (goto-char (point-min))
+ (if (re-search-forward (concat "^(define\\(-public\\) +"
+ (let ((indent-tabs-mode nil))
+ (error "Package '%s' not found in '%s'"
+ package-name file-name)))
+ ;; Indent all of FILE-NAME.
+ (let ((indent-tabs-mode nil))
+ (indent-region (point-min) (point-max))
+ (error "Usage: indent-code.el FILE [PACKAGE]"))))
;;; indent-code.el ends here