Mercurial > hg > xemacs-beta
comparison lisp/comint/shell.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | ec9a17fef872 |
children | a145efe76779 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
248 (setq shell-mode-map map))) | 248 (setq shell-mode-map map))) |
249 | 249 |
250 (defvar shell-mode-hook nil | 250 (defvar shell-mode-hook nil |
251 "*Hook for customising Shell mode.") | 251 "*Hook for customising Shell mode.") |
252 | 252 |
253 | |
254 ;; font-locking | |
255 (defvar shell-prompt-face 'shell-prompt-face | |
256 "Face for shell prompts.") | |
257 (defvar shell-option-face 'shell-option-face | |
258 "Face for command line options.") | |
259 (defvar shell-output-face 'shell-output-face | |
260 "Face for generic shell output.") | |
261 (defvar shell-output-2-face 'shell-output-2-face | |
262 "Face for grep-like output.") | |
263 (defvar shell-output-3-face 'shell-output-3-face | |
264 "Face for [N] output where N is a number.") | |
265 | |
266 (make-face shell-prompt-face) | |
267 (make-face shell-option-face) | |
268 (make-face shell-output-face) | |
269 (make-face shell-output-2-face) | |
270 (make-face shell-output-3-face) | |
271 | |
272 (defun shell-font-lock-mode-hook () | |
273 (or (face-differs-from-default-p shell-prompt-face) | |
274 (copy-face 'font-lock-keyword-face shell-prompt-face)) | |
275 (or (face-differs-from-default-p shell-option-face) | |
276 (copy-face 'font-lock-comment-face shell-option-face)) | |
277 (or (face-differs-from-default-p shell-output-face) | |
278 (copy-face 'italic shell-output-face)) | |
279 (or (face-differs-from-default-p shell-output-2-face) | |
280 (copy-face 'font-lock-string-face shell-output-2-face)) | |
281 (or (face-differs-from-default-p shell-output-3-face) | |
282 (copy-face 'font-lock-string-face shell-output-3-face)) | |
283 ;; we only need to do this once | |
284 (remove-hook 'font-lock-mode-hook 'shell-font-lock-mode-hook)) | |
285 (add-hook 'font-lock-mode-hook 'shell-font-lock-mode-hook) | |
286 | |
287 (defvar shell-prompt-pattern-for-font-lock nil | |
288 "If non-nil, pattern to use to font-lock the prompt. | |
289 When nil, shell-prompt-pattern will be used. Set this to a regular | |
290 expression if you want the font-locked pattern to be different then | |
291 the shell's prompt pattern.") | |
292 | |
293 (defvar shell-font-lock-keywords | 253 (defvar shell-font-lock-keywords |
294 (list '(eval . (cons (if shell-prompt-pattern-for-font-lock | 254 (list (cons shell-prompt-pattern 'font-lock-keyword-face) |
295 shell-prompt-pattern-for-font-lock | 255 '("[ \t]\\([+-][^ \t\n]+\\)" 1 font-lock-comment-face) |
296 shell-prompt-pattern) | 256 '("^[^ \t\n]+:.*" . font-lock-string-face) |
297 shell-prompt-face)) | 257 '("^\\[[1-9][0-9]*\\]" . font-lock-string-face)) |
298 '("[ \t]\\([+-][^ \t\n>]+\\)" 1 shell-option-face) | |
299 '("^[^ \t\n]+:.*" . shell-output-2-face) | |
300 '("^\\[[1-9][0-9]*\\]" . shell-output-3-face) | |
301 '("^[^\n]+.*$" . shell-output-face)) | |
302 "Additional expressions to highlight in Shell mode.") | 258 "Additional expressions to highlight in Shell mode.") |
303 (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t)) | 259 (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t)) |
304 | |
305 | 260 |
306 ;;; Basic Procedures | 261 ;;; Basic Procedures |
307 ;;; =========================================================================== | 262 ;;; =========================================================================== |
308 ;;; | 263 ;;; |
309 | 264 |