From fd20504b5ca0c87db46ef234c4045a54ff2ca673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mo=CC=88ding?= Date: Tue, 2 Mar 2021 20:55:53 +0100 Subject: [PATCH] Prevent "Unbalanced parenthesis" error when aligning parameters --- puppet-mode.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/puppet-mode.el b/puppet-mode.el index 6261f8e..f652aeb 100644 --- a/puppet-mode.el +++ b/puppet-mode.el @@ -1036,6 +1036,11 @@ Used as `syntax-propertize-function' in Puppet Mode." "Align the current block." (interactive) (save-excursion + ;; Move point to beginning of string if inside a string to + ;; prevent "Unbalanced parentheses" error by `backward-up-list'. + (let ((region (puppet-string-region))) + (if region + (goto-char (car region)))) (backward-up-list) (let ((beg (point))) (forward-list)