summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--configure.ac9
-rwxr-xr-xetc/indent-code.el (renamed from etc/indent-code.el.in)52
3 files changed, 27 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
index fd2cf56098..cc5ceb5e10 100644
--- a/.gitignore
+++ b/.gitignore
@@ -149,7 +149,6 @@ stamp-h[0-9]
 tmp
 /doc/os-config-lightweight-desktop.texi
 /nix/scripts/download
-/etc/indent-code.el
 /.version
 /doc/stamp-[0-9]
 /gnu/packages/bootstrap
diff --git a/configure.ac b/configure.ac
index a44a605dc0..0a20b476eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -286,15 +286,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.])
-else
-    AC_SUBST([EMACS])
-    AC_CONFIG_FILES([etc/indent-code.el], [chmod +x etc/indent-code.el])
-fi
-
 case "$storedir" in
   /gnu/store)
     ;;
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