[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b0d0198 2/2: Tweak octave continuation indentation
From: |
Lars Ingebrigtsen |
Subject: |
master b0d0198 2/2: Tweak octave continuation indentation |
Date: |
Sun, 30 May 2021 00:25:56 -0400 (EDT) |
branch: master
commit b0d01982e2d5732390806ec5bbec6ebc01172601
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Tweak octave continuation indentation
* lisp/progmodes/octave.el (octave-smie-rules): Further tweak
continuation indentation (bug#17955).
---
lisp/progmodes/octave.el | 2 +-
test/lisp/progmodes/octave-tests.el | 49 +++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 5d877fc..aff3066 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -461,7 +461,7 @@ Non-nil means always go to the next Octave code line after
sending."
;; For (invalid) code between switch and case.
;; (if (smie-rule-parent-p "switch") 4)
nil))
- ('(:after . "=") octave-block-offset)))
+ ('(:after . "=") (smie-rule-parent octave-block-offset))))
(defun octave-indent-comment ()
"A function for `smie-indent-functions' (which see)."
diff --git a/test/lisp/progmodes/octave-tests.el
b/test/lisp/progmodes/octave-tests.el
new file mode 100644
index 0000000..e28fe73
--- /dev/null
+++ b/test/lisp/progmodes/octave-tests.el
@@ -0,0 +1,49 @@
+;;; octave-tests.el --- Test suite for octave.el -*- lexical-binding:t -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'octave)
+
+(defun octave-test--indent (string)
+ (with-temp-buffer
+ (octave-mode)
+ (insert string)
+ (indent-region (point-min) (point-max))
+ (buffer-string)))
+
+(ert-deftest octave-tests--continuation-indentation ()
+ (should
+ (equal (octave-test--indent "a = b + a * \\
+c;
+")
+ "a = b + a * \\
+ c;
+"))
+ (should (equal (octave-test--indent "a = \\
+b;
+")
+ "a = \\
+ b;
+")))
+
+;;; octave-tests.el ends here