comparison lisp/comint/shell.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 131b0175ea99
children 360340f9fd5f
comparison
equal deleted inserted replaced
101:a0ec055d74dd 102:a145efe76779
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 shell-prompt-pattern
288 "Pattern to use to font-lock the prompt.
289 Defaults to `shell-prompt-pattern'.")
290
253 (defvar shell-font-lock-keywords 291 (defvar shell-font-lock-keywords
254 (list (cons shell-prompt-pattern 'font-lock-keyword-face) 292 (list (cons 'shell-prompt-pattern-for-font-lock shell-prompt-face)
255 '("[ \t]\\([+-][^ \t\n]+\\)" 1 font-lock-comment-face) 293 '("[ \t]\\([+-][^ \t\n>]+\\)" 1 shell-option-face)
256 '("^[^ \t\n]+:.*" . font-lock-string-face) 294 '("^[^ \t\n]+:.*" . shell-output-2-face)
257 '("^\\[[1-9][0-9]*\\]" . font-lock-string-face)) 295 '("^\\[[1-9][0-9]*\\]" . shell-output-3-face)
296 '("^[^\n]+.*$" . shell-output-face))
258 "Additional expressions to highlight in Shell mode.") 297 "Additional expressions to highlight in Shell mode.")
259 (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t)) 298 (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t))
299
260 300
261 ;;; Basic Procedures 301 ;;; Basic Procedures
262 ;;; =========================================================================== 302 ;;; ===========================================================================
263 ;;; 303 ;;;
264 304