aboutsummaryrefslogtreecommitdiff
path: root/etc/indent-code.el.in
blob: 68ad72c56293209e1088ee7d3d9a58e7ef35b8a7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!@EMACS@ --script
;;; 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>

;; This file is part of GNU Guix.

;; GNU Guix is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Guix is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This scripts indents the given file or package definition in the specified
;; file using Emacs.

;;; Code:

;; Load Scheme indentation rules from the current directory.
(with-temp-buffer
  (scheme-mode)
  (let ((default-directory (file-name-as-directory "."))
        (enable-local-variables :all))
    (hack-dir-local-variables)
    (hack-local-variables-apply)))

;; Add indentation info for Scheme constructs that are not Guix-specific.
;; This is normally provided by Geiser but this file is for people who may not
;; be running Geiser, so we just copy it here (from 'geiser-syntax.el').
(defmacro guix-syntax--scheme-indent (&rest pairs)
  `(progn ,@(mapcar (lambda (p)
                      `(put ',(car p) 'scheme-indent-function ',(cadr p)))
                    pairs)))

(guix-syntax--scheme-indent
 (and-let* 1)
 (case-lambda 0)
 (catch defun)
 (class defun)
 (dynamic-wind 0)
 (guard 1)
 (let*-values 1)
 (let-values 1)
 (let/ec 1)
 (letrec* 1)
 (match 1)
 (match-lambda 0)
 (match-lambda* 0)
 (match-let scheme-let-indent)
 (match-let* 1)
 (match-letrec 1)
 (opt-lambda 1)
 (parameterize 1)
 (parameterize* 1)
 (receive 2)
 (require-extension 0)
 (syntax-case 2)
 (test-approximate 1)
 (test-assert 1)
 (test-eq 1)
 (test-equal 1)
 (test-eqv 1)
 (test-group-with-cleanup 1)
 (test-runner-on-bad-count! 1)
 (test-runner-on-bad-end-name! 1)
 (test-runner-on-final! 1)
 (test-runner-on-group-begin! 1)
 (test-runner-on-group-end! 1)
 (test-runner-on-test-begin! 1)
 (test-runner-on-test-end! 1)
 (test-with-runner 1)
 (unless 1)
 (when 1)
 (while 1)
 (with-exception-handler 1)
 (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]")))

;;; indent-code.el ends here
> * gnu/packages/linux.scm (linux-libre-4.19-version): Update to 4.19.166. (linux-libre-4.19-pristine-source): Update hash. 2021-01-10gnu: linux-libre 5.4: Update to 5.4.88.Leo Famulari * gnu/packages/linux.scm (linux-libre-5.4-version): Update to 5.4.88. (linux-libre-5.4-pristine-source): Update hash. 2021-01-10gnu: linux-libre: Update to 5.10.6.Leo Famulari * gnu/packages/linux.scm (linux-libre-5.10-version): Update to 5.10.6. (linux-libre-5.10-pristine-source): Update hash. 2021-01-09gnu: youtube-dl: Update to 2021.01.08.Tobias Geerinckx-Rice * gnu/packages/video.scm (youtube-dl): Update to 2021.01.08. 2021-01-09gnu: yakuake: Update to 20.12.1.Tobias Geerinckx-Rice * gnu/packages/kde-systemtools.scm (yakuake): Update to 20.12.1. 2021-01-09gnu: lvm2: Update to 2.03.11.Tobias Geerinckx-Rice * gnu/packages/linux.scm (lvm2): Update to 2.03.11. 2021-01-09gnu: okular: Update to 20.12.1.Tobias Geerinckx-Rice * gnu/packages/kde.scm (okular): Update to 20.12.1. 2021-01-09gnu: plzip: Update to 1.9.Tobias Geerinckx-Rice * gnu/packages/compression.scm (plzip): Update to 1.9. 2021-01-09gnu: tomb: Update to 2.9.Tobias Geerinckx-Rice * gnu/packages/crypto.scm (tomb): Update to 2.9. 2021-01-09gnu: feh: Update to 3.6.2.Tobias Geerinckx-Rice * gnu/packages/image-viewers.scm (feh): Update to 3.6.2. 2021-01-09gnu: rspamd: Update to 2.7.Tobias Geerinckx-Rice * gnu/packages/mail.scm (rspamd): Update to 2.7. 2021-01-09gnu: ncmpcpp: Update to 0.9.1.Leo Famulari * gnu/packages/mpd.scm (ncmpcpp): Update to 0.9.1. 2021-01-09gnu: guix-build-coordinator: Update to 0-15.b5d998c.Christopher Baines * gnu/packages/package-management.scm (guix-build-coordinator): Update to 0-15.b5d998c. 2021-01-09gnu: emacs-scheme-complete: Update to 0.9.9.Nicolas Goaziou * gnu/packages/emacs-xyz.scm (emacs-scheme-complete): Update to 0.9.9. * gnu/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch: Remove file. * gnu/local.mk: Update file. 2021-01-08gnu: icecat: Update to 78.6.1-guix0-preview1 [fixes CVE-2020-16044].Mark H Weaver * gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update gnuzilla commit, base version, and hashes. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to new version. 2021-01-09gnu: guile: Update to 3.0.5.Ludovic Courtès * gnu/packages/guile.scm (guile-3.0-latest): Update to 3.0.5. 2021-01-09tests: Run 'tests/offload.scm' only when BUILD_DAEMON_OFFLOAD is true.Ludovic Courtès Fixes: guix build -e '(@ (gnu packages package-management) guix-minimal)' * Makefile.am (SCM_TESTS): Move 'tests/offload.scm' within "if BUILD_DAEMON_OFFLOAD" conditional. 2021-01-08gnu: emacs-howm: Update to 1.4.7.Nicolas Goaziou * gnu/packages/emacs-xyz.scm (emacs-howm): Update to 1.4.7. 2021-01-08gnu: emacs-emms: Fix vorbiscomment path.Pierre Neidhardt * gnu/packages/emacs-xyz.scm (emacs-emms)[arguments]: Replace call to "vorbiscomment" by its full store path. 2021-01-08gnu: Add liquidsfz.Ricardo Wurmus * gnu/packages/music.scm (liquidsfz): New variable. 2021-01-08gnu: yoshimi: Update to 1.7.4.Ricardo Wurmus * gnu/packages/music.scm (yoshimi): Update to 1.7.4. 2021-01-08gnu: monero-gui: Update to 0.17.1.9.Guillaume Le Vaillant * gnu/packages/finance.scm (monero-gui): Update to 0.17.1.9. [source]: Fetch submodules. Add snippet to remove embedded monero sources. 2021-01-08gnu: monero: Update to 0.17.1.9.Guillaume Le Vaillant * gnu/packages/finance.scm (monero): Update to 0.17.1.9. 2021-01-08gnu: Add schmutz.Ricardo Wurmus * gnu/packages/guile-xyz.scm (schmutz): New variable. 2021-01-08gnu: rust-pin-utils-0.1: Deduplicate duplicate definitions.Efraim Flashner * gnu/packages/crates-io.scm (rust-pin-utils-0.1): Combine duplicate definitions. 2021-01-08gnu: Add cl-markdown.Sharlatan Hellseher * gnu/packages/lisp-xyz.scm (cl-markdown, ecl-cl-markdown, sbcl-cl-markdown): New variables. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2021-01-08gnu: Add cl-dynamic-classes.Sharlatan Hellseher * gnu/packages/lisp-xyz.scm (cl-dynamic-classes, ecl-dynamic-classes, sbcl-dynamic-classes): New variables. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> 2021-01-08gnu: sequoia: Update to 1.0.0.Hartmut Goebel * gnu/packages/sequoia.scm (sequoia): Update to 1.0.0. [arguments]{cargo-inputs}: Add rust-eax, rust-futures-util, rust-sha1collisiondetection, rust-socket2. Update rust-capnp, rust-capnp-rpc, rust-capnpc, rust-futures, rust-http,rust-hyper rust-hyper-tls, rust-tokio, rust-win-crypto-ng. 2021-01-08gnu: rust-socket2: Update to 0.3.19.Hartmut Goebel * gnu/packages/crates-io.scm (rust-socket2): Update to 0.3.19. [arguments]{cargo-inputs}: Remove rust-redox-syscall. 2021-01-08gnu: Replace rust-win-crypto-ng-0.2 by rust-win-crypto-ng-0.4.Hartmut Goebel * gnu/packages/crates-io.scm (rust-win-crypto-ng-0.2): Update to 0.4.0 and rename to (rust-win-crypto-ng-0.4). [arguments]{cargo-inouts}: Add rust-cipher. 2021-01-08gnu: Replace rust-capnpc-0.10 by rust-capnpc-0.13.Hartmut Goebel * gnu/packages/crates-io.scm (rust-capnpc-0.10): Update to 0.13.1 and rename to rust-capnpc-0.13. [arguments] Add skip-build. {cargo-inputs}: Update rust-capnp to rust-capnp-0.13. 2021-01-08gnu: Replace rust-capnp-rpc-0.10 by rust-capnp-rpc-0.13.Hartmut Goebel * gnu/packages/crates-io.scm (rust-capnp-rpc-0.10): Update to 0.13.1 and rename to rust-capnp-rpc-0.13. [arguments] Add skip-build. {cargo-inputs}: Update rust-capnp to rust-capnp-0.13. Update rust-capnp-futures to rust-capnp-futures-0.13. 2021-01-08gnu: Replace rust-capnp-futures-0.10 by rust-capnp-futures-0.13.Hartmut Goebel * gnu/packages/crates-io.scm (rust-capnp-futures-0.10): Update to 0.13.2 and rename to (rust-capnp-futures-0.13). [arguments] Add skip-build. {cargo-inputs}: Update rust-capnp to rust-capnp-0.13. 2021-01-08gnu: Replace rust-capnp-0.10 by rust-capnp-0.13.Hartmut Goebel * gnu/packages/crates-io.scm (rust-capnp-0.10): Update to 0.13.6 and rename to rust-capnp-0.13. [arguments] Add skip-build.