aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/sh-script.el
diff options
context:
space:
mode:
authorKarl Heuer <[email protected]>1995-08-19 00:30:56 +0000
committerKarl Heuer <[email protected]>1995-08-19 00:30:56 +0000
commitcd76025c784faeec1206c2210ae34347cc6bca9e (patch)
tree63a2fa344ca196e8a192979f8560541f3dda5576 /lisp/progmodes/sh-script.el
parent4bfd70e96b978324e46e138b9a13d1b4fd329088 (diff)
(sh-newline-and-indent): Don't interpret prefix arg
since `newline-and-indent' doesn't either. Don't turn a trailing quoted tab into a space. (sh-mode): Use new `skeleton-newline-indent-rigidly'. (sh-set-shell): Make maximum font-locking also hightlight keywords after ``' and `!'. (The latter is for ksh '93 but should't hurt other shells.)
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r--lisp/progmodes/sh-script.el31
1 files changed, 15 insertions, 16 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index e9aae75c49..f1ad692218 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -633,6 +633,7 @@ with your script for an edit-interpret-debug cycle."
(make-local-variable 'comint-prompt-regexp)
(make-local-variable 'font-lock-keywords-case-fold-search)
(make-local-variable 'skeleton-filter)
+ (make-local-variable 'skeleton-newline-indent-rigidly)
(make-local-variable 'process-environment)
(setq major-mode 'sh-mode
mode-name "Shell-script"
@@ -651,7 +652,8 @@ with your script for an edit-interpret-debug cycle."
skeleton-pair-filter 'sh-quoted-p
skeleton-further-elements '((< '(- (min sh-indentation
(current-column)))))
- skeleton-filter 'sh-feature)
+ skeleton-filter 'sh-feature
+ skeleton-newline-indent-rigidly t)
;; parse or insert magic number for exec() and set all variables depending
;; on the shell thus determined
(goto-char (point-min))
@@ -688,7 +690,7 @@ Calls the value of `sh-set-shell-hook' if set."
(,(sh-feature sh-assignment-regexp)
1 font-lock-variable-name-face)
,@(if font-lock-maximum-decoration
- `((,(concat "\\(^\\|[|&;()]\\)[ \t]*\\(\\(\\("
+ `((,(concat "\\(^\\|[|&;()`!]\\)[ \t]*\\(\\(\\("
(mapconcat 'identity
(sh-feature sh-leading-keywords)
"\\|")
@@ -1291,20 +1293,17 @@ The document is bounded by `sh-here-document-word'."
-(defun sh-newline-and-indent (&optional arg)
- "Strip unquoted whitespace, insert newline, and indent like current line.
-Unquoted whitespace is stripped from the current line's end, unless a
-prefix ARG is given."
- (interactive "*P")
- (let ((previous (current-indentation)))
- (if arg ()
- (just-one-space)
- (backward-char)
- (if (sh-quoted-p)
- (forward-char)
- (delete-char 1)))
- (newline)
- (indent-to previous)))
+(defun sh-newline-and-indent ()
+ "Strip unquoted whitespace, insert newline, and indent like current line."
+ (interactive "*")
+ (indent-to (prog1 (current-indentation)
+ (delete-region (point)
+ (progn
+ (or (zerop (skip-chars-backward " \t"))
+ (if (sh-quoted-p)
+ (forward-char)))
+ (point)))
+ (newline))))