From a773e7ed865a1a7eb5bf00b9f0481e888534831a Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Sat, 9 Nov 2024 13:04:13 +0100 Subject: Upgrade markdown-mode, nginx-mode, rust-mode, yaml-mode and python-mode/property_getter --- .emacs.d/lisp/nginx-mode.el | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to '.emacs.d/lisp/nginx-mode.el') 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 @@ ;; Author: Andrew J Cosgriff ;; Maintainer: Andrew J Cosgriff ;; Created: 15 Oct 2010 -;; Version: 1.1.9 +;; Version: 1.1.10 ;; Keywords: languages, nginx ;; available from http://github.com/ajc/nginx-mode @@ -33,6 +33,10 @@ ;; Put this file into your load-path and the following into your ~/.emacs: ;; (require 'nginx-mode) +;; +;; Now that nginx-mode is available via NonGNU ELPA, you could also: +;; (use-package nginx-mode +;; :commands nginx-mode) ;;; Code: @@ -76,24 +80,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." @@ -112,11 +100,11 @@ of the closing brace of a block." (block-indent (nginx-block-indent)) cur-indent) (cond - ((and (looking-at "^\\s-*}\\s-*$") block-indent) + ((and (looking-at "^\\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)) + (setq cur-indent (- block-indent nginx-indent-level))) (t ;; Otherwise, we did not start on a block-ending-only line. (save-excursion -- cgit v1.3