all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* .emacs key maps are overwritten by php-mode
       [not found] <E1FbiNZ-0006tG-Q7@host1.softexperience.ro>
@ 2006-05-04 19:17 ` Stefan Horomnea
  2006-05-04 19:27   ` Lennart Borgman
  2006-05-04 20:01   ` Peter Dyballa
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Horomnea @ 2006-05-04 19:17 UTC (permalink / raw)


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

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

* Re: .emacs key maps are overwritten by php-mode
  2006-05-04 19:17 ` .emacs key maps are overwritten by php-mode Stefan Horomnea
@ 2006-05-04 19:27   ` Lennart Borgman
  2006-05-04 19:44     ` Stefan Horomnea
  2006-05-04 19:50     ` Reiner Steib
  2006-05-04 20:01   ` Peter Dyballa
  1 sibling, 2 replies; 6+ messages in thread
From: Lennart Borgman @ 2006-05-04 19:27 UTC (permalink / raw)
  Cc: help-gnu-emacs

Stefan Horomnea wrote:
> 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
There is a convention that major modes should use, see "(elisp) Key 
Binding Conventions" (maybe this is only find in current CVS Emacs?):

   * 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?

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

* Re: .emacs key maps are overwritten by php-mode
  2006-05-04 19:27   ` Lennart Borgman
@ 2006-05-04 19:44     ` Stefan Horomnea
  2006-05-04 19:54       ` Lennart Borgman
  2006-05-04 19:50     ` Reiner Steib
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Horomnea @ 2006-05-04 19:44 UTC (permalink / raw)


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:
>> 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
> There is a convention that major modes should use, see "(elisp) Key 
> Binding Conventions" (maybe this is only find in current CVS Emacs?):
>
>   * 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?
>

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

* Re: .emacs key maps are overwritten by php-mode
  2006-05-04 19:27   ` Lennart Borgman
  2006-05-04 19:44     ` Stefan Horomnea
@ 2006-05-04 19:50     ` Reiner Steib
  1 sibling, 0 replies; 6+ messages in thread
From: Reiner Steib @ 2006-05-04 19:50 UTC (permalink / raw)


On Thu, May 04 2006, Lennart Borgman wrote:

> Stefan Horomnea wrote:
>> (global-set-key [(control ?d)] 'kill-ring-save)
[...]
>   * 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.

Huch?  C-d is not `C-c LETTER'.

The Emacs manual explains Stefan too (in the last sentence):

,----[ (info "(emacs)Keymaps") ]
|    As a user, you can redefine any key; but it is usually best to stick
| to key sequences that consist of `C-c' followed by a letter.  These
| keys are "reserved for users," so they won't conflict with any properly
| designed Emacs extension.  The function keys <F5> through <F9> are also
| reserved for users.  If you redefine some other key, your definition
| may be overridden by certain extensions or major modes which redefine
| the same key.
`----

This, as well as your quote from (info "(elisp)Coding Conventions")
was already present in Emacs 21.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: .emacs key maps are overwritten by php-mode
  2006-05-04 19:44     ` Stefan Horomnea
@ 2006-05-04 19:54       ` Lennart Borgman
  0 siblings, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2006-05-04 19:54 UTC (permalink / raw)
  Cc: help-gnu-emacs

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:
>>> 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
>> There is a convention that major modes should use, see "(elisp) Key 
>> Binding Conventions" (maybe this is only find in current CVS Emacs?):
>>
>>   * 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?

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

* Re: .emacs key maps are overwritten by php-mode
  2006-05-04 19:17 ` .emacs key maps are overwritten by php-mode Stefan Horomnea
  2006-05-04 19:27   ` Lennart Borgman
@ 2006-05-04 20:01   ` Peter Dyballa
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2006-05-04 20:01 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 04.05.2006 um 21:17 schrieb Stefan Horomnea:

> And I have several commands in my .emacs file, that are broken by  
> the loading of the php-mode. What's the catch ?

Php-mode uses its own php-mode-map. You would need to change this  
map ...

--
Greetings

   Pete

"Isn't vi that text editor with two modes... one that beeps and one
that corrupts your file?" -- Dan Jacobson, on comp.os.linux.advocacy

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

end of thread, other threads:[~2006-05-04 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1FbiNZ-0006tG-Q7@host1.softexperience.ro>
2006-05-04 19:17 ` .emacs key maps are overwritten by php-mode Stefan Horomnea
2006-05-04 19:27   ` Lennart Borgman
2006-05-04 19:44     ` Stefan Horomnea
2006-05-04 19:54       ` Lennart Borgman
2006-05-04 19:50     ` Reiner Steib
2006-05-04 20:01   ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.