[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Replacing c-beginning/end-of-defun in a Major Mode
From: |
Eric James Michael Ritz |
Subject: |
Replacing c-beginning/end-of-defun in a Major Mode |
Date: |
Thu, 18 Jul 2013 03:32:21 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 |
Hello everyone,
I am trying to customize the behavior of some commands in a major mode
but I am running into a problem. I am referring to PHP Mode, and its
definition derives from `c-mode`, i.e. `(define-derived-mode php-mode
c-mode …)`. Because of that PHP Mode inherits two key-bindings:
1. C-M-a for `c-beginning-of-defun`
2. C-M-e for `c-end-of-defun`
I want PHP Mode to use the functions `php-beginning-of-defun` and
`php-end-of-defun`, respectively. I can rebind those two keys for PHP
Mode specifically. However, what I really want is for the two
`php-*-of-defun` functions to replace the `c-*-of-defun` functions no
matter what key-bindings the user has. For example, if a user
customizes ‘C-c f’ to execute `c-beginning-of-defun` then I want those
same keys to execute `php-beginning-of-defun` when in PHP Mode.
Is there a way I can tell Emacs to use those PHP-specific functions
only when in PHP Mode, regardless of what keys are set to the normal
CC Mode functions? I would appreciate any help on how to do this, or
to know if there is a better way overall that I am not seeing.
Thanks in advanced for any help.
--
ejmr :: http://ericjmritz.wordpress.com/
南無妙法蓮華經
- Replacing c-beginning/end-of-defun in a Major Mode,
Eric James Michael Ritz <=