LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0387-Add-Erlang-alignment-regexps.patch of Package erlang (Project home:Ledest:erlang:20)

From 8d948cfaf990a92d58f9a6f9af0d7a8c38b7b8c2 Mon Sep 17 00:00:00 2001
From: "David N. Welton" <davidw@dedasys.com>
Date: Sun, 25 Feb 2018 16:18:31 -0800
Subject: [PATCH 1/2] Add Erlang alignment regexps

These allow for the alignment of maps and records
---
 lib/tools/emacs/erlang.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 411e0e13df..b757371483 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -1407,6 +1407,19 @@ Other commands:
     (add-function :before-until (local 'eldoc-documentation-function)
                   #'erldoc-eldoc-function))
   (run-hooks 'erlang-mode-hook)
+
+  ;; Align maps.
+  (add-to-list 'align-rules-list
+               '(erlang-maps
+                 (regexp  . "\\(\\s-*\\)\\(=>\\)\\s-*")
+                 (modes   . '(erlang-mode))
+                 (repeat  . t)))
+  ;; Align records and :: specs
+  (add-to-list 'align-rules-list
+               '(erlang-record-specs
+                 (regexp  . "\\(\\s-*\\)\\(=\\).*\\(::\\)*\\s-*")
+                 (modes   . '(erlang-mode))
+                 (repeat  . t)))
   (if (zerop (buffer-size))
       (run-hooks 'erlang-new-file-hook)))
 
-- 
2.16.4