diff options
author | Tom Willemse | 2024-04-04 15:01:20 -0700 |
---|---|---|
committer | Tom Willemse | 2024-04-04 15:01:20 -0700 |
commit | de0519941ee235dcd1587f6aab68152285e1aaaa (patch) | |
tree | 93feec8d4f39323e65216d8fc7a29a169634c549 /nginx-mode.el | |
parent | a300a31262d37c68704e11f9b92f6eb5c0253ff0 (diff) | |
parent | 0dd70cf398dd6de6282dbbcff86ccf27c0d4e3ed (diff) | |
download | nginx-mode-de0519941ee235dcd1587f6aab68152285e1aaaa.tar.gz nginx-mode-de0519941ee235dcd1587f6aab68152285e1aaaa.zip |
Diffstat (limited to 'nginx-mode.el')
-rw-r--r-- | nginx-mode.el | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/nginx-mode.el b/nginx-mode.el index c612719..1589d50 100644 --- a/nginx-mode.el +++ b/nginx-mode.el @@ -76,24 +76,8 @@ "If point is in a block, return the indentation of the first line of that block (the line containing the opening brace). Used to set the indentation of the closing brace of a block." - (save-excursion - (save-match-data - (let ((opoint (point)) - (apoint (search-backward "{" nil t))) - (when apoint - ;; This is a bit of a hack and doesn't allow for strings. We really - ;; want to parse by sexps at some point. - (let ((close-braces (count-matches "}" apoint opoint)) - (open-braces 0)) - (while (and apoint (> close-braces open-braces)) - (setq apoint (search-backward "{" nil t)) - (when apoint - (setq close-braces (count-matches "}" apoint opoint)) - (setq open-braces (1+ open-braces))))) - (if apoint - (current-indentation) - nil)))))) - + (* (syntax-ppss-depth (syntax-ppss)) + nginx-indent-level)) (defun nginx-comment-line-p () "Return non-nil iff this line is a comment." @@ -116,7 +100,7 @@ of the closing brace of a block." ;; This line contains a closing brace and we're at the inner ;; block, so we should indent it matching the indentation of ;; the opening brace of the block. - (setq cur-indent block-indent)) + (setq cur-indent (- block-indent nginx-indent-level))) (t ;; Otherwise, we did not start on a block-ending-only line. (save-excursion |