(define-key map "\"" 'skeleton-pair-insert-maybe)
(define-key map [remap complete-tag] 'comint-dynamic-complete)
- (define-key map [remap newline-and-indent] 'sh-newline-and-indent)
(define-key map [remap delete-backward-char]
'backward-delete-char-untabify)
(define-key map "\C-c:" 'sh-set-shell)
:help "Set the indentation for the current line"))
(define-key menu-map [sh-pair]
- '(menu-item "Insert braces and quotes in pairs" (lambda () (interactive) (setq skeleton-pair (not skeleton-pair)))
- :button (:toggle . skeleton-pair)
+ '(menu-item "Insert braces and quotes in pairs"
+ (lambda ()
+ (interactive)
+ (require 'skeleton)
+ (setq skeleton-pair (not skeleton-pair)))
+ :button (:toggle . (and (boundp 'skeleton-pair)
+ skeleton-pair))
:help "Inserting a brace or quote automatically inserts the matching pair"))
(define-key menu-map [sh-s0] '("--"))
(defun sh-font-lock-open-heredoc (start string)
"Determine the syntax of the \\n after a <<EOF.
START is the position of <<.
-STRING is the actual word used as delimiter (f.ex. \"EOF\").
+STRING is the actual word used as delimiter (e.g. \"EOF\").
INDENTED is non-nil if the here document's content (and the EOF mark) can
be indented (i.e. a <<- was used rather than just <<).
Point is at the beginning of the next line."
\\[backward-delete-char-untabify] Delete backward one position, even if it was a tab.
-\\[sh-newline-and-indent] Delete unquoted space and indent new line same as this one.
+\\[newline-and-indent] Delete unquoted space and indent new line same as this one.
\\[sh-end-of-command] Go to end of successive commands.
\\[sh-beginning-of-command] Go to beginning of successive commands.
\\[sh-set-shell] Set this buffer's shell, and maybe its magic number.
(goto-char where))
(prog1
(buffer-substring (point)
- (progn (skip-chars-forward "^ \t\n;&|()")(point)))
+ (progn (skip-chars-forward "^ \t\n;&|")(point)))
(unless and-move
(goto-char start)))))
-(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))))
-
(defun sh-beginning-of-command ()
"Move point to successive beginnings of commands."
(interactive)