From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: chris@grierwhite.com (Christopher J. White) Newsgroups: gmane.emacs.help Subject: Re: syntax highlighting Date: Tue, 28 Jan 2003 08:06:45 -0500 Organization: Posted via Supernews, http://www.supernews.com Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043759557 21200 80.91.224.249 (28 Jan 2003 13:12:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 28 Jan 2003 13:12:37 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18dVXV-0005Vb-00 for ; Tue, 28 Jan 2003 14:12:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18dVVS-0003GA-05 for gnu-help-gnu-emacs@m.gmane.org; Tue, 28 Jan 2003 08:10:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (powerpc-apple-darwin) Cancel-Lock: sha1:fBDC+IUlGX+gyPhP2JtvLFIU+YQ= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 36 Original-Xref: shelby.stanford.edu gnu.emacs.help:109489 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6009 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6009 >>>>> "paul" == Paul O'Donnell writes: paul> I am a little confused about syntax highlighting in emacs. When paul> I open a file with *.c or *.html extensions and syntax paul> highlighting is turned on I get the appropriate syntax paul> highlighting. paul> But what about bash script files? Highlighting is font-lock-mode, using keywords appropriate for the type of file you are editing. This depends on emacs properly detecting the major-mode of the files you are editing. To my knowledge, emacs has the following methods of doing this automatically: 1) Filename name matching via auto-mode-alist...when you open "blah.sh", emacs matches this against a pattern in auto-mode-alist and decides it's sh-mode. sh-mode is activated and turns on font-lock-mode 2) Interpreter name matching via interpreter-mode-alist... If first line of file is "#!", it looks for an interperter and assigns the mode that way. 3) Presence of a line of the format: -*- mode: MODENAME -*- which must be present as the first nonblank line of the file. See the info pages for Major Modes and Choosing Major modes for more info. ...cj -- ------------------------------------------------------------------------------ Christopher J. White chris@grierwhite.com ------------------------------------------------------------------------------