|
From: | Lennart Borgman |
Subject: | Re: .emacs key maps are overwritten by php-mode |
Date: | Thu, 04 May 2006 21:54:40 +0200 |
User-agent: | Thunderbird 1.5.0.2 (Windows/20060308) |
Sure you do not understand when I give you the wrong answer ;-)Sorry, my mistake. I thought you where using 'C-c d'. That is a sequence reserved for users (see below). If you really want to overwrite a binding in a major mode you can do that in the mode hook. Mode hooks are run as the last thing when a mode is setup. For php-mode the hook should be called php-mode-hook, they are always named like that. Use add-hook to add a function that set up the key binding for you. Something like
(add-hook 'php-mode-hook (lambda() (local-set-key ....) )Here you should use local-set-key instead of global-set-key. This way you change the major modes keymap.
Stefan Horomnea wrote:
Hello,I think I don't understand. I have just Control+D, and not Control-C and a Letter. If I only find a way to load my .emacs file or some other file with my keybindings after the last mode has loaded and overwrite those ?Stefan Lennart Borgman wrote:Stefan Horomnea wrote:There is a convention that major modes should use, see "(elisp) Key Binding Conventions" (maybe this is only find in current CVS Emacs?):Hello, I write something in my .emacs file like this: (global-set-key [(control ?d)] 'kill-ring-save)This works fine, in other modes (text, html, etc.). But when I open a php file, my Ctrl+d instead of kill-ring-save does c-electric-delete-forward . And I have several commands in my .emacs file, that are broken by the loading of the php-mode. What's the catch ?Thank you. Stefan* Please do not define `C-c LETTER' as a key in Lisp programs. Sequences consisting of `C-c' and a letter (either upper or lower case) are reserved for users; they are the *only* sequences reserved for users, so do not block them.So the php-mode you use does not follow this convention. Perhaps it would be good to contact the author?
[Prev in Thread] | Current Thread | [Next in Thread] |