From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Elston Newsgroups: gmane.emacs.help Subject: Re: Emacs-Lisp Q: Minor mode keymap Date: Fri, 27 Apr 2007 10:49:38 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <1334doc4rfi19b4@corp.supernews.com> References: <1332jm5qdlpdnaf@corp.supernews.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177698880 27126 80.91.229.12 (27 Apr 2007 18:34:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 18:34:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 27 20:34:39 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HhVHB-00012a-Jd for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 20:34:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhVN3-0000pK-7W for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 14:40:41 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news.astraweb.com!newsrouter-eu.astraweb.com!193.201.147.81.MISMATCH!feed.xsnews.nl!border-1.ams.xsnews.nl!sn-xt-ams-06!sn-xt-ams-04!sn-ams!sn-feed-ams-03!sn-post-ams-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: Original-X-Complaints-To: abuse@supernews.com Original-Lines: 85 Original-Xref: shelby.stanford.edu gnu.emacs.help:147686 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:43291 Archived-At: * Sebastian Meisel wrote (on 4/27/2007 12:25 AM): > Mark Elston schrieb: >> >> What I would like to do is package these functions as a minor >> mode with its own keymap and use \C-b in the LaTeX-mode-map >> used in AucTeX. Creating the minor mode map is pretty easy. >> I assume that from there I do something like: >> >> (define-prefix-command my-mode-map) >> >> or something similar. >> >> But from there, I don't see what to do. Do I have to modify my >> .emacs to get the binding correct? Can't I do it in the minor >> mode file? > Put something like that in your mode file: > > (defvar YOUR-mode-map > (let ((map (make-sparse-keymap))) > (define-key map "YOURKEYS" 'YOURFUN) > ... > map) > "Keymap for YOUR-mode.") > > (define-YOUR-mode > "MY mode DOESSOMETHING. > Basic Commands > ===== ======== > \\[YOURFUN]\tDOESSOMETHING. > ... > " > :lighter "THISSHALLFILLMYENTIREMODELINETOSHOWMYMODEISON" > :keymap YOUR-mode-map) > <---- > > Replace the uppercase parts ;-) Let me be a little more clear about what I am trying to accomplish. I understand how to create a keymap and how to use define-minor-mode to create a mode that makes use of my keymap. What I wanted to do was to assign my keymap to the \C-b key in the LaTeX-mode-map in AucTeX. Is there a way of doing that in my minor mode package or do I need to add something to my .emacs to accomplish this? This is what I have so far but I haven't found a way of getting what I am looking for yet. ------------------------------------------------------------------------ (defvar bibs-map nil "\ Keymap containing bindings to the Bibs functions.") (define-prefix-command 'bibs-map) ;;; <---Is this necessary? (define-key bs-map "g" 'bibs-get-ref) (define-key bs-map "v" 'bibs-find-v-num) (define-key bs-map "f" 'bibs-fix-quotes) (define-minor-mode bibs-mode "" ;; Initial Value nil ;; The indicator for the mode line " Bibs" ;; The minor mode bindings 'bs-map (...) ;;; <------ Is there something I can put here ;;; to associate the (unused) \C-b key in AucTeX ;;; LaTeX-mode-map as a prefix key for bibs-map? ) ------------------------------------------------------------------------ Alternatively, I could (if necessary) put something in my .emacs that associates bibs-map with the \C-b in LaTeX-mode-map. I just don't know how to do that. Also, when I toggle off bibs-mode it should remove the keymap from the \C-b prefix key in LaTeX-mode-map, right? Again, how do I do that? Mark