From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: how to map sh-mode to mean bash-mode Date: Mon, 25 Jul 2011 23:43:18 -0600 Message-ID: References: <87mxgfxfim.fsf@jidanni.org> <4E22AADE.1090701@easy-emacs.de> <812736AF-2EAB-4612-8371-70B47FAC1F7B@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1311658962 10791 80.91.229.12 (26 Jul 2011 05:42:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2011 05:42:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 26 07:42:38 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QlaPe-0007RA-61 for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2011 07:42:38 +0200 Original-Received: from localhost ([::1]:48684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlaPd-0001SM-M6 for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2011 01:42:37 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlaPZ-0001S4-UE for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 01:42:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlaPY-0008PZ-I1 for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 01:42:33 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:59521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlaPY-0008PF-9K for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 01:42:32 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QlaPW-0007QV-74 for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 07:42:30 +0200 Original-Received: from c-71-237-25-24.hsd1.co.comcast.net ([71.237.25.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Jul 2011 07:42:30 +0200 Original-Received: from kevin.d.rodgers by c-71-237-25-24.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Jul 2011 07:42:30 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 53 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-25-24.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 In-Reply-To: <812736AF-2EAB-4612-8371-70B47FAC1F7B@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81769 Archived-At: On 7/17/11 8:25 AM, Perry Smith wrote: > > On Jul 17, 2011, at 4:26 AM, Andreas Röhler wrote: > >> Am 16.07.2011 01:58, schrieb jidanni@jidanni.org: >>> $ touch a.sh a.bash >>> $ emacs -nw -Q a.bash a.sh >>> See they are in different modeline modes? >>> How can I make them both bash mode? >>> No matter if it is filename prefix, or #!/bin/sh or whatever. >>> I tried defalias, and it didn't work. >>> >>> >> >> Hi, >> >> AFAIU you want a bash-specific editing environment. >> I'm interested in that question, as delivered some shell-script tools. >> Maybe have a look at >> >> sh-beg-end.el at https://launchpad.net/s-x-emacs-werkstatt/ >> >> BTW, what should such bash-mode do, what sh-mode and shell-script-mode do not? > > I'm curious on this too but... emacs looks at the #! line as well as the suffix. So if you do: > > echo '#!/bin/bash'> f1.sh > echo '#!/bin/bash'> f2.bash > > and then edit them, both put you into bash mode. And: > > echo '#!/bin/bash'> f3 > > (no suffix) will put you into bash mode too as well as > > echo '#!/usr/bin/env bash'> f4 > > (more complicated interpretation of the #! line) > > Likewise: > > echo '#!/usr/bin/env ruby'> f5 > > will put you into Ruby mode when editing f5. > > My curiosity is where is all this magic done so I could tweak it if I needed to? I know about file-mode-alist but that is just the suffix mapping part. What is interpreting the #! of a file? C-h v interpreter-mode-alist C-h v auto-mode-interpreter-regexp -- Kevin Rodgers Denver, Colorado, USA