[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nginx-mode e60c15e 06/34: fix indentation of commented-out
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nginx-mode e60c15e 06/34: fix indentation of commented-out blocks, as per https://github.com/ajc/nginx-mode/issues/#issue/1 |
Date: |
Sun, 29 Aug 2021 11:24:12 -0400 (EDT) |
branch: elpa/nginx-mode
commit e60c15e2ebc6c9c5fad00e3a9c935f23cca4157c
Author: Andrew J Cosgriff <andrew@cosgriff.name>
Commit: Andrew J Cosgriff <andrew@cosgriff.name>
fix indentation of commented-out blocks, as per
https://github.com/ajc/nginx-mode/issues/#issue/1
---
nginx-mode.el | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/nginx-mode.el b/nginx-mode.el
index 5662f38..2297b40 100644
--- a/nginx-mode.el
+++ b/nginx-mode.el
@@ -97,7 +97,7 @@ of the closing brace of a block."
(save-excursion
(save-match-data
(beginning-of-line)
- (looking-at (format "\\s-*%s" comment-start)))))
+ (looking-at "^\\s-*#"))))
(defun nginx-indent-line ()
"Indent current line as nginx code."
@@ -109,10 +109,10 @@ of the closing brace of a block."
(block-indent (nginx-block-indent))
cur-indent)
(cond
- ((and (looking-at "^\\s-*},?\\s-*$") block-indent)
- ;; This line contains a closing brace or a closing brace followed by a
- ;; comma and we're at the inner block, so we should indent it matching
- ;; the indentation of the opening brace of the block.
+ ((and (looking-at "^\\s-*}\\s-*$") block-indent)
+ ;; 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))
(t
;; Otherwise, we did not start on a block-ending-only line.
@@ -129,7 +129,7 @@ of the closing brace of a block."
;; Brace or paren on a line by itself will already be indented to
;; the right level, so we can cheat and stop there.
- ((looking-at "^\\s-*[\)}]\\s-*")
+ ((looking-at "^\\s-*}\\s-*")
(setq cur-indent (current-indentation))
(setq not-indented nil))
@@ -140,23 +140,13 @@ of the closing brace of a block."
(setq cur-indent (+ (current-indentation) nginx-indent-level))
(setq not-indented nil))
- ;; Indent by one level if the line ends with an open paren.
- ((looking-at "^.*\(\\s-*$")
- (setq cur-indent (+ (current-indentation) nginx-indent-level))
- (setq not-indented nil))
-
;; Start of buffer.
((bobp)
- (setq not-indented nil)))))
-
- ;; If this line contains only a closing paren, we should lose one
- ;; level of indentation.
- (if (looking-at "^\\s-*\)\\s-*$")
- (setq cur-indent (- cur-indent nginx-indent-level)))))
+ (setq not-indented nil)))))))
;; We've figured out the indentation, so do it.
(if (and cur-indent (> cur-indent 0))
- (indent-line-to cur-indent)
+ (indent-line-to cur-indent)
(indent-line-to 0)))))
- [nongnu] branch elpa/nginx-mode created (now a2bab83), ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode 9e25e1f 31/34: version bump, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode e60c15e 06/34: fix indentation of commented-out blocks, as per https://github.com/ajc/nginx-mode/issues/#issue/1,
ELPA Syncer <=
- [nongnu] elpa/nginx-mode 81766b7 18/34: version increase, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode 5990ae9 20/34: more docs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode b5c7899 14/34: Merge pull request #7 from yasuyk/remove-duplicated-provide-form, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode 5d0738a 11/34: Remove duplicated provide form, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode f8f5769 13/34: Update Readme with an example, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode cbc2e9b 16/34: Merge pull request #9 from LC43/patch-1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode 6fd3933 17/34: Update README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode b58708d 28/34: version bump, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode a2bab83 34/34: bump version, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nginx-mode 3d193f7 05/34: * nginx-mode.el: fix to use md-readme to generate a handy README.md file, ELPA Syncer, 2021/08/29