From xemacs-m  Mon Feb 24 13:28:30 1997
Received: from CNRI.Reston.VA.US (CNRI.Reston.VA.US [132.151.1.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id NAA14970
	for <xemacs-beta@xemacs.org>; Mon, 24 Feb 1997 13:28:27 -0600 (CST)
Received: from newcnri.cnri.reston.va.us by CNRI.Reston.VA.US id aa14831;
          24 Feb 97 11:45 EST
Received: from anthem.CNRI.Reston.Va.US by newcnri.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id LAA16570; Mon, 24 Feb 1997 11:45:25 -0500
Received: by anthem.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id LAA16238; Mon, 24 Feb 1997 11:45:24 -0500
Date: Mon, 24 Feb 1997 11:45:24 -0500
Message-Id: <199702241645.LAA16238@anthem.CNRI.Reston.Va.US>
From: "Barry A. Warsaw" <bwarsaw@anthem.cnri.reston.va.us>
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="SjLlA50MGqo2fUWCPKsKQVPagPUar22nr2WKX93Q"
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: shell.el changes
Reply-To: bwarsaw@python.org
X-Attribution: BAW
X-Oblique-Strategy: Nobility of Intentions
X-Url: http://www.python.org/~bwarsaw


--SjLlA50MGqo2fUWCPKsKQVPagPUar22nr2WKX93Q
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


This patch contains changes to shell-font-lock-keywords.  First, it
uses a variable shell-prompt-pattern-for-font-lock which the user can
change to control how their prompt if font-locked.  This is separate
from shell-prompt-pattern, but defaulted with it's value.  This change
requires the font-lock.el change just posted.

The patch also fixes matching of options so -> won't look like a line
with an option switch on it (in long ls's it is a symbolic link
indicator -- has anyone ever seen such an option?).

Finally, this patch contains my previous font-lock changes for
shell.el.  It can be applied against b95's vanilla shell.el

-Barry


--SjLlA50MGqo2fUWCPKsKQVPagPUar22nr2WKX93Q
Content-Type: text/plain
Content-Disposition: inline;
	filename="patch-7"
Content-Transfer-Encoding: 7bit

*** shell.el	1997/02/24 03:58:45	1.1
--- shell.el	1997/02/24 16:09:42
***************
*** 251,261 ****
    "*Hook for customising Shell mode.")
  
  (defvar shell-font-lock-keywords
!   (list (cons shell-prompt-pattern 'font-lock-keyword-face)
! 	'("[ \t]\\([+-][^ \t\n]+\\)" 1 font-lock-comment-face)
! 	'("^[^ \t\n]+:.*" . font-lock-string-face)
! 	'("^\\[[1-9][0-9]*\\]" . font-lock-string-face))
    "Additional expressions to highlight in Shell mode.")
  (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t))
  
  ;;; Basic Procedures
--- 251,301 ----
    "*Hook for customising Shell mode.")
  
+ 
+ ;; font-locking
+ (defvar shell-prompt-face 'shell-prompt-face
+   "Face for shell prompts.")
+ (defvar shell-option-face 'shell-option-face
+   "Face for command line options.")
+ (defvar shell-output-face 'shell-output-face
+   "Face for generic shell output.")
+ (defvar shell-output-2-face 'shell-output-2-face
+   "Face for grep-like output.")
+ (defvar shell-output-3-face 'shell-output-3-face
+   "Face for [N] output where N is a number.")
+ 
+ (make-face shell-prompt-face)
+ (make-face shell-option-face)
+ (make-face shell-output-face)
+ (make-face shell-output-2-face)
+ (make-face shell-output-3-face)
+ 
+ (defun shell-font-lock-mode-hook ()
+   (or (face-differs-from-default-p shell-prompt-face)
+       (copy-face 'font-lock-keyword-face shell-prompt-face))
+   (or (face-differs-from-default-p shell-option-face)
+       (copy-face 'font-lock-comment-face shell-option-face))
+   (or (face-differs-from-default-p shell-output-face)
+       (copy-face 'italic shell-output-face))
+   (or (face-differs-from-default-p shell-output-2-face)
+       (copy-face 'font-lock-string-face shell-output-2-face))
+   (or (face-differs-from-default-p shell-output-3-face)
+       (copy-face 'font-lock-string-face shell-output-3-face))
+   ;; we only need to do this once
+   (remove-hook 'font-lock-mode-hook 'shell-font-lock-mode-hook))
+ (add-hook 'font-lock-mode-hook 'shell-font-lock-mode-hook)
+ 
+ (defvar shell-prompt-pattern-for-font-lock shell-prompt-pattern
+   "Pattern to use to font-lock the prompt.
+ Defaults to `shell-prompt-pattern'.")
+ 
  (defvar shell-font-lock-keywords
!   (list (cons 'shell-prompt-pattern-for-font-lock shell-prompt-face)
! 	'("[ \t]\\([+-][^ \t\n>]+\\)" 1 shell-option-face)
! 	'("^[^ \t\n]+:.*" . shell-output-2-face)
! 	'("^\\[[1-9][0-9]*\\]" . shell-output-3-face)
! 	'("^[^\n]+.*$" . shell-output-face))
    "Additional expressions to highlight in Shell mode.")
  (put 'shell-mode 'font-lock-defaults '(shell-font-lock-keywords t))
+ 
  
  ;;; Basic Procedures

--SjLlA50MGqo2fUWCPKsKQVPagPUar22nr2WKX93Q--

