Function: sh-name-style
sh-name-style is an interactive and byte-compiled function defined in
sh-script.el.gz.
Signature
(sh-name-style NAME &optional CONFIRM-OVERWRITE)
Documentation
Name the current indentation settings as a style called NAME.
If this name exists, the command will prompt whether it should be
overwritten if
- - it was called interactively with a prefix argument, or
- - called non-interactively with optional CONFIRM-OVERWRITE non-nil.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defun sh-name-style (name &optional confirm-overwrite)
"Name the current indentation settings as a style called NAME.
If this name exists, the command will prompt whether it should be
overwritten if
- - it was called interactively with a prefix argument, or
- - called non-interactively with optional CONFIRM-OVERWRITE non-nil."
;; (interactive "sName for this style: ")
(interactive
(list
(read-from-minibuffer "Name for this style? " )
(not current-prefix-arg)))
(let ((slist (cons name
(mapcar (lambda (var) (cons var (symbol-value var)))
sh-var-list)))
(style (assoc name sh-styles-alist)))
(if style
(if (and confirm-overwrite
(not (y-or-n-p "This style exists. Overwrite it? ")))
(message "Not changing style %s" name)
(message "Updating style %s" name)
(setcdr style (cdr slist)))
(message "Creating new style %s" name)
(push slist sh-styles-alist))))