unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* programming file-extensions  in  .emacs
@ 2008-02-27 14:17 efrem
  2008-02-27 16:20 ` Jason Rumney
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: efrem @ 2008-02-27 14:17 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-28  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 14:17 programming file-extensions in .emacs efrem
2008-02-27 16:20 ` Jason Rumney
2008-02-27 16:25 ` Peter Dyballa
2008-02-27 16:55 ` Harald Hanche-Olsen
2008-02-28  7:36   ` efrem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).