aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Gjorgjevski2021-08-27 19:08:41 +0200
committerLars Ingebrigtsen2021-08-27 19:08:41 +0200
commit4bb70549f7fa158f1eb1542cec799be219ce1a89 (patch)
tree8481745f2ea8c0e58450382078755549ce6d040a
parent9224a863192b1317ef307bcc76abfdfbad73b796 (diff)
downloademacs-4bb70549f7fa158f1eb1542cec799be219ce1a89.tar.gz
emacs-4bb70549f7fa158f1eb1542cec799be219ce1a89.zip
Fix shell-script-mode indentation of continuation lines
* lisp/progmodes/sh-script.el (sh-smie--default-backward-token): Fix indentation of continuation lines (bug#44592).
-rw-r--r--lisp/progmodes/sh-script.el2
-rw-r--r--test/lisp/progmodes/sh-script-tests.el40
2 files changed, 41 insertions, 1 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index b6674731ddf..201d1fd1647 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1775,7 +1775,7 @@ Does not preserve point."
1775 (goto-char p) 1775 (goto-char p)
1776 nil)))) 1776 nil))))
1777 (while 1777 (while
1778 (progn (skip-syntax-backward "w_'") 1778 (progn (skip-syntax-backward ".w_'")
1779 (or (not (zerop (skip-syntax-backward "\\"))) 1779 (or (not (zerop (skip-syntax-backward "\\")))
1780 (when (eq ?\\ (char-before (1- (point)))) 1780 (when (eq ?\\ (char-before (1- (point))))
1781 (let ((p (point))) 1781 (let ((p (point)))
diff --git a/test/lisp/progmodes/sh-script-tests.el b/test/lisp/progmodes/sh-script-tests.el
new file mode 100644
index 00000000000..5bdce6260ae
--- /dev/null
+++ b/test/lisp/progmodes/sh-script-tests.el
@@ -0,0 +1,40 @@
1;;; sh-script-tests.el --- Tests for sh-script.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'sh-script)
25(require 'ert)
26
27(ert-deftest test-sh-script-indentation ()
28 (with-temp-buffer
29 (insert "relative-path/to/configure --prefix=$prefix\\
30 --with-x")
31 (shell-script-mode)
32 (goto-char (point-min))
33 (forward-line 1)
34 (indent-for-tab-command)
35 (should (equal
36 (buffer-substring-no-properties (point-min) (point-max))
37 "relative-path/to/configure --prefix=$prefix\\
38 --with-x"))))
39
40;;; sh-script-tests.el ends here