help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

programming file-extensions in .emacs


From: efrem
Subject: programming file-extensions in .emacs
Date: Wed, 27 Feb 2008 06:17:29 -0800 (PST)
User-agent: G2/1.0

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)
          ))
  ))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]