aboutsummaryrefslogtreecommitdiff
path: root/elisp/mfl-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'elisp/mfl-mode.el')
-rw-r--r--elisp/mfl-mode.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/elisp/mfl-mode.el b/elisp/mfl-mode.el
index aadcab08..eb0bceb1 100644
--- a/elisp/mfl-mode.el
+++ b/elisp/mfl-mode.el
@@ -151,7 +151,7 @@
(mfl-next-line-indentation)))))
(defun mfl-find-line-indentation (regexp)
- "Move backwards to the line containing "REGEXP", skipping over
+ "Move backwards to the line containing REGEXP, skipping over
block constructs. Return the indentation of the line, or 0
if no matching line was found."
(catch 'found
@@ -169,7 +169,7 @@ if no matching line was found."
0))
(defun mfl-find-line-forward (regexp)
- "Move forward to the line containing "REGEXP", skipping over
+ "Move forward to the line containing REGEXP, skipping over
block constructs. Return t if the line was found, nil otherwise."
(catch 'found
(while (not (eobp))
@@ -224,9 +224,19 @@ block constructs. Return t if the line was found, nil otherwise."
(beginning-of-line))))))
(defun mfl-newline-and-indent ()
- "Indent the current line, insert a newline, and then indent again."
+ "Indent the current line, if necessary, insert a newline, and then indent again.
+
+The current line is indented if it begins with one of the following
+keywords: else, elif, fi, done, when, case.
+"
(interactive "*")
- (mfl-indent-line)
+ (if (save-excursion
+ (beginning-of-line)
+ (skip-chars-forward " \t")
+ (looking-at (regexp-opt
+ '("else" "elif" "fi" "done" "when" "case")
+ 'words)))
+ (mfl-indent-line))
(newline-and-indent))

Return to:

Send suggestions and report system problems to the System administrator.