From: Eric James Michael Ritz <lobbyjones@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Replacing c-beginning/end-of-defun in a Major Mode
Date: Thu, 18 Jul 2013 03:32:21 -0400 [thread overview]
Message-ID: <51E79A05.90301@gmail.com> (raw)
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/
南無妙法蓮華經
next reply other threads:[~2013-07-18 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 7:32 Eric James Michael Ritz [this message]
2013-07-18 7:47 ` Replacing c-beginning/end-of-defun in a Major Mode Tom Willemse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51E79A05.90301@gmail.com \
--to=lobbyjones@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).