help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax highlighting


From: Christopher J. White
Subject: Re: syntax highlighting
Date: Tue, 28 Jan 2003 08:06:45 -0500
User-agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (powerpc-apple-darwin)

>>>>> "paul" == Paul O'Donnell <odonnellp@rogers.com> 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
------------------------------------------------------------------------------ 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]