File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1036,6 +1036,11 @@ Used as `syntax-propertize-function' in Puppet Mode."
1036
1036
" Align the current block."
1037
1037
(interactive )
1038
1038
(save-excursion
1039
+ ; ; Move point to beginning of string if inside a string to
1040
+ ; ; prevent "Unbalanced parentheses" error by `backward-up-list' .
1041
+ (let ((region (puppet-string-region)))
1042
+ (if region
1043
+ (goto-char (car region ))))
1039
1044
(backward-up-list )
1040
1045
(let ((beg (point )))
1041
1046
(forward-list )
Original file line number Diff line number Diff line change @@ -615,6 +615,32 @@ class foo {
615
615
}
616
616
}" ))))
617
617
618
+ (ert-deftest puppet-align-block/point-in-string ()
619
+ :tags '(alignment)
620
+ (puppet-test-with-temp-buffer
621
+ "
622
+ class foo {
623
+ $x = {
624
+ 'a'=>1,
625
+ 'foo'=>{
626
+ 'apples'=>1,
627
+ },
628
+ 'metafalica'=>1,
629
+ }
630
+ }"
631
+ (search-forward " tafalica" )
632
+ (puppet-align-block)
633
+ (should (string= (buffer-string ) "
634
+ class foo {
635
+ $x = {
636
+ 'a' => 1,
637
+ 'foo' => {
638
+ 'apples'=>1,
639
+ },
640
+ 'metafalica' => 1,
641
+ }
642
+ }" ))))
643
+
618
644
619
645
; ;;; Imenu
620
646
You can’t perform that action at this time.
0 commit comments