[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation w
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation with .. operator |
Date: |
Thu, 5 Aug 2021 04:58:01 -0400 (EDT) |
branch: elpa/lua-mode
commit 8ab6df6ef10bd2e7e89fbbbd6818e426f1132740
Author: juergen <juergen>
Commit: juergen <juergen>
Fix bug #619: Wrong identation with .. operator
---
lua-mode.el | 52 ++++++++++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index d278387..e671012 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1,6 +1,6 @@
;;; lua-mode.el --- a major-mode for editing Lua scripts
-;; Copyright (C) 1997, 2001, 2004, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001, 2004, 2006, 2007 Free Software Foundation, Inc.
;; Author: 2006 Juergen Hoetzel <juergen@hoetzel.info>
;; 2004 various (support for Lua 5 and byte compilation)
@@ -28,7 +28,7 @@
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
;; MA 02110-1301, USA.
-(defconst lua-version "20061208"
+(defconst lua-version "20070525"
"Lua Mode version number.")
;; Keywords: languages, processes, tools
@@ -614,6 +614,20 @@ Returns the point, or nil if it reached the beginning of
the buffer"
(beginning-of-line)
(if (not (looking-at "\\s *\\(--.*\\)?$")) (throw 'found (point))))))
+;;}}}
+;;{{{ lua-goto-nonblank-next-line
+
+(defun lua-goto-nonblank-next-line ()
+ "Puts the point at the first next line that is not blank.
+Returns the point, or nil if it reached the end of the buffer"
+ (catch 'found
+ (end-of-line)
+ (while t
+ (forward-line)
+ (if (eobp) (throw 'found nil))
+ (beginning-of-line)
+ (if (not (looking-at "\\s *\\(--.*\\)?$")) (throw 'found (point))))))
+
(eval-when-compile
(defconst lua-operator-class
"-+*/^.=<>~"))
@@ -694,21 +708,7 @@ The criteria for a continuing statement are:
* the last token of the previous line is a continuing op,
OR the first token of the current line is a continuing op
-AND
-
-* the indentation modifier of the preceding line is nonpositive.
-
-The latter is sort of a hack, but it is easier to use this criterion, instead
-of reducing the indentation when a continued statement also starts a new
-block. This is for aesthetic reasons: the indentation should be
-
-dosomething(d +
- e + f + g)
-
-not
-
-dosomething(d +
- e + f + g)"
+"
(let ((prev-line nil))
(save-excursion
(if parse-start (goto-char parse-start))
@@ -717,8 +717,7 @@ dosomething(d +
(or (lua-first-token-continues-p)
(and (goto-char prev-line)
;; check last token of previous nonblank line
- (lua-last-token-continues-p)))
- (<= (lua-calculate-indentation-block-modifier prev-line) 0)))))
+ (lua-last-token-continues-p)))))))
;;}}}
;;{{{ lua-make-indentation-info-pair
@@ -822,7 +821,20 @@ one."
(indentation-info (lua-accumulate-indentation-info
(lua-calculate-indentation-info nil parse-end))))
(if (eq (car indentation-info) 'absolute)
- (- (cdr indentation-info) (current-indentation))
+ (- (cdr indentation-info)
+ (current-indentation)
+ ;; reduce indentation if this line also starts new continued
statement
+ ;; or next line cont. this line
+ ;;This is for aesthetic reasons: the indentation should be
+ ;;dosomething(d +
+ ;; e + f + g)
+ ;;not
+ ;;dosomething(d +
+ ;; e + f + g)"
+ (save-excursion
+ (or (and (lua-last-token-continues-p) lua-indent-level)
+ (and (lua-goto-nonblank-next-line)
(lua-first-token-continues-p) lua-indent-level)
+ 0)))
(+ (lua-calculate-indentation-left-shift)
(cdr indentation-info)
(if (lua-is-continuing-statement-p) (- lua-indent-level) 0)))))
- [nongnu] elpa/lua-mode f9cbb91 007/468: make lua-process-buffer and lua-process global, (continued)
- [nongnu] elpa/lua-mode f9cbb91 007/468: make lua-process-buffer and lua-process global, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c13235f 008/468: fixed indention, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d91bf2b 011/468: new buffer-local variable: lua-electric-flag, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6a7929a 013/468: lua-postprocess-output-buffer: match first error, not last, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78f7b78 014/468: emacs-compatibility: replace-in-string not available on GNU emacs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ea5c4a1 015/468: Documentation: Added installation notes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d20d58 019/468: fold mode cleanup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78fc3ba 005/468: lua-postprocess-output-buffer: jump to lua errors in source files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8802c43 006/468: fixed lua-postprocess-output-buffer: start search from last prompt, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by default: (defcustom lua-default-command-switches (list "-i")..., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation with .. operator,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode d313ff5 024/468: New Release: 20061208, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 31acb6b 029/468: Fix bug #621: Wrong comment block detection, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8f17c27 021/468: fix [#472] lua-mode colorization, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b11a136 022/468: implemented lua-forward-sexp using lua-find-matching-token-word, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c49fb68 023/468: Fixed lua-prompt-regex and handling of output without newline (bug #425), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99324a4 034/468: minor font-lock fix, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c61bda2 040/468: Commit from Reuben:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cd5fa7d 010/468: lua-start-process: made program &optional argument (defaults to name), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 13363db 017/468: Fixed typo (#470), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9730289 027/468: Insert Project page Link, Philip Kaludercic, 2021/08/05