From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric James Michael Ritz Newsgroups: gmane.emacs.help Subject: Replacing c-beginning/end-of-defun in a Major Mode Date: Thu, 18 Jul 2013 03:32:21 -0400 Message-ID: <51E79A05.90301@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1374132763 1190 80.91.229.3 (18 Jul 2013 07:32:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Jul 2013 07:32:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 18 09:32:46 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uzihh-00056h-4z for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jul 2013 09:32:45 +0200 Original-Received: from localhost ([::1]:44823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzihg-0003UA-Nz for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jul 2013 03:32:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzihP-0003GZ-Kn for help-gnu-emacs@gnu.org; Thu, 18 Jul 2013 03:32:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzihM-0007eZ-SX for help-gnu-emacs@gnu.org; Thu, 18 Jul 2013 03:32:27 -0400 Original-Received: from mail-gh0-x22a.google.com ([2607:f8b0:4002:c05::22a]:43328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzihM-0007eS-Nu for help-gnu-emacs@gnu.org; Thu, 18 Jul 2013 03:32:24 -0400 Original-Received: by mail-gh0-f170.google.com with SMTP id z10so856454ghb.29 for ; Thu, 18 Jul 2013 00:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=P5WRMPR1lzqVHO92+Mx/Q8OMFmIUJ7ujCWC8QRmGe+0=; b=BpHAu6Au7IbMa9o4C+7nsslBm2AbtMwfMbeAiiFdK+b+tbZZOzYTHR30Sfmknh6eYE AuWvHVGZTCOmGVHuqEMXmSk1xsVRmZ9gInQKJttJURG0FekDFMfIgQqnQQmvcdQJHXPX 3yjtkLZTUp6lyd3qHPWamexoXDrvboQAEYzJRZ/IC+a1y6ajvQ6zc/DCr8FXHk2i9DV/ +zzV9wtv4+Xs6nYZr47zYzCvrnS+ioPbzjGvrU0xpA2R3QjoaKsCOfaIucq1+vTcKuvL XwnRvUUh9+U5jQ+tah6KW08ilxJLgzQ6kTVVnBG7ZSv3SL4OKXj2e8IWb9QPZrXeEAXI +nUg== X-Received: by 10.236.151.33 with SMTP id a21mr4882472yhk.0.1374132743855; Thu, 18 Jul 2013 00:32:23 -0700 (PDT) Original-Received: from [192.168.1.102] (66-191-207-45.dhcp.spbg.sc.charter.com. [66.191.207.45]) by mx.google.com with ESMTPSA id s47sm13200305yhl.19.2013.07.18.00.32.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Jul 2013 00:32:22 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c05::22a X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92219 Archived-At: 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/ 南無妙法蓮華經