[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to create my own mode?
From: |
Pascal Bourguignon |
Subject: |
Re: How to create my own mode? |
Date: |
Thu, 17 Nov 2005 17:40:19 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Jeckob@gmx.net writes:
> Hi, i have written some functions in elisp to get some strings
> formated. Now i want to have that only active when i open *.ci
> files....how can i do this in elisp? Here is my code:
Perhaps you don't really need a fullfleshed mode.
Adding a hook could be enough:
(add-hook 'find-file-hook
(lambda ()
(when (string-match "\\.ci$" (buffer-file-name))
(local-set-key (kbd "RET")hk (function format/align-and-newline))
(local-set-key (kbd "C-RET") (function newline)))))
You can still choose a default mode for your .ci files:
(require 'cl)
(push '("\\.ci$" . text-mode) auto-mode-alist) ; or some othe mode adapted
; to your data.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.