[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 5fa9b81 077/468: lua-indent-line: don't change th
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 5fa9b81 077/468: lua-indent-line: don't change the indent if inside multiline string literal |
Date: |
Thu, 5 Aug 2021 04:58:11 -0400 (EDT) |
branch: elpa/lua-mode
commit 5fa9b81c6f2ee2d08fdf71d5d0e978ce9e1ae94c
Author: immerrr <immerrr@gmail.com>
Commit: immerrr <immerrr@gmail.com>
lua-indent-line: don't change the indent if inside multiline string literal
---
lua-mode.el | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 9e69ff7..f304d9e 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -420,23 +420,27 @@ This function replaces previous prefix-key binding with a
new one."
(defun lua-indent-line ()
"Indent current line for Lua mode.
Return the amount the indentation changed by."
- (let ((indent (max 0 (- (lua-calculate-indentation nil)
- (lua-calculate-unindentation))))
- (beg (line-beginning-position))
+ (let (indent
shift-amt
(case-fold-search nil)
+ ;; save point as a distance to eob - it's invariant w.r.t indentation
(pos (- (point-max) (point))))
(back-to-indentation)
- (setq shift-amt (- indent (current-column)))
- (when (not (zerop shift-amt))
- (delete-region beg (point))
- (indent-to indent))
- ;; If initial point was within line's indentation,
- ;; position after the indentation. Else stay at same point in text.
- (if (> (- (point-max) pos) (point))
- (goto-char (- (point-max) pos)))
- shift-amt
- indent))
+ (if (lua-string-p) ;; don't indent if inside multiline string literal
+ (goto-char (- (point-max) pos)) ;; just restore point position
+
+ (setq indent (max 0 (- (lua-calculate-indentation nil)
+ (lua-calculate-unindentation))))
+ (setq shift-amt (- indent (current-column)))
+ (when (not (zerop shift-amt))
+ (delete-region (line-beginning-position) (point))
+ (indent-to indent))
+ ;; If initial point was within line's indentation,
+ ;; position after the indentation. Else stay at same point in text.
+ (if (> (- (point-max) pos) (point))
+ (goto-char (- (point-max) pos)))
+ shift-amt
+ indent)))
(defun lua-find-regexp (direction regexp &optional limit ignore-p)
"Searches for a regular expression in the direction specified.
- [nongnu] elpa/lua-mode 4f4d3de 047/468: Add Makefile with dist and release targets, and ignore release zips., (continued)
- [nongnu] elpa/lua-mode 4f4d3de 047/468: Add Makefile with dist and release targets, and ignore release zips., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 16861a3 032/468: Fix bug #620 again: Wrong identation with tables, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e10183d 037/468: handle font-lock-variable-name-face (Reuben Thomas), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ab2d44c 038/468: Multiple changes by Reuben Thomas:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e057e22 044/468: Rename install.rst to README to help github and users., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b20ca34 051/468: Add note to send update to ELPA., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode afdf074 053/468: Make defcustom declaration formats consistent., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ec1a0f2 063/468: Remove extraneous variable lua-indent-whitespace, use back-to-indentation instead, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 47ac4f3 056/468: Don't have the echo command printed itself., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a52e6b1 070/468: lua-left-shift-regexp: optimize and greatly reduce size, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5fa9b81 077/468: lua-indent-line: don't change the indent if inside multiline string literal,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode aedf8a5 018/468: Documentation in restructured text, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 85fda70 039/468: Add patch from Olivier Andrieu for rudimentary long bracket support, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cf9de96 031/468: Reverted invalid changes for Bug #620, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 04fb034 009/468: lua-jump-to-traceback: Issue warnings about truncated traceback, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0ae7e3e 016/468: Handle function names in assignments, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 89dbb80 020/468: imenu fix for local functions, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bdf4bab 025/468: support for hideshow, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d7c462a 030/468: Fix bug #620: Wrong identation with tables, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eebb50c 035/468: Fix #1913: Indenting: "(" like "{", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fc0a1e3 036/468: Changes/Fixes by Reuben Thomas:, Philip Kaludercic, 2021/08/05