diff lisp/modes/sh-script.el @ 120:cca96a509cfe r20-1b12

Import from CVS: tag r20-1b12
author cvs
date Mon, 13 Aug 2007 09:25:29 +0200
parents cf808b4c4290
children 6608ceec7cf8
line wrap: on
line diff
--- a/lisp/modes/sh-script.el	Mon Aug 13 09:24:19 2007 +0200
+++ b/lisp/modes/sh-script.el	Mon Aug 13 09:25:29 2007 +0200
@@ -49,6 +49,17 @@
 
 (require 'executable)
 
+(defgroup sh nil
+  "Shell programming utilities"
+  :group 'unix
+  :group 'languages)
+
+(defgroup sh-script nil
+  "Shell script mode"
+  :group 'sh
+  :prefix "sh-")
+
+
 ;;; interpreter-mode-alist is not compatible between Emacs and XEmacs.
 ;;; So fake it.
 
@@ -92,13 +103,17 @@
 the name of the interpreter specified in the first line.
 If it matches, mode MODE is selected.")
 
-(defvar sh-mode-hook nil
-  "*Hook run by `sh-mode'.")
+(defcustom sh-mode-hook nil
+  "*Hook run by `sh-mode'."
+  :type 'hook
+  :group 'sh-script)
 
-(defvar sh-set-shell-hook nil
-  "*Hook run by `sh-set-shell'.")
+(defcustom sh-set-shell-hook nil
+  "*Hook run by `sh-set-shell'."
+  :type 'hook
+  :group 'sh-script)
 
-(defvar sh-ancestor-alist
+(defcustom sh-ancestor-alist
   '((ash . sh)
     (bash . jsh)
     (dtksh . ksh)
@@ -137,10 +152,12 @@
       zsh	Z Shell
   oash		SCO OA (curses) Shell
   posix		IEEE 1003.2 Shell Standard
-  wsh		? Shell")
+  wsh		? Shell"
+  :type '(repeat (cons symbol symbol))
+  :group 'sh-script)
 
 
-(defvar sh-alias-alist
+(defcustom sh-alias-alist
   ;; XEmacs: Linux is spelled `linux'
   (nconc (if (eq system-type 'linux)
 	     '((csh . tcsh)
@@ -150,14 +167,18 @@
 	   (sh5 . sh)))
   "*Alist for transforming shell names to what they really are.
 Use this where the name of the executable doesn't correspond to the type of
-shell it really is.")
+shell it really is."
+  :type '(repeat (cons symbol symbol))
+  :group 'sh-script)
 
 
-(defvar sh-shell-file (or (getenv "SHELL") "/bin/sh")
-  "*The executable file name for the shell being programmed.")
+(defcustom sh-shell-file (or (getenv "SHELL") "/bin/sh")
+  "*The executable file name for the shell being programmed."
+  :type 'string
+  :group 'sh-script)
 
 
-(defvar sh-shell-arg
+(defcustom sh-shell-arg
   ;; bash does not need any options when run in a shell script,
   '((bash)
     (csh . "-f")
@@ -171,7 +192,14 @@
     (wksh)
     ;; -f means don't run .zshrc.
     (zsh . "-f"))
-  "*Single argument string for the magic number.  See `sh-feature'.")
+  "*Single argument string for the magic number.  See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice (const :tag "No Arguments" nil)
+			       (string :tag "Arguments")
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 (defvar sh-shell-variables nil
   "Alist of shell variable names that should be included in completion.
@@ -315,33 +343,47 @@
 
 
 
-(defvar sh-dynamic-complete-functions
+(defcustom sh-dynamic-complete-functions
   '(shell-dynamic-complete-environment-variable
     shell-dynamic-complete-command
     comint-dynamic-complete-filename)
-  "*Functions for doing TAB dynamic completion.")
+  "*Functions for doing TAB dynamic completion."
+  :type '(repeat function)
+  :group 'sh-script)
 
 
-(defvar sh-require-final-newline
+(defcustom sh-require-final-newline
   '((csh . t)
     (pdksh . t)
     (rc eval . require-final-newline)
     (sh eval . require-final-newline))
   "*Value of `require-final-newline' in Shell-Script mode buffers.
-See `sh-feature'.")
+See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice (const :tag "require" t)
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 
-(defvar sh-comment-prefix
+(defcustom sh-comment-prefix
   '((csh . "\\(^\\|[^$]\\|\\$[^{]\\)")
     (rc eval identity csh)
     (sh . "\\(^\\|[ \t|&;()]\\)"))
   "*Regexp matching what may come before a comment `#'.
 This must contain one \\(grouping\\) since it is the basis for fontifying
 comments as well as for `comment-start-skip'.
-See `sh-feature'.")
+See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice regexp
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 
-(defvar sh-assignment-regexp
+(defcustom sh-assignment-regexp
   '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
     ;; actually spaces are only supported in let/(( ... ))
     (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=")
@@ -349,15 +391,25 @@
     (sh . "\\<\\([a-zA-Z0-9_]+\\)="))
   "*Regexp for the variable name and what may follow in an assignment.
 First grouping matches the variable name.  This is upto and including the `='
-sign.  See `sh-feature'.")
+sign.  See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice regexp
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 
-(defvar sh-indentation 4
-  "The width for further indentation in Shell-Script mode.")
+(defcustom sh-indentation 4
+  "The width for further indentation in Shell-Script mode."
+  :type 'integer
+  :group 'sh-script)
 
 
-(defvar sh-remember-variable-min 3
-  "*Don't remember variables less than this length for completing reads.")
+(defcustom sh-remember-variable-min 3
+  "*Don't remember variables less than this length for completing reads."
+  :type 'integer
+  :group 'sh-script)
 
 
 (defvar sh-header-marker nil
@@ -365,16 +417,20 @@
 That command is also used for setting this variable.")
 
 
-(defvar sh-beginning-of-command
+(defcustom sh-beginning-of-command
   "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~a-zA-Z0-9:]\\)"
   "*Regexp to determine the beginning of a shell command.
-The actual command starts at the beginning of the second \\(grouping\\).")
+The actual command starts at the beginning of the second \\(grouping\\)."
+  :type 'regexp
+  :group 'sh-script)
 
 
-(defvar sh-end-of-command
+(defcustom sh-end-of-command
   "\\([/~a-zA-Z0-9:]\\)[ \t]*\\([;#)}`|&]\\|$\\)"
   "*Regexp to determine the end of a shell command.
-The actual command ends at the end of the first \\(grouping\\).")
+The actual command ends at the end of the first \\(grouping\\)."
+  :type 'regexp
+  :group 'sh-script)
 
 
 
@@ -387,7 +443,9 @@
   "Initial input in Bourne if, while and until skeletons.  See `sh-feature'.")
 
 
-(defvar sh-builtins
+;; customized this out of sheer bravado.  not for the faint of heart.
+;; but it *did* have an asterisk in the docstring!
+(defcustom sh-builtins
   '((bash eval sh-append posix
 	  "alias" "bg" "bind" "builtin" "declare" "dirs" "enable" "fc" "fg"
 	  "help" "history" "jobs" "kill" "let" "local" "popd" "pushd" "source"
@@ -450,11 +508,17 @@
 	 "which"))
   "*List of all shell builtins for completing read and fontification.
 Note that on some systems not all builtins are available or some are
-implemented as aliases.  See `sh-feature'.")
+implemented as aliases.  See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice (repeat string)
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 
 
-(defvar sh-leading-keywords
+(defcustom sh-leading-keywords
   '((csh "else")
 
     (es "true" "unwind-protect" "whatis")
@@ -465,10 +529,16 @@
   "*List of keywords that may be immediately followed by a builtin or keyword.
 Given some confusion between keywords and builtins depending on shell and
 system, the distinction here has been based on whether they influence the
-flow of control or syntax.  See `sh-feature'.")
+flow of control or syntax.  See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice (repeat string)
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)
 
 
-(defvar sh-other-keywords
+(defcustom sh-other-keywords
   '((bash eval sh-append bourne
 	  "bye" "logout")
 
@@ -495,7 +565,13 @@
     (zsh eval sh-append bash
 	 "select"))
   "*List of keywords not in `sh-leading-keywords'.
-See `sh-feature'.")
+See `sh-feature'."
+  :type '(repeat (cons (symbol :tag "Shell")
+		       (choice (repeat string)
+			       (cons :format "Evaluate: %v"
+				     (const :format "" eval)
+				     sexp))))
+  :group 'sh-script)