From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Webb S." Newsgroups: gmane.emacs.help Subject: Adding a hook to sql-mode? Date: Mon, 8 Dec 2008 16:58:01 -0800 (PST) Organization: http://groups.google.com Message-ID: <442a49e1-d94d-4771-9d2d-adff564c7afe@w24g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1228801176 16363 80.91.229.12 (9 Dec 2008 05:39:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2008 05:39:36 +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 Dec 09 06:40:35 2008 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.50) id 1L9vKk-0007dO-Ob for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Dec 2008 06:40:34 +0100 Original-Received: from localhost ([127.0.0.1]:52703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9vJZ-00056N-Re for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Dec 2008 00:39:21 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!w24g2000prd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-NNTP-Posting-Host: 70.56.252.129 Original-X-Trace: posting.google.com 1228784282 11225 127.0.0.1 (9 Dec 2008 00:58:02 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 9 Dec 2008 00:58:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w24g2000prd.googlegroups.com; posting-host=70.56.252.129; posting-account=c7eNVwoAAABl5IpFLf4ooTShfg15YNZd User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165157 X-Mailman-Approved-At: Tue, 09 Dec 2008 00:38:13 -0500 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:60487 Archived-At: Sorry for the slightly tweaked repost, but I am hoping to fix this before I forget about it... If I open schema.sql I get funky indentation, where emacs changes my tabs to a mix of spaces etc. I can fix this by running the following in the eval (alt-:) buffer once I have opened a sql file (say "schema.sql"): (define-key sql-mode-map (kbd "TAB") 'self-insert-command) (define-key sql-mode-map (kbd "RET") 'newline-and-indent) (setq-default default-tab-width 4) How can I run this as a hook so it always works for sql mode? I tried the following to no avail: (add-hook 'sql-mode-hook (lambda() (define-key sql-mode-map (kbd "TAB") 'self-insert-command))) By "to no avail" I mean that when I open foo.sql, does its normal weird behavior of lining up with the end of the first word, inserting spaces in order to do this (yuck!). Once I run the above define-key commands from "eval" (alt-:), it behaves how I want, but I can't get the hook to be installed (I think). Thx!