comparison lisp/comint.el @ 17428:653c0e2e1b31

Add defgroup's; use defcustom for user vars.
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Apr 1997 02:39:56 +0000
parents b177ee3c4f0e
children 5eb28dcbdb71
comparison
equal deleted inserted replaced
17427:73105a5495d9 17428:653c0e2e1b31
135 ;; Comint mode non-buffer local variables: 135 ;; Comint mode non-buffer local variables:
136 ;; comint-completion-addsuffix boolean/cons For file name 136 ;; comint-completion-addsuffix boolean/cons For file name
137 ;; comint-completion-autolist boolean completion behavior 137 ;; comint-completion-autolist boolean completion behavior
138 ;; comint-completion-recexact boolean ... 138 ;; comint-completion-recexact boolean ...
139 139
140 (defgroup comint nil
141 "General command interpreter in a window stuff."
142 :group 'processes)
143
144 (defgroup comint-completion nil
145 "Completion facilities in comint"
146 :group 'comint)
147
148 (defgroup comint-source nil
149 "Source finding facilities in comint"
150 :prefix "comint-"
151 :group 'comint)
152
153
140 (defvar comint-prompt-regexp "^" 154 (defvar comint-prompt-regexp "^"
141 "Regexp to recognise prompts in the inferior process. 155 "Regexp to recognise prompts in the inferior process.
142 Defaults to \"^\", the null string at BOL. 156 Defaults to \"^\", the null string at BOL.
143 157
144 Good choices: 158 Good choices:
160 174
161 For shells, a good value is (?\\| ?& ?< ?> ?\\( ?\\) ?;). 175 For shells, a good value is (?\\| ?& ?< ?> ?\\( ?\\) ?;).
162 176
163 This is a good thing to set in mode hooks.") 177 This is a good thing to set in mode hooks.")
164 178
165 (defvar comint-input-autoexpand nil 179 (defcustom comint-input-autoexpand nil
166 "*If non-nil, expand input command history references on completion. 180 "*If non-nil, expand input command history references on completion.
167 This mirrors the optional behavior of tcsh (its autoexpand and histlit). 181 This mirrors the optional behavior of tcsh (its autoexpand and histlit).
168 182
169 If the value is `input', then the expansion is seen on input. 183 If the value is `input', then the expansion is seen on input.
170 If the value is `history', then the expansion is only when inserting 184 If the value is `history', then the expansion is only when inserting
171 into the buffer's input ring. See also `comint-magic-space' and 185 into the buffer's input ring. See also `comint-magic-space' and
172 `comint-dynamic-complete'. 186 `comint-dynamic-complete'.
173 187
174 This variable is buffer-local.") 188 This variable is buffer-local."
175 189 :type '(choice (const :tag "off" nil)
176 (defvar comint-input-ignoredups nil 190 (const :tag "on" t)
191 (const input)
192 (const history))
193 :group 'comint)
194
195 (defface comint-input-face '((((class color)
196 (background dark))
197 (:foreground "red"))
198 (((class color)
199 (background light))
200 (:foreground "blue"))
201 (t
202 (:bold t)))
203 "How to display user input for comint shells."
204 :group 'comint)
205
206 (defcustom comint-input-ignoredups nil
177 "*If non-nil, don't add input matching the last on the input ring. 207 "*If non-nil, don't add input matching the last on the input ring.
178 This mirrors the optional behavior of bash. 208 This mirrors the optional behavior of bash.
179 209
180 This variable is buffer-local.") 210 This variable is buffer-local."
181 211 :type 'boolean
182 (defvar comint-input-ring-file-name nil 212 :group 'comint)
213
214 (defcustom comint-input-ring-file-name nil
183 "*If non-nil, name of the file to read/write input history. 215 "*If non-nil, name of the file to read/write input history.
184 See also `comint-read-input-ring' and `comint-write-input-ring'. 216 See also `comint-read-input-ring' and `comint-write-input-ring'.
185 217
186 This variable is buffer-local, and is a good thing to set in mode hooks.") 218 This variable is buffer-local, and is a good thing to set in mode hooks."
187 219 :type 'boolean
188 (defvar comint-scroll-to-bottom-on-input nil 220 :group 'comint)
221
222 (defcustom comint-scroll-to-bottom-on-input nil
189 "*Controls whether input to interpreter causes window to scroll. 223 "*Controls whether input to interpreter causes window to scroll.
190 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. 224 If nil, then do not scroll. If t or `all', scroll all windows showing buffer.
191 If `this', scroll only the selected window. 225 If `this', scroll only the selected window.
192 226
193 The default is nil. 227 The default is nil.
194 228
195 See `comint-preinput-scroll-to-bottom'. This variable is buffer-local.") 229 See `comint-preinput-scroll-to-bottom'. This variable is buffer-local."
196 230 :type '(choice (const :tag "off" nil)
197 (defvar comint-scroll-to-bottom-on-output nil 231 (const t)
232 (const all)
233 (const this))
234 :group 'comint)
235
236 (defcustom comint-scroll-to-bottom-on-output nil
198 "*Controls whether interpreter output causes window to scroll. 237 "*Controls whether interpreter output causes window to scroll.
199 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. 238 If nil, then do not scroll. If t or `all', scroll all windows showing buffer.
200 If `this', scroll only the selected window. 239 If `this', scroll only the selected window.
201 If `others', scroll only those that are not the selected window. 240 If `others', scroll only those that are not the selected window.
202 241
203 The default is nil. 242 The default is nil.
204 243
205 See variable `comint-scroll-show-maximum-output' and function 244 See variable `comint-scroll-show-maximum-output' and function
206 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local.") 245 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local."
207 246 :type '(choice (const :tag "off" nil)
208 (defvar comint-scroll-show-maximum-output nil 247 (const t)
248 (const all)
249 (const this)
250 (const others))
251 :group 'comint)
252
253 (defcustom comint-scroll-show-maximum-output nil
209 "*Controls how interpreter output causes window to scroll. 254 "*Controls how interpreter output causes window to scroll.
210 If non-nil, then show the maximum output when the window is scrolled. 255 If non-nil, then show the maximum output when the window is scrolled.
211 256
212 See variable `comint-scroll-to-bottom-on-output' and function 257 See variable `comint-scroll-to-bottom-on-output' and function
213 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local.") 258 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local."
214 259 :type 'boolean
215 (defvar comint-buffer-maximum-size 1024 260 :group 'comint)
261
262 (defcustom comint-buffer-maximum-size 1024
216 "*The maximum size in lines for comint buffers. 263 "*The maximum size in lines for comint buffers.
217 Comint buffers are truncated from the top to be no greater than this number, if 264 Comint buffers are truncated from the top to be no greater than this number, if
218 the function `comint-truncate-buffer' is on `comint-output-filter-functions'.") 265 the function `comint-truncate-buffer' is on `comint-output-filter-functions'."
266 :type 'integer
267 :group 'comint)
219 268
220 (defvar comint-input-ring-size 32 269 (defvar comint-input-ring-size 32
221 "Size of input history ring.") 270 "Size of input history ring.")
222 271
223 (defvar comint-process-echoes nil 272 (defcustom comint-process-echoes nil
224 "*If non-nil, assume that the subprocess echoes any input. 273 "*If non-nil, assume that the subprocess echoes any input.
225 If so, delete one copy of the input so that only one copy eventually 274 If so, delete one copy of the input so that only one copy eventually
226 appears in the buffer. 275 appears in the buffer.
227 276
228 This variable is buffer-local.") 277 This variable is buffer-local."
229 278 :type 'boolean
230 (defvar comint-password-prompt-regexp 279 :group 'comint)
280
281 ;; AIX puts the name of the person being su'd to in from of the prompt.
282 (defcustom comint-password-prompt-regexp
231 "\\(\\([Oo]ld \\|[Nn]ew \\|'s \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'" 283 "\\(\\([Oo]ld \\|[Nn]ew \\|'s \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'"
232 "*Regexp matching prompts for passwords in the inferior process. 284 "*Regexp matching prompts for passwords in the inferior process.
233 This is used by `comint-watch-for-password-prompt'.") 285 This is used by `comint-watch-for-password-prompt'."
286 :type 'regexp
287 :group 'comint)
234 288
235 ;; Here are the per-interpreter hooks. 289 ;; Here are the per-interpreter hooks.
236 (defvar comint-get-old-input (function comint-get-old-input-default) 290 (defvar comint-get-old-input (function comint-get-old-input-default)
237 "Function that returns old text in comint mode. 291 "Function that returns old text in comint mode.
238 This function is called when return is typed while the point is in old text. 292 This function is called when return is typed while the point is in old text.
239 It returns the text to be submitted as process input. The default is 293 It returns the text to be submitted as process input. The default is
240 `comint-get-old-input-default', which grabs the current line, and strips off 294 `comint-get-old-input-default', which grabs the current line, and strips off
241 leading text matching `comint-prompt-regexp'.") 295 leading text matching `comint-prompt-regexp'.")
242 296
297 ;; XEmacs - fsf doesn't have this, and I think it ought to default to 't'
298 ;; because it's good idiot-proof interface. --stig
299 (defcustom comint-append-old-input t
300 "*If nil, old text selected by \\[comint-send-input] is re-sent immediately.
301 If non-nil, the old text is appended to the end of the buffer,
302 and a prompting message is printed.
303
304 This flag does not affect the behavior of \\[comint-send-input]
305 after the process output mark."
306 :type 'boolean
307 :group 'comint)
308
243 (defvar comint-dynamic-complete-functions 309 (defvar comint-dynamic-complete-functions
244 '(comint-replace-by-expanded-history comint-dynamic-complete-filename) 310 '(comint-replace-by-expanded-history comint-dynamic-complete-filename)
245 "List of functions called to perform completion. 311 "List of functions called to perform completion.
246 Functions should return non-nil if completion was performed. 312 Functions should return non-nil if completion was performed.
247 See also `comint-dynamic-complete'. 313 See also `comint-dynamic-complete'.
275 Usually this is just `comint-simple-send', but if your mode needs to 341 Usually this is just `comint-simple-send', but if your mode needs to
276 massage the input string, put a different function here. 342 massage the input string, put a different function here.
277 `comint-simple-send' just sends the string plus a newline. 343 `comint-simple-send' just sends the string plus a newline.
278 This is called from the user command `comint-send-input'.") 344 This is called from the user command `comint-send-input'.")
279 345
280 (defvar comint-eol-on-send t 346 (defcustom comint-eol-on-send t
281 "*Non-nil means go to the end of the line before sending input. 347 "*Non-nil means go to the end of the line before sending input.
282 See `comint-send-input'.") 348 See `comint-send-input'."
283 349 :type 'boolean
284 (defvar comint-mode-hook '() 350 :group 'comint)
351
352 (defcustom comint-mode-hook '()
285 "Called upon entry into comint-mode 353 "Called upon entry into comint-mode
286 This is run before the process is cranked up.") 354 This is run before the process is cranked up."
287 355 :type 'hook
288 (defvar comint-exec-hook '() 356 :group 'comint)
357
358 (defcustom comint-exec-hook '()
289 "Called each time a process is exec'd by `comint-exec'. 359 "Called each time a process is exec'd by `comint-exec'.
290 This is called after the process is cranked up. It is useful for things that 360 This is called after the process is cranked up. It is useful for things that
291 must be done each time a process is executed in a comint mode buffer (e.g., 361 must be done each time a process is executed in a comint mode buffer (e.g.,
292 `(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only 362 `(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only
293 executed once when the buffer is created.") 363 executed once when the buffer is created."
364 :type 'hook
365 :group 'comint)
294 366
295 (defvar comint-mode-map nil) 367 (defvar comint-mode-map nil)
296 368
297 (defvar comint-ptyp t 369 (defvar comint-ptyp t
298 "Non-nil if communications via pty; false if by pipe. Buffer local. 370 "Non-nil if communications via pty; false if by pipe. Buffer local.
1811 ;; 'comint-dynamic-list-filename-completions))) 1883 ;; 'comint-dynamic-list-filename-completions)))
1812 ;; 1884 ;;
1813 ;; Commands like this are fine things to put in load hooks if you 1885 ;; Commands like this are fine things to put in load hooks if you
1814 ;; want them present in specific modes. 1886 ;; want them present in specific modes.
1815 1887
1816 (defvar comint-completion-autolist nil 1888 (defcustom comint-completion-autolist nil
1817 "*If non-nil, automatically list possibilities on partial completion. 1889 "*If non-nil, automatically list possibilities on partial completion.
1818 This mirrors the optional behavior of tcsh.") 1890 This mirrors the optional behavior of tcsh."
1819 1891 :type 'boolean
1820 (defvar comint-completion-addsuffix t 1892 :group 'comint-completion)
1893
1894 (defcustom comint-completion-addsuffix t
1821 "*If non-nil, add a `/' to completed directories, ` ' to file names. 1895 "*If non-nil, add a `/' to completed directories, ` ' to file names.
1822 If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where 1896 If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where
1823 DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion. 1897 DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion.
1824 This mirrors the optional behavior of tcsh.") 1898 This mirrors the optional behavior of tcsh."
1825 1899 :type 'boolean
1826 (defvar comint-completion-recexact nil 1900 :group 'comint-completion)
1901
1902 (defcustom comint-completion-recexact nil
1827 "*If non-nil, use shortest completion if characters cannot be added. 1903 "*If non-nil, use shortest completion if characters cannot be added.
1828 This mirrors the optional behavior of tcsh. 1904 This mirrors the optional behavior of tcsh.
1829 1905
1830 A non-nil value is useful if `comint-completion-autolist' is non-nil too.") 1906 A non-nil value is useful if `comint-completion-autolist' is non-nil too."
1831 1907 :type 'boolean
1832 (defvar comint-completion-fignore nil 1908 :group 'comint-completion)
1909
1910 (defcustom comint-completion-fignore nil
1833 "*List of suffixes to be disregarded during file completion. 1911 "*List of suffixes to be disregarded during file completion.
1834 This mirrors the optional behavior of bash and tcsh. 1912 This mirrors the optional behavior of bash and tcsh.
1835 1913
1836 Note that this applies to `comint-dynamic-complete-filename' only.") 1914 Note that this applies to `comint-dynamic-complete-filename' only."
1915 :type '(repeat (string :tag "Suffix"))
1916 :group 'comint-completion)
1837 1917
1838 (defvar comint-file-name-prefix "" 1918 (defvar comint-file-name-prefix ""
1839 "Prefix prepended to absolute file names taken from process input. 1919 "Prefix prepended to absolute file names taken from process input.
1840 This is used by comint's and shell's completion functions, and by shell's 1920 This is used by comint's and shell's completion functions, and by shell's
1841 directory tracking functions.") 1921 directory tracking functions.")
1847 "String of characters valid in a file name. 1927 "String of characters valid in a file name.
1848 1928
1849 This is a good thing to set in mode hooks.") 1929 This is a good thing to set in mode hooks.")
1850 1930
1851 (defvar comint-file-name-quote-list nil 1931 (defvar comint-file-name-quote-list nil
1852 "List of characters to quote with `\\' when in a file name. 1932 "List of characters to quote with `\' when in a file name.
1853 1933
1854 This is a good thing to set in mode hooks.") 1934 This is a good thing to set in mode hooks.")
1855 1935
1856 1936
1857 (defun comint-directory (directory) 1937 (defun comint-directory (directory)