Mercurial > hg > xemacs-beta
comparison lisp/comint/comint.el @ 134:34a5b81f86ba r20-2b1
Import from CVS: tag r20-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:30:11 +0200 |
parents | 48d667d6f17f |
children | b980b6286996 |
comparison
equal
deleted
inserted
replaced
133:b27e67717092 | 134:34a5b81f86ba |
---|---|
146 ;;; Comint mode non-buffer local variables: | 146 ;;; Comint mode non-buffer local variables: |
147 ;;; comint-completion-addsuffix - boolean/cons For file name completion | 147 ;;; comint-completion-addsuffix - boolean/cons For file name completion |
148 ;;; comint-completion-autolist - boolean behavior | 148 ;;; comint-completion-autolist - boolean behavior |
149 ;;; comint-completion-recexact - boolean ... | 149 ;;; comint-completion-recexact - boolean ... |
150 | 150 |
151 (defgroup comint nil | |
152 "General command interpreter in a window stuff." | |
153 :group 'processes) | |
154 | |
155 (defgroup comint-completion nil | |
156 "Completion facilities in comint" | |
157 :group 'comint) | |
158 | |
159 (defgroup comint-source nil | |
160 "Source finding facilities in comint" | |
161 :prefix "comint-" | |
162 :group 'comint) | |
163 | |
164 | |
151 (defvar comint-prompt-regexp "^" | 165 (defvar comint-prompt-regexp "^" |
152 "Regexp to recognise prompts in the inferior process. | 166 "Regexp to recognise prompts in the inferior process. |
153 Defaults to \"^\", the null string at BOL. | 167 Defaults to \"^\", the null string at BOL. |
154 | 168 |
155 Good choices: | 169 Good choices: |
180 ;; find /tmp \( -name foo \) -print | 194 ;; find /tmp \( -name foo \) -print |
181 ;; one gets find /tmp \ ( -name foo \ ) -print | 195 ;; one gets find /tmp \ ( -name foo \ ) -print |
182 ;; | 196 ;; |
183 ;; XEmacs - So turn this off by default. -- jwz | 197 ;; XEmacs - So turn this off by default. -- jwz |
184 ;; | 198 ;; |
185 (defvar comint-input-autoexpand nil | 199 (defcustom comint-input-autoexpand nil |
186 "*If non-nil, expand input command history references on completion. | 200 "*If non-nil, expand input command history references on completion. |
187 This mirrors the optional behavior of tcsh (its autoexpand and histlit). | 201 This mirrors the optional behavior of tcsh (its autoexpand and histlit). |
188 | 202 |
189 If the value is `input', then the expansion is seen on input. | 203 If the value is `input', then the expansion is seen on input. |
190 If the value is `history', then the expansion is only when inserting | 204 If the value is `history', then the expansion is only when inserting |
191 into the buffer's input ring. See also `comint-magic-space' and | 205 into the buffer's input ring. See also `comint-magic-space' and |
192 `comint-dynamic-complete'. | 206 `comint-dynamic-complete'. |
193 | 207 |
194 This variable is buffer-local.") | 208 This variable is buffer-local." |
209 :type '(choice (const :tag "off" nil) | |
210 (const :tag "on" t) | |
211 (const input) | |
212 (const history)) | |
213 :group 'comint) | |
195 | 214 |
196 ;; XEmacs - this should default to t for consistency with minibuffer history. -jwz | 215 ;; XEmacs - this should default to t for consistency with minibuffer history. -jwz |
197 (defvar comint-input-ignoredups t | 216 (defcustom comint-input-ignoredups t |
198 "*If non-nil, don't add input matching the last on the input ring. | 217 "*If non-nil, don't add input matching the last on the input ring. |
199 This mirrors the optional behavior of bash. | 218 This mirrors the optional behavior of bash. |
200 | 219 |
201 This variable is buffer-local.") | 220 This variable is buffer-local." |
202 | 221 :type 'boolean |
203 (defvar comint-input-ring-file-name nil | 222 :group 'comint) |
223 | |
224 (defcustom comint-input-ring-file-name nil | |
204 "*If non-nil, name of the file to read/write input history. | 225 "*If non-nil, name of the file to read/write input history. |
205 See also `comint-read-input-ring' and `comint-write-input-ring'. | 226 See also `comint-read-input-ring' and `comint-write-input-ring'. |
206 | 227 |
207 This variable is buffer-local, and is a good thing to set in mode hooks.") | 228 This variable is buffer-local, and is a good thing to set in mode hooks." |
208 | 229 :type 'boolean |
209 (defvar comint-scroll-to-bottom-on-input nil | 230 :group 'comint) |
231 | |
232 (defcustom comint-scroll-to-bottom-on-input nil | |
210 "*Controls whether input to interpreter causes window to scroll. | 233 "*Controls whether input to interpreter causes window to scroll. |
211 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. | 234 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. |
212 If `this', scroll only the selected window. | 235 If `this', scroll only the selected window. |
213 | 236 |
214 The default is nil. | 237 The default is nil. |
215 | 238 |
216 See `comint-preinput-scroll-to-bottom'. This variable is buffer-local.") | 239 See `comint-preinput-scroll-to-bottom'. This variable is buffer-local." |
217 | 240 :type '(choice (const :tag "off" nil) |
218 (defvar comint-scroll-to-bottom-on-output nil | 241 (const t) |
242 (const all) | |
243 (const this)) | |
244 :group 'comint) | |
245 | |
246 (defcustom comint-scroll-to-bottom-on-output nil | |
219 "*Controls whether interpreter output causes window to scroll. | 247 "*Controls whether interpreter output causes window to scroll. |
220 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. | 248 If nil, then do not scroll. If t or `all', scroll all windows showing buffer. |
221 If `this', scroll only the selected window. | 249 If `this', scroll only the selected window. |
222 If `others', scroll only those that are not the selected window. | 250 If `others', scroll only those that are not the selected window. |
223 | 251 |
224 The default is nil. | 252 The default is nil. |
225 | 253 |
226 See variable `comint-scroll-show-maximum-output' and function | 254 See variable `comint-scroll-show-maximum-output' and function |
227 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local.") | 255 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local." |
256 :type '(choice (const :tag "off" nil) | |
257 (const t) | |
258 (const all) | |
259 (const this) | |
260 (const others)) | |
261 :group 'comint) | |
228 | 262 |
229 ;; XEmacs - Default this to nil: this is just horrible | 263 ;; XEmacs - Default this to nil: this is just horrible |
230 (defvar comint-scroll-show-maximum-output nil | 264 (defcustom comint-scroll-show-maximum-output nil |
231 "*Controls how interpreter output causes window to scroll. | 265 "*Controls how interpreter output causes window to scroll. |
232 If non-nil, then show the maximum output when the window is scrolled. | 266 If non-nil, then show the maximum output when the window is scrolled. |
233 | 267 |
234 See variable `comint-scroll-to-bottom-on-output' and function | 268 See variable `comint-scroll-to-bottom-on-output' and function |
235 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local.") | 269 `comint-postoutput-scroll-to-bottom'. This variable is buffer-local." |
236 | 270 :type 'boolean |
237 (defvar comint-buffer-maximum-size 1024 | 271 :group 'comint) |
272 | |
273 (defcustom comint-buffer-maximum-size 1024 | |
238 "*The maximum size in lines for comint buffers. | 274 "*The maximum size in lines for comint buffers. |
239 Comint buffers are truncated from the top to be no greater than this number, if | 275 Comint buffers are truncated from the top to be no greater than this number, if |
240 the function `comint-truncate-buffer' is on `comint-output-filter-functions'.") | 276 the function `comint-truncate-buffer' is on `comint-output-filter-functions'." |
277 :type 'integer | |
278 :group 'comint) | |
241 | 279 |
242 (defvar comint-input-ring-size 32 | 280 (defvar comint-input-ring-size 32 |
243 "Size of input history ring.") | 281 "Size of input history ring.") |
244 | 282 |
245 (defvar comint-process-echoes nil | 283 (defcustom comint-process-echoes nil |
246 "*If non-nil, assume that the subprocess echoes any input. | 284 "*If non-nil, assume that the subprocess echoes any input. |
247 If so, delete one copy of the input so that only one copy eventually | 285 If so, delete one copy of the input so that only one copy eventually |
248 appears in the buffer. | 286 appears in the buffer. |
249 | 287 |
250 This variable is buffer-local.") | 288 This variable is buffer-local." |
289 :type 'boolean | |
290 :group 'comint) | |
251 | 291 |
252 ;; AIX puts the name of the person being su'd to in from of the prompt. | 292 ;; AIX puts the name of the person being su'd to in from of the prompt. |
253 (defvar comint-password-prompt-regexp | 293 (defcustom comint-password-prompt-regexp |
254 (if (eq system-type 'aix-v3) | 294 (if (eq system-type 'aix-v3) |
255 "\\(\\([Oo]ld \\|[Nn]ew \\|^\\|^..*s\\)[Pp]assword\\|pass phrase\\):\\s *\\'" | 295 "\\(\\([Oo]ld \\|[Nn]ew \\|^\\|^..*s\\)[Pp]assword\\|pass phrase\\):\\s *\\'" |
256 "\\(\\([Oo]ld \\|[Nn]ew \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'") | 296 "\\(\\([Oo]ld \\|[Nn]ew \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'") |
257 "*Regexp matching prompts for passwords in the inferior process. | 297 "*Regexp matching prompts for passwords in the inferior process. |
258 This is used by `comint-watch-for-password-prompt'.") | 298 This is used by `comint-watch-for-password-prompt'." |
299 :type 'regexp | |
300 :group 'comint) | |
259 | 301 |
260 ;;; Here are the per-interpreter hooks. | 302 ;;; Here are the per-interpreter hooks. |
261 (defvar comint-get-old-input (function comint-get-old-input-default) | 303 (defvar comint-get-old-input (function comint-get-old-input-default) |
262 "Function that returns old text in comint mode. | 304 "Function that returns old text in comint mode. |
263 This function is called when return is typed while the point is in old text. | 305 This function is called when return is typed while the point is in old text. |
265 `comint-get-old-input-default', which grabs the current line, and strips off | 307 `comint-get-old-input-default', which grabs the current line, and strips off |
266 leading text matching `comint-prompt-regexp'.") | 308 leading text matching `comint-prompt-regexp'.") |
267 | 309 |
268 ;; XEmacs - fsf doesn't have this, and I think it ought to default to 't' | 310 ;; XEmacs - fsf doesn't have this, and I think it ought to default to 't' |
269 ;; because it's good idiot-proof interface. --stig | 311 ;; because it's good idiot-proof interface. --stig |
270 (defvar comint-append-old-input t | 312 (defcustom comint-append-old-input t |
271 "*If nil, old text selected by \\[comint-send-input] is re-sent immediately. | 313 "*If nil, old text selected by \\[comint-send-input] is re-sent immediately. |
272 If non-nil, the old text is appended to the end of the buffer, | 314 If non-nil, the old text is appended to the end of the buffer, |
273 and a prompting message is printed. | 315 and a prompting message is printed. |
274 | 316 |
275 This flag does not affect the behavior of \\[comint-send-input] | 317 This flag does not affect the behavior of \\[comint-send-input] |
276 after the process output mark.") | 318 after the process output mark." |
319 :type 'boolean | |
320 :group 'comint) | |
277 | 321 |
278 (defvar comint-dynamic-complete-functions | 322 (defvar comint-dynamic-complete-functions |
279 '(comint-replace-by-expanded-history comint-dynamic-complete-filename) | 323 '(comint-replace-by-expanded-history comint-dynamic-complete-filename) |
280 "List of functions called to perform completion. | 324 "List of functions called to perform completion. |
281 Functions should return non-nil if completion was performed. | 325 Functions should return non-nil if completion was performed. |
313 Usually this is just `comint-simple-send', but if your mode needs to | 357 Usually this is just `comint-simple-send', but if your mode needs to |
314 massage the input string, put a different function here. | 358 massage the input string, put a different function here. |
315 `comint-simple-send' just sends the string plus a newline. | 359 `comint-simple-send' just sends the string plus a newline. |
316 This is called from the user command `comint-send-input'.") | 360 This is called from the user command `comint-send-input'.") |
317 | 361 |
318 (defvar comint-eol-on-send t | 362 (defcustom comint-eol-on-send t |
319 "*Non-nil means go to the end of the line before sending input. | 363 "*Non-nil means go to the end of the line before sending input. |
320 See `comint-send-input'.") | 364 See `comint-send-input'." |
321 | 365 :type 'boolean |
322 (defvar comint-mode-hook '() | 366 :group 'comint) |
367 | |
368 (defcustom comint-mode-hook '() | |
323 "Called upon entry into comint-mode | 369 "Called upon entry into comint-mode |
324 This is run before the process is cranked up.") | 370 This is run before the process is cranked up." |
325 | 371 :type 'hook |
326 (defvar comint-exec-hook '() | 372 :group 'comint) |
373 | |
374 (defcustom comint-exec-hook '() | |
327 "Called each time a process is exec'd by `comint-exec'. | 375 "Called each time a process is exec'd by `comint-exec'. |
328 This is called after the process is cranked up. It is useful for things that | 376 This is called after the process is cranked up. It is useful for things that |
329 must be done each time a process is executed in a comint mode buffer (e.g., | 377 must be done each time a process is executed in a comint mode buffer (e.g., |
330 `(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only | 378 `(process-kill-without-query)'). In contrast, the `comint-mode-hook' is only |
331 executed once when the buffer is created.") | 379 executed once when the buffer is created." |
380 :type 'hook | |
381 :group 'comint) | |
332 | 382 |
333 (defvar comint-mode-map nil) | 383 (defvar comint-mode-map nil) |
334 | 384 |
335 (defvar comint-ptyp t | 385 (defvar comint-ptyp t |
336 "Non-nil if communications via pty; false if by pipe. Buffer local. | 386 "Non-nil if communications via pty; false if by pipe. Buffer local. |
584 (popup-menu (if history | 634 (popup-menu (if history |
585 (append comint-popup-menu | 635 (append comint-popup-menu |
586 (list "---" (cons "Command History" history))) | 636 (list "---" (cons "Command History" history))) |
587 comint-popup-menu)))) | 637 comint-popup-menu)))) |
588 | 638 |
589 (defvar comint-history-menu-max 40 | 639 (defcustom comint-history-menu-max 40 |
590 "*Maximum number of entries to display on the Comint command-history menu.") | 640 "*Maximum number of entries to display on the Comint command-history menu." |
641 :type 'integer | |
642 :group 'comint) | |
591 | 643 |
592 (defun comint-history-menu-filter (menu) | 644 (defun comint-history-menu-filter (menu) |
593 (append menu (comint-make-history-menu))) | 645 (append menu (comint-make-history-menu))) |
594 | 646 |
595 (defun comint-make-history-menu () | 647 (defun comint-make-history-menu () |
2029 ;;; 'comint-dynamic-list-filename-completions))) | 2081 ;;; 'comint-dynamic-list-filename-completions))) |
2030 ;;; | 2082 ;;; |
2031 ;;; Commands like this are fine things to put in load hooks if you | 2083 ;;; Commands like this are fine things to put in load hooks if you |
2032 ;;; want them present in specific modes. | 2084 ;;; want them present in specific modes. |
2033 | 2085 |
2034 (defvar comint-completion-autolist nil | 2086 (defcustom comint-completion-autolist nil |
2035 "*If non-nil, automatically list possibilities on partial completion. | 2087 "*If non-nil, automatically list possibilities on partial completion. |
2036 This mirrors the optional behavior of tcsh.") | 2088 This mirrors the optional behavior of tcsh." |
2037 | 2089 :type 'boolean |
2038 (defvar comint-completion-addsuffix t | 2090 :group 'comint-completion) |
2091 | |
2092 (defcustom comint-completion-addsuffix t | |
2039 "*If non-nil, add a `/' to completed directories, ` ' to file names. | 2093 "*If non-nil, add a `/' to completed directories, ` ' to file names. |
2040 If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where | 2094 If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where |
2041 DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion. | 2095 DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion. |
2042 This mirrors the optional behavior of tcsh.") | 2096 This mirrors the optional behavior of tcsh." |
2043 | 2097 :type 'boolean |
2044 (defvar comint-completion-recexact nil | 2098 :group 'comint-completion) |
2099 | |
2100 (defcustom comint-completion-recexact nil | |
2045 "*If non-nil, use shortest completion if characters cannot be added. | 2101 "*If non-nil, use shortest completion if characters cannot be added. |
2046 This mirrors the optional behavior of tcsh. | 2102 This mirrors the optional behavior of tcsh. |
2047 | 2103 |
2048 A non-nil value is useful if `comint-completion-autolist' is non-nil too.") | 2104 A non-nil value is useful if `comint-completion-autolist' is non-nil too." |
2049 | 2105 :type 'boolean |
2050 (defvar comint-completion-fignore nil | 2106 :group 'comint-completion) |
2107 | |
2108 (defcustom comint-completion-fignore nil | |
2051 "*List of suffixes to be disregarded during file completion. | 2109 "*List of suffixes to be disregarded during file completion. |
2052 This mirrors the optional behavior of bash and tcsh. | 2110 This mirrors the optional behavior of bash and tcsh. |
2053 | 2111 |
2054 Note that this applies to `comint-dynamic-complete-filename' only.") | 2112 Note that this applies to `comint-dynamic-complete-filename' only." |
2113 :type '(repeat (string :tag "Suffix")) | |
2114 :group 'comint-completion) | |
2055 | 2115 |
2056 (defvar comint-file-name-prefix "" | 2116 (defvar comint-file-name-prefix "" |
2057 "Prefix prepended to absolute file names taken from process input. | 2117 "Prefix prepended to absolute file names taken from process input. |
2058 This is used by comint's and shell's completion functions, and by shell's | 2118 This is used by comint's and shell's completion functions, and by shell's |
2059 directory tracking functions.") | 2119 directory tracking functions.") |
2517 )))) | 2577 )))) |
2518 ))) | 2578 ))) |
2519 | 2579 |
2520 ;;; Commands for extracting source locations: | 2580 ;;; Commands for extracting source locations: |
2521 | 2581 |
2522 (defvar comint-find-source-code-max-lines 100 | 2582 (defcustom comint-find-source-code-max-lines 100 |
2523 "*Maximum number of lines to search backward for a source location, | 2583 "*Maximum number of lines to search backward for a source location, |
2524 when using \\[comint-find-source-code\\] with an interactive prefix.") | 2584 when using \\[comint-find-source-code\\] with an interactive prefix." |
2525 | 2585 :type 'integer |
2526 (defvar comint-find-source-file-hook nil | 2586 :group 'comint-source) |
2587 | |
2588 (defcustom comint-find-source-file-hook nil | |
2527 "*Function to call instead of comint-default-find-source-file | 2589 "*Function to call instead of comint-default-find-source-file |
2528 when comint-find-source-code parses out a file name and then wants to | 2590 when comint-find-source-code parses out a file name and then wants to |
2529 visit its buffer. The sole argument is the file name. The function | 2591 visit its buffer. The sole argument is the file name. The function |
2530 must find the file, setting the current buffer, and return the file | 2592 must find the file, setting the current buffer, and return the file |
2531 name. It may also adjust the file name. If you change this variable, | 2593 name. It may also adjust the file name. If you change this variable, |
2532 make it buffer local.") | 2594 make it buffer local." |
2533 | 2595 :type 'function |
2534 (defvar comint-goto-source-line-hook nil | 2596 :group 'comint-source) |
2597 | |
2598 (defcustom comint-goto-source-line-hook nil | |
2535 "*Function to call instead of comint-default-goto-source-line | 2599 "*Function to call instead of comint-default-goto-source-line |
2536 after comint-find-source-code finds a file and then wants to | 2600 after comint-find-source-code finds a file and then wants to |
2537 go to a line number mentioned in a source location. | 2601 go to a line number mentioned in a source location. |
2538 The sole argument is the line number. The function must | 2602 The sole argument is the line number. The function must |
2539 return the line number, possibly adjusted. If you change | 2603 return the line number, possibly adjusted. If you change |
2540 this variable, make it buffer local.") | 2604 this variable, make it buffer local." |
2605 :type 'function | |
2606 :group 'comint-source) | |
2541 | 2607 |
2542 (defun comint-find-source-code (multi-line) | 2608 (defun comint-find-source-code (multi-line) |
2543 "Search backward from point for a source location. | 2609 "Search backward from point for a source location. |
2544 If a source location is found in the current line, | 2610 If a source location is found in the current line, |
2545 go to that location. | 2611 go to that location. |