From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Restricting 'add-hook to a specific file extension Date: Sat, 25 Feb 2006 14:40:01 -0900 Message-ID: <20060225234001.GC9500@johnsons-web.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1140924630 29127 80.91.229.2 (26 Feb 2006 03:30:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 26 Feb 2006 03:30:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 26 04:30:24 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FDCc3-000754-NY for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Feb 2006 04:30:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FDCbp-0002vo-Gy for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Feb 2006 22:30:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FD8qA-00024j-Rh for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 18:28:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FD8q6-00022W-06 for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 18:28:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FD8q4-00021B-4w for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 18:28:36 -0500 Original-Received: from [208.218.214.44] (helo=ns3.cniweb.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FD8qS-0006f6-0H for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 18:29:00 -0500 Original-Received: from linus.johnson.com (rdbck-static-445.palmer.mtaonline.net [64.4.232.191]) by ns3.cniweb.net (8.13.5/8.13.5) with ESMTP id k1PNR0xK009498 for ; Sat, 25 Feb 2006 18:27:01 -0500 (EST) Original-Received: from linus.johnson.com (localhost.johnson.com [127.0.0.1]) by linus.johnson.com (8.12.8/8.12.8) with ESMTP id k1PNe2St010401 for ; Sat, 25 Feb 2006 14:40:02 -0900 Original-Received: (from tim@localhost) by linus.johnson.com (8.12.8/8.12.8/Submit) id k1PNe1dh010397 for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 14:40:01 -0900 Original-To: help-gnu-emacs@gnu.org Mail-Followup-To: Tim Johnson , help-gnu-emacs@gnu.org Content-Disposition: inline User-Agent: Mutt/1.4.2.1i 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:33414 Archived-At: Is there a way to restrict 'add-hook to a specific file extension? Below is code from my .emacs: (require 'newlisp-mode++) ;; uses 'add-hook to extend 'scheme-mode (add-to-list 'auto-mode-alist '("\\.lsp\\'" . scheme-mode)) (autoload 'scheme-mode "scheme" "Turn on scheme mode" t) (add-hook 'scheme-mode-hook 'turn-on-font-lock) I only want 'newlisp-mode++ to be used when the file extension is ".lsp". If the file extension is ".scm", I would want 'scheme-mode, but I would *not* want the code from 'newlisp-mode++ to take effect. One solution is derived-mode, but I've had no luck with it. For the time being (until I've had another 6 months or so of elisp under my belt), is there a way to restrict the add-hook action to only a file with a .lsp extension? Thanks tim -- Tim Johnson http://www.alaska-internet-solutions.com