diff options
| author | Simeon Simeonov | 2024-11-09 13:04:13 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2024-11-09 13:04:13 +0100 |
| commit | a773e7ed865a1a7eb5bf00b9f0481e888534831a (patch) | |
| tree | 9b0014538bb1cdddd41f651eba62a54d5ebca475 /.emacs.d/lisp/nginx-mode.el | |
| parent | 87d628a4bb80f1253e01e408bb8e02a0840f85b2 (diff) | |
Upgrade markdown-mode, nginx-mode, rust-mode, yaml-mode and python-mode/property_getter
Diffstat (limited to '.emacs.d/lisp/nginx-mode.el')
| -rw-r--r-- | .emacs.d/lisp/nginx-mode.el | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/.emacs.d/lisp/nginx-mode.el b/.emacs.d/lisp/nginx-mode.el index b01367c..4a29d1e 100644 --- a/.emacs.d/lisp/nginx-mode.el +++ b/.emacs.d/lisp/nginx-mode.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Andrew J Cosgriff <andrew@cosgriff.name> | 5 | ;; Author: Andrew J Cosgriff <andrew@cosgriff.name> |
| 6 | ;; Maintainer: Andrew J Cosgriff <andrew@cosgriff.name> | 6 | ;; Maintainer: Andrew J Cosgriff <andrew@cosgriff.name> |
| 7 | ;; Created: 15 Oct 2010 | 7 | ;; Created: 15 Oct 2010 |
| 8 | ;; Version: 1.1.9 | 8 | ;; Version: 1.1.10 |
| 9 | ;; Keywords: languages, nginx | 9 | ;; Keywords: languages, nginx |
| 10 | 10 | ||
| 11 | ;; available from http://github.com/ajc/nginx-mode | 11 | ;; available from http://github.com/ajc/nginx-mode |
| @@ -33,6 +33,10 @@ | |||
| 33 | 33 | ||
| 34 | ;; Put this file into your load-path and the following into your ~/.emacs: | 34 | ;; Put this file into your load-path and the following into your ~/.emacs: |
| 35 | ;; (require 'nginx-mode) | 35 | ;; (require 'nginx-mode) |
| 36 | ;; | ||
| 37 | ;; Now that nginx-mode is available via NonGNU ELPA, you could also: | ||
| 38 | ;; (use-package nginx-mode | ||
| 39 | ;; :commands nginx-mode) | ||
| 36 | 40 | ||
| 37 | ;;; Code: | 41 | ;;; Code: |
| 38 | 42 | ||
| @@ -76,24 +80,8 @@ | |||
| 76 | "If point is in a block, return the indentation of the first line of that | 80 | "If point is in a block, return the indentation of the first line of that |
| 77 | block (the line containing the opening brace). Used to set the indentation | 81 | block (the line containing the opening brace). Used to set the indentation |
| 78 | of the closing brace of a block." | 82 | of the closing brace of a block." |
| 79 | (save-excursion | 83 | (* (syntax-ppss-depth (syntax-ppss)) |
| 80 | (save-match-data | 84 | nginx-indent-level)) |
| 81 | (let ((opoint (point)) | ||
| 82 | (apoint (search-backward "{" nil t))) | ||
| 83 | (when apoint | ||
| 84 | ;; This is a bit of a hack and doesn't allow for strings. We really | ||
| 85 | ;; want to parse by sexps at some point. | ||
| 86 | (let ((close-braces (count-matches "}" apoint opoint)) | ||
| 87 | (open-braces 0)) | ||
| 88 | (while (and apoint (> close-braces open-braces)) | ||
| 89 | (setq apoint (search-backward "{" nil t)) | ||
| 90 | (when apoint | ||
| 91 | (setq close-braces (count-matches "}" apoint opoint)) | ||
| 92 | (setq open-braces (1+ open-braces))))) | ||
| 93 | (if apoint | ||
| 94 | (current-indentation) | ||
| 95 | nil)))))) | ||
| 96 | |||
| 97 | 85 | ||
| 98 | (defun nginx-comment-line-p () | 86 | (defun nginx-comment-line-p () |
| 99 | "Return non-nil iff this line is a comment." | 87 | "Return non-nil iff this line is a comment." |
| @@ -112,11 +100,11 @@ of the closing brace of a block." | |||
| 112 | (block-indent (nginx-block-indent)) | 100 | (block-indent (nginx-block-indent)) |
| 113 | cur-indent) | 101 | cur-indent) |
| 114 | (cond | 102 | (cond |
| 115 | ((and (looking-at "^\\s-*}\\s-*$") block-indent) | 103 | ((and (looking-at "^\\s-*}") block-indent) |
| 116 | ;; This line contains a closing brace and we're at the inner | 104 | ;; This line contains a closing brace and we're at the inner |
| 117 | ;; block, so we should indent it matching the indentation of | 105 | ;; block, so we should indent it matching the indentation of |
| 118 | ;; the opening brace of the block. | 106 | ;; the opening brace of the block. |
| 119 | (setq cur-indent block-indent)) | 107 | (setq cur-indent (- block-indent nginx-indent-level))) |
| 120 | (t | 108 | (t |
| 121 | ;; Otherwise, we did not start on a block-ending-only line. | 109 | ;; Otherwise, we did not start on a block-ending-only line. |
| 122 | (save-excursion | 110 | (save-excursion |
