From: "rgb" <rbielaws@i1.net>
Subject: Re: Forcing a mode
Date: 1 Sep 2006 06:43:14 -0700 [thread overview]
Message-ID: <1157118194.758477.225190@i3g2000cwc.googlegroups.com> (raw)
In-Reply-To: slrnefek3h.onm.oudeis@isis.thalatta
> (Note that Tcl scripts typically begin something like:
>
> #!/bin/sh
> # ....
> # \
> exec tclsh "$0" ${1+"$@"}
>
> so Emacs cannot deduce the mode from the shebang.)
On Tandem platforms there are no filename extensions.
Moreover, because over 90% of source files I work on are
legacy and most Tandem programmers have never heard
of Emacs, I can't go around changing source files to add
these cookies everywhere I consult.
So I had to write something that does just what you want.
I ripped redundant/irrelevent stuff out, below.
Hopefully I didn't break anything in the meanwhile.
Someone interested in the full version should see my
emacswiki page.
(defadvice set-auto-mode ; RGB 2003
(after my-determine-language last () activate)
"If language is fundamental-mode Emacs didn't detect it.
Some 1st line language indicators are used to do recognition."
(if (eq major-mode 'fundamental-mode)
(let ((mode nil))
(save-excursion ; don't trash bookmarks
(goto-char (point-min))
(if (looking-at
(concat
"\\(\\?TACL \\|==\\| *#set\\|\\?SECTION +\\"
"(\\S-+\\s-+\\"
"(macro\\|routine\\|alias\\|text\\)\\)\\b\\)"))
(setq mode 'tacl-mode)
(if (looking-at "\\?SECTION +.+,TANDEM\\b")
(setq mode 'ddl-mode)
(if (looking-at "\\?ANSI\\b")
(setq mode 'cobol-mode)
(if (looking-at "#[-*#=\n]")
(setq mode 'acimake-mode)
(if (or (looking-at "\\?pep")
(looking-at "[!*] SCHEMA")
(looking-at "!FILE CREATED BY GENFWD"))
(setq mode 'tal-mode)))))))
(if mode
(funcall mode)))))
next prev parent reply other threads:[~2006-09-01 13:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-31 13:40 Forcing a mode CloudStrife
2006-08-31 15:09 ` Aaron Bingham
2006-08-31 21:33 ` Colin S. Miller
[not found] ` <mailman.6088.1157036963.9609.help-gnu-emacs@gnu.org>
2006-08-31 15:27 ` Phillip Lord
2006-08-31 21:11 ` Will Parsons
2006-09-01 0:58 ` Barry Margolin
2006-09-01 13:43 ` rgb [this message]
2006-09-01 5:39 ` CloudStrife
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1157118194.758477.225190@i3g2000cwc.googlegroups.com \
--to=rbielaws@i1.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).