From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: efrem Newsgroups: gmane.emacs.help Subject: programming file-extensions in .emacs Date: Wed, 27 Feb 2008 06:17:29 -0800 (PST) Organization: http://groups.google.com Message-ID: <6d54fc34-7e67-4dd0-9c99-be7796283cdb@e25g2000prg.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 1204125429 25024 80.91.229.12 (27 Feb 2008 15:17:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Feb 2008 15:17:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 27 16:17: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 1JUO26-0006ON-EB for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Feb 2008 16:17:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JUO1a-0005S1-9E for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Feb 2008 10:16:50 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e25g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 159.93.70.126 Original-X-Trace: posting.google.com 1204121850 6333 127.0.0.1 (27 Feb 2008 14:17:30 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 27 Feb 2008 14:17:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e25g2000prg.googlegroups.com; posting-host=159.93.70.126; posting-account=BOgndwoAAADBBHoqOGJLIQsUNUBaJ_CW User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20061222 CentOS/1.5.0.9-0.1.el4.centos4 Firefox/1.5.0.9, gzip(gfe), gzip(gfe) Original-Xref: shelby.stanford.edu gnu.emacs.help:156541 X-Mailman-Approved-At: Wed, 27 Feb 2008 10:16:33 -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:51912 Archived-At: Hello, I'd like to change the .emacs file in order to make some key-setting for the cases of xxxx.f and xxxx.cc files. The next function does work but It needs to type of "M-x mykeys"(I don't like it!). I could put these setting into corresponding xxx.elc files but I prefer to have these definitions in my .emacs file. If I remove the 2 first lines of this code then it does not work: error. What is the way to change this code it runs properly without any typings like "M-x mykeys": the .emacs must do these settings itself? Thank you in advance Oleg (defun mykeys () (interactive) (let (fname suffix) (setq fname (buffer-file-name)) (setq suffix (file-name-extension fname)) (if (equal suffix "cc") (progn (global-set-key [f2] 'insert-cout1) (global-set-key [f3] 'insert-cout4) )) (if (equal suffix "f") (progn (global-set-key [f8] 'nn3) (global-set-key [f9] 'delete-backward-char) )) ))