From 0b08600ca5fa791731135111000243a9942aab41 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Mon, 1 Dec 2014 20:21:08 +0300
Subject: build: emacs-utils: Add 'emacs-generate-autoloads'.

* guix/build/emacs-utils.scm (emacs-generate-autoloads): New procedure.
---
 guix/build/emacs-utils.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 10ef3c8d0f..0cff28b45b 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@
   #:export (%emacs
             emacs-batch-eval
             emacs-batch-edit-file
+            emacs-generate-autoloads
             emacs-substitute-sexps
             emacs-substitute-variables))
 
@@ -47,6 +49,14 @@
                           (format #f "--eval=~S" expr)))
     (error "emacs-batch-edit-file failed!" file expr)))
 
+(define (emacs-generate-autoloads name directory)
+  "Generate autoloads for Emacs package NAME placed in DIRECTORY."
+  (let* ((file (string-append directory "/" name "-autoloads.el"))
+         (expr `(let ((backup-inhibited t)
+                      (generated-autoload-file ,file))
+                  (update-directory-autoloads ,directory))))
+    (emacs-batch-eval expr)))
+
 (define-syntax emacs-substitute-sexps
   (syntax-rules ()
     "Substitute the S-expression immediately following the first occurrence of
-- 
cgit v1.2.3