summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-17 19:02:39 +0300
committerAlex Kost <alezost@gmail.com>2015-10-20 16:47:21 +0300
commit4ab70c5ca08efdb5481bf5309694cd07f9f90e13 (patch)
treeb8fa5c3027de5519c66db2e364681bc0419733e4 /emacs
parent380566157de6b0f3ec952c768fac5baafac602f0 (diff)
downloadguix-4ab70c5ca08efdb5481bf5309694cd07f9f90e13.tar.gz
emacs: devel: Add indentation rules for 'modify-phases' keywords.
* emacs/guix-devel.el: Add indentation rules for 'modify-phases' keywords.
  (guix-devel-indent-modify-phases-keyword,
  guix-devel-indent-modify-phases-keyword-1,
  guix-devel-indent-modify-phases-keyword-2): New functions.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-devel.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el
index f3ad4b9255..170ce1ad54 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -254,6 +254,20 @@ Each rule should have a form (SYMBOL VALUE).  See `put' for details."
                   0)))
     (lisp-indent-specform count state indent-point normal-indent)))
 
+(defun guix-devel-indent-modify-phases-keyword (count)
+  "Return indentation function for 'modify-phases' keywords."
+  (lambda (state indent-point normal-indent)
+    (when (ignore-errors
+            (goto-char (nth 1 state))   ; start of keyword sexp
+            (backward-up-list)
+            (looking-at "(modify-phases\\>"))
+      (lisp-indent-specform count state indent-point normal-indent))))
+
+(defalias 'guix-devel-indent-modify-phases-keyword-1
+  (guix-devel-indent-modify-phases-keyword 1))
+(defalias 'guix-devel-indent-modify-phases-keyword-2
+  (guix-devel-indent-modify-phases-keyword 2))
+
 (guix-devel-scheme-indent
   (bag 0)
   (build-system 0)
@@ -293,7 +307,12 @@ Each rule should have a form (SYMBOL VALUE).  See `put' for details."
   (with-monad 1)
   (with-mutex 1)
   (with-store 1)
-  (wrap-program 1))
+  (wrap-program 1)
+
+  ;; 'modify-phases' keywords:
+  (replace    'guix-devel-indent-modify-phases-keyword-1)
+  (add-after  'guix-devel-indent-modify-phases-keyword-2)
+  (add-before 'guix-devel-indent-modify-phases-keyword-2))
 
 
 (defvar guix-devel-keys-map