From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Davison Newsgroups: gmane.emacs.help Subject: Re: how to enable syntax highlighting for some shell script files? Date: Sun, 09 May 2010 18:49:58 -0400 Message-ID: <87iq6wg06h.fsf@stats.ox.ac.uk> 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 1273445435 1394 80.91.229.12 (9 May 2010 22:50:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 9 May 2010 22:50:35 +0000 (UTC) Cc: Help-gnu-emacs@gnu.org To: xiaweitang Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 10 00:50:33 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 1OBFKR-0001Yd-5L for geh-help-gnu-emacs@m.gmane.org; Mon, 10 May 2010 00:50:31 +0200 Original-Received: from localhost ([127.0.0.1]:40376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBFKQ-00088N-O6 for geh-help-gnu-emacs@m.gmane.org; Sun, 09 May 2010 18:50:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OBFK5-00088I-C8 for help-gnu-emacs@gnu.org; Sun, 09 May 2010 18:50:09 -0400 Original-Received: from [140.186.70.92] (port=59466 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBFK2-00088A-Dj for Help-gnu-emacs@gnu.org; Sun, 09 May 2010 18:50:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBFJz-0004Ke-7j for Help-gnu-emacs@gnu.org; Sun, 09 May 2010 18:50:06 -0400 Original-Received: from markov.stats.ox.ac.uk ([163.1.210.1]:50393) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBFJy-0004KN-UG for Help-gnu-emacs@gnu.org; Sun, 09 May 2010 18:50:03 -0400 Original-Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o49Mo1Dd020430; Sun, 9 May 2010 23:50:01 +0100 (BST) Original-Received: by blackcap.stats.ox.ac.uk (Postfix, from userid 5158) id E49542066C; Sun, 9 May 2010 23:50:00 +0100 (BST) In-Reply-To: <28505457.post@talk.nabble.com> (xiaweitang's message of "Sun, 9 May 2010 14:57:53 -0700 (PDT)") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 8 (1) 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:73618 Archived-At: 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