From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: how to enable syntax highlighting for some shell script files?
Date: Mon, 10 May 2010 10:29:44 +1000 [thread overview]
Message-ID: <874oigvbt3.fsf@rapttech.com.au> (raw)
In-Reply-To: mailman.9.1273445410.17813.help-gnu-emacs@gnu.org
Dan Davison <davison@stats.ox.ac.uk> writes:
> xiaweitang <jadelightking@gmail.com> 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
prev parent reply other threads:[~2010-05-10 0:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 21:57 how to enable syntax highlighting for some shell script files? xiaweitang
2010-05-09 22:49 ` Dan Davison
2010-05-09 23:00 ` Yuliang Wang
2010-05-11 12:37 ` Kevin Rodgers
[not found] ` <mailman.10.1273446039.17813.help-gnu-emacs@gnu.org>
2010-05-10 0:46 ` Pascal J. Bourguignon
[not found] ` <mailman.9.1273445410.17813.help-gnu-emacs@gnu.org>
2010-05-10 0:29 ` Tim X [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874oigvbt3.fsf@rapttech.com.au \
--to=timx@nospam.dev.null \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.