;; comint-completion-autolist boolean completion behavior
;; comint-completion-recexact boolean ...
+(defgroup comint nil
+ "General command interpreter in a window stuff."
+ :group 'processes)
+
+(defgroup comint-completion nil
+ "Completion facilities in comint"
+ :group 'comint)
+
+(defgroup comint-source nil
+ "Source finding facilities in comint"
+ :prefix "comint-"
+ :group 'comint)
+
+
(defvar comint-prompt-regexp "^"
"Regexp to recognise prompts in the inferior process.
Defaults to \"^\", the null string at BOL.
This is a good thing to set in mode hooks.")
-(defvar comint-input-autoexpand nil
+(defcustom comint-input-autoexpand nil
"*If non-nil, expand input command history references on completion.
This mirrors the optional behavior of tcsh (its autoexpand and histlit).
into the buffer's input ring. See also `comint-magic-space' and
`comint-dynamic-complete'.
-This variable is buffer-local.")
-
-(defvar comint-input-ignoredups nil
+This variable is buffer-local."
+ :type '(choice (const :tag "off" nil)
+ (const :tag "on" t)
+ (const input)
+ (const history))
+ :group 'comint)
+
+(defface comint-input-face '((((class color)
+ (background dark))
+ (:foreground "red"))
+ (((class color)
+ (background light))
+ (:foreground "blue"))
+ (t
+ (:bold t)))
+ "How to display user input for comint shells."
+ :group 'comint)
+
+(defcustom comint-input-ignoredups nil
"*If non-nil, don't add input matching the last on the input ring.
This mirrors the optional behavior of bash.
-This variable is buffer-local.")
+This variable is buffer-local."
+ :type 'boolean
+ :group 'comint)
-(defvar comint-input-ring-file-name nil
+(defcustom comint-input-ring-file-name nil
"*If non-nil, name of the file to read/write input history.
See also `comint-read-input-ring' and `comint-write-input-ring'.
-This variable is buffer-local, and is a good thing to set in mode hooks.")
+This variable is buffer-local, and is a good thing to set in mode hooks."
+ :type 'boolean
+ :group 'comint)
-(defvar comint-scroll-to-bottom-on-input nil
+(defcustom comint-scroll-to-bottom-on-input nil
"*Controls whether input to interpreter causes window to scroll.
If nil, then do not scroll. If t or `all', scroll all windows showing buffer.
If `this', scroll only the selected window.
The default is nil.
-See `comint-preinput-scroll-to-bottom'. This variable is buffer-local.")
+See `comint-preinput-scroll-to-bottom'. This variable is buffer-local."
+ :type '(choice (const :tag "off" nil)
+ (const t)
+ (const all)
+ (const this))
+ :group 'comint)
-(defvar comint-scroll-to-bottom-on-output nil
+(defcustom comint-scroll-to-bottom-on-output nil
"*Controls whether interpreter output causes window to scroll.
If nil, then do not scroll. If t or `all', scroll all windows showing buffer.
If `this', scroll only the selected window.
The default is nil.
See variable `comint-scroll-show-maximum-output' and function
-`comint-postoutput-scroll-to-bottom'. This variable is buffer-local.")
-
-(defvar comint-scroll-show-maximum-output nil
+`comint-postoutput-scroll-to-bottom'. This variable is buffer-local."
+ :type '(choice (const :tag "off" nil)
+ (const t)
+ (const all)
+ (const this)
+ (const others))
+ :group 'comint)
+
+(defcustom comint-scroll-show-maximum-output nil
"*Controls how interpreter output causes window to scroll.
If non-nil, then show the maximum output when the window is scrolled.
See variable `comint-scroll-to-bottom-on-output' and function
-`comint-postoutput-scroll-to-bottom'. This variable is buffer-local.")
+`comint-postoutput-scroll-to-bottom'. This variable is buffer-local."
+ :type 'boolean
+ :group 'comint)
-(defvar comint-buffer-maximum-size 1024
+(defcustom comint-buffer-maximum-size 1024
"*The maximum size in lines for comint buffers.
Comint buffers are truncated from the top to be no greater than this number, if
-the function `comint-truncate-buffer' is on `comint-output-filter-functions'.")
+the function `comint-truncate-buffer' is on `comint-output-filter-functions'."
+ :type 'integer
+ :group 'comint)
(defvar comint-input-ring-size 32
"Size of input history ring.")
-(defvar comint-process-echoes nil
+(defcustom comint-process-echoes nil
"*If non-nil, assume that the subprocess echoes any input.
If so, delete one copy of the input so that only one copy eventually
appears in the buffer.
-This variable is buffer-local.")
+This variable is buffer-local."
+ :type 'boolean
+ :group 'comint)
-(defvar comint-password-prompt-regexp
+;; AIX puts the name of the person being su'd to in from of the prompt.
+(defcustom comint-password-prompt-regexp
"\\(\\([Oo]ld \\|[Nn]ew \\|'s \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'"
"*Regexp matching prompts for passwords in the inferior process.
-This is used by `comint-watch-for-password-prompt'.")
+This is used by `comint-watch-for-password-prompt'."
+ :type 'regexp
+ :group 'comint)
;; Here are the per-interpreter hooks.
(defvar comint-get-old-input (function comint-get-old-input-default)
`comint-get-old-input-default', which grabs the current line, and strips off
leading text matching `comint-prompt-regexp'.")
+;; XEmacs - fsf doesn't have this, and I think it ought to default to 't'
+;; because it's good idiot-proof interface. --stig
+(defcustom comint-append-old-input t
+ "*If nil, old text selected by \\[comint-send-input] is re-sent immediately.
+If non-nil, the old text is appended to the end of the buffer,
+and a prompting message is printed.
+
+This flag does not affect the behavior of \\[comint-send-input]
+after the process output mark."
+ :type 'boolean
+ :group 'comint)
+
(defvar comint-dynamic-complete-functions
'(comint-replace-by-expanded-history comint-dynamic-complete-filename)
"List of functions called to perform completion.
`comint-simple-send' just sends the string plus a newline.
This is called from the user command `comint-send-input'.")
-(defvar comint-eol-on-send t
+(defcustom comint-eol-on-send t
"*Non-nil means go to the end of the line before sending input.
-See `comint-send-input'.")
+See `comint-send-input'."
+ :type 'boolean
+ :group 'comint)
-(defvar comint-mode-hook '()
+(defcustom comint-mode-hook '()
"Called upon entry into comint-mode
-This is run before the process is cranked up.")
+This is run before the process is cranked up."
+ :type 'hook
+ :group 'comint)
-(defvar comint-exec-hook '()
+(defcustom comint-exec-hook '()
"Called each time a process is exec'd by `comint-exec'.
This is called after the process is cranked up. It is useful for things that
must be done each time a process is executed in a comint mode buffer (e.g.,
`(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only
-executed once when the buffer is created.")
+executed once when the buffer is created."
+ :type 'hook
+ :group 'comint)
(defvar comint-mode-map nil)
;; Commands like this are fine things to put in load hooks if you
;; want them present in specific modes.
-(defvar comint-completion-autolist nil
+(defcustom comint-completion-autolist nil
"*If non-nil, automatically list possibilities on partial completion.
-This mirrors the optional behavior of tcsh.")
+This mirrors the optional behavior of tcsh."
+ :type 'boolean
+ :group 'comint-completion)
-(defvar comint-completion-addsuffix t
+(defcustom comint-completion-addsuffix t
"*If non-nil, add a `/' to completed directories, ` ' to file names.
If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where
DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion.
-This mirrors the optional behavior of tcsh.")
+This mirrors the optional behavior of tcsh."
+ :type 'boolean
+ :group 'comint-completion)
-(defvar comint-completion-recexact nil
+(defcustom comint-completion-recexact nil
"*If non-nil, use shortest completion if characters cannot be added.
This mirrors the optional behavior of tcsh.
-A non-nil value is useful if `comint-completion-autolist' is non-nil too.")
+A non-nil value is useful if `comint-completion-autolist' is non-nil too."
+ :type 'boolean
+ :group 'comint-completion)
-(defvar comint-completion-fignore nil
+(defcustom comint-completion-fignore nil
"*List of suffixes to be disregarded during file completion.
This mirrors the optional behavior of bash and tcsh.
-Note that this applies to `comint-dynamic-complete-filename' only.")
+Note that this applies to `comint-dynamic-complete-filename' only."
+ :type '(repeat (string :tag "Suffix"))
+ :group 'comint-completion)
(defvar comint-file-name-prefix ""
"Prefix prepended to absolute file names taken from process input.
This is a good thing to set in mode hooks.")
(defvar comint-file-name-quote-list nil
- "List of characters to quote with `\\' when in a file name.
+ "List of characters to quote with `\' when in a file name.
This is a good thing to set in mode hooks.")
;;; shell.el --- specialized comint.el for running the shell.
-;; Copyright (C) 1988, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
;; Author: Olin Shivers <shivers@cs.cmu.edu>
;; Maintainer: Simon Marshall <simon@gnu.ai.mit.edu>
;;; Customization and Buffer Variables
+(defgroup shell nil
+ "Running shell from within Emacs buffers"
+ :group 'processes
+ :group 'unix)
+
+(defgroup shell-directories nil
+ "Directory support in shell mode"
+ :group 'shell)
+
+(defgroup shell-faces nil
+ "Faces in shell buffers"
+ :group 'shell)
+
;;;###autoload
(defvar shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
"Regexp to match prompts in the inferior shell.
This is a fine thing to set in your `.emacs' file.")
-(defvar shell-completion-fignore nil
+(defcustom shell-completion-fignore nil
"*List of suffixes to be disregarded during file/command completion.
This variable is used to initialize `comint-completion-fignore' in the shell
buffer. The default is nil, for compatibility with most shells.
Some people like (\"~\" \"#\" \"%\").
-This is a fine thing to set in your `.emacs' file.")
+This is a fine thing to set in your `.emacs' file."
+ :type '(repeat (string :tag "Suffix"))
+ :group 'shell)
(defvar shell-delimiter-argument-list '(?\| ?& ?< ?> ?\( ?\) ?\;)
"List of characters to recognise as separate arguments.
This is a fine thing to set in your `.emacs' file.")
-(defvar shell-command-regexp "[^;&|\n]+"
+(defcustom shell-command-regexp "[^;&|\n]+"
"*Regexp to match a single command within a pipeline.
-This is used for directory tracking and does not do a perfect job.")
+This is used for directory tracking and does not do a perfect job."
+ :type 'regexp
+ :group 'shell)
-(defvar shell-completion-execonly t
+(defcustom shell-completion-execonly t
"*If non-nil, use executable files only for completion candidates.
This mirrors the optional behavior of tcsh.
-Detecting executability of files may slow command completion considerably.")
+Detecting executability of files may slow command completion considerably."
+ :type 'boolean
+ :group 'shell)
-(defvar shell-popd-regexp "popd"
- "*Regexp to match subshell commands equivalent to popd.")
+(defcustom shell-popd-regexp "popd"
+ "*Regexp to match subshell commands equivalent to popd."
+ :type 'regexp
+ :group 'shell-directories)
-(defvar shell-pushd-regexp "pushd"
- "*Regexp to match subshell commands equivalent to pushd.")
+(defcustom shell-pushd-regexp "pushd"
+ "*Regexp to match subshell commands equivalent to pushd."
+ :type 'regexp
+ :group 'shell-directories)
-(defvar shell-pushd-tohome nil
+(defcustom shell-pushd-tohome nil
"*If non-nil, make pushd with no arg behave as \"pushd ~\" (like cd).
-This mirrors the optional behavior of tcsh.")
+This mirrors the optional behavior of tcsh."
+ :type 'boolean
+ :group 'shell-directories)
-(defvar shell-pushd-dextract nil
+(defcustom shell-pushd-dextract nil
"*If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
-This mirrors the optional behavior of tcsh.")
+This mirrors the optional behavior of tcsh."
+ :type 'boolean
+ :group 'shell-directories)
-(defvar shell-pushd-dunique nil
+(defcustom shell-pushd-dunique nil
"*If non-nil, make pushd only add unique directories to the stack.
-This mirrors the optional behavior of tcsh.")
+This mirrors the optional behavior of tcsh."
+ :type 'boolean
+ :group 'shell-directories)
-(defvar shell-cd-regexp "cd"
- "*Regexp to match subshell commands equivalent to cd.")
+(defcustom shell-cd-regexp "cd"
+ "*Regexp to match subshell commands equivalent to cd."
+ :type 'regexp
+ :group 'shell-directories)
-(defvar shell-chdrive-regexp
+(defcustom shell-chdrive-regexp
(if (memq system-type '(ms-dos windows-nt))
; NetWare allows the five chars between upper and lower alphabetics.
"[]a-zA-Z^_`\\[\\\\]:"
nil)
- "*If non-nil, is regexp used to track drive changes.")
+ "*If non-nil, is regexp used to track drive changes."
+ :type 'regexp
+ :group 'shell-directories)
-(defvar explicit-shell-file-name nil
- "*If non-nil, is file name to use for explicitly requested inferior shell.")
+(defcustom explicit-shell-file-name nil
+ "*If non-nil, is file name to use for explicitly requested inferior shell."
+ :type '(choice (const :tag "None" nil) file)
+ :group 'shell)
-(defvar explicit-csh-args
+(defcustom explicit-csh-args
(if (eq system-type 'hpux)
;; -T persuades HP's csh not to think it is smarter
;; than us about what terminal modes to use.
'("-i" "-T")
'("-i"))
"*Args passed to inferior shell by M-x shell, if the shell is csh.
-Value is a list of strings, which may be nil.")
+Value is a list of strings, which may be nil."
+ :type '(repeat (string :tag "Argument"))
+ :group 'shell)
-(defvar shell-input-autoexpand 'history
+(defcustom shell-input-autoexpand 'history
"*If non-nil, expand input command history references on completion.
This mirrors the optional behavior of tcsh (its autoexpand and histlit).
`comint-dynamic-complete'.
This variable supplies a default for `comint-input-autoexpand',
-for Shell mode only.")
+for Shell mode only."
+ :type '(choice (const nil) (const input) (const history))
+ :type 'shell)
(defvar shell-dirstack nil
"List of directories saved by pushd in this buffer's shell.
shell-replace-by-expanded-directory)
'complete-expand)))
-(defvar shell-mode-hook '()
- "*Hook for customising Shell mode.")
+(defcustom shell-mode-hook '()
+ "*Hook for customising Shell mode."
+ :type 'hook
+ :group 'shell)
(defvar shell-font-lock-keywords
(list (cons shell-prompt-pattern 'font-lock-keyword-face)