From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: how to enable syntax highlighting for some shell script files? Date: Mon, 10 May 2010 10:29:44 +1000 Organization: Unlimited download news at news.astraweb.com Message-ID: <874oigvbt3.fsf@rapttech.com.au> References: <28505457.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1273452055 16737 80.91.229.12 (10 May 2010 00:40:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 10 May 2010 00:40:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 10 02:40:54 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OBH3F-0001QF-Q2 for geh-help-gnu-emacs@m.gmane.org; Mon, 10 May 2010 02:40:54 +0200 Original-Received: from localhost ([127.0.0.1]:44831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBH3F-0003LE-AB for geh-help-gnu-emacs@m.gmane.org; Sun, 09 May 2010 20:40:53 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.astraweb.com!border2.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:rVMxepShKMgIrroboZ9b6HOGnGE= Original-Lines: 56 Original-NNTP-Posting-Host: 6037669c.news.astraweb.com Original-X-Trace: DXC=Vo8n6EeAdO@Pn_2M35M[hOL?0kYOcDh@Ja30YlQ[TC>J>gImG>][SdHONM\`UZQR=KR>CSldV0oQF Original-Xref: usenet.stanford.edu gnu.emacs.help:178093 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73620 Archived-At: Dan Davison writes: > xiaweitang writes: > >> My emacs does syntax highlighting for C++, latex files, and also .Xdefaults, >> .xinitrc and so on. However, it doesn't do for other files like .inputrc and >> /etc/conf.d/local.start. > > Syntax highlighting is determined by what "major mode" emacs chooses > when it visits the file. For shell scripts starting with an interpreter > declaration like #!/bin/bash, emacs knows which major mode to use. For > random configuration files that are in no particular language, you might > want to use conf-mode. > > To tell emacs what mode you want it to use for a particular file, you > could do either of the following: > > 1. Place a special comment in the file telling emacs what major mode to use. > See the emacs manual: > http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables > > or use info (place cursor after last parenthesis and press C-x C-e): > (info "Emacs(Specifying File Variables)") > > 2. Configure the variable auto-mode-alist. For example, you could do this > (add-to-list 'auto-mode-alist '("\\.inputrc\\'" . conf-mode)) > > Dan > >> My local.start file : >> >> # This is a good place to load any misc programs >> # on startup (use &>/dev/null to hide output) >> >> # disable wlan0 LED blinking >> echo phy0assoc > `find /sys/devices/ -name iwl-phy0::assoc`/trigger >> &>/dev/null >> >> # from http://my.opera.com/xliot/blog/ >> if ! test -p /lib/splash/cache/.splash; then >> rm /lib/splash/cache/.splash &>/dev/null >> mkfifo /lib/splash/cache/.splash >> fi > In addition to what Dan wrote, there is also generic and generic-x modes. These modes are, as the anme would suggest generic font locking modes. They will add basic font locking to a number of common configuration style files. I have the following in my .emacs file (require 'generic) (require 'generic-x) Tim -- tcross (at) rapttech dot com dot au