all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Elston <m.elston@advantest-ard.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs-Lisp Q: Minor mode keymap
Date: Fri, 27 Apr 2007 10:49:38 -0700	[thread overview]
Message-ID: <1334doc4rfi19b4@corp.supernews.com> (raw)
In-Reply-To: <mailman.2580.1177659117.7795.help-gnu-emacs@gnu.org>

* 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

  parent reply	other threads:[~2007-04-27 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27  1:18 Emacs-Lisp Q: Minor mode keymap Mark Elston
2007-04-27  7:25 ` Sebastian Meisel
2007-04-27  7:48   ` Lennart Borgman (gmail)
     [not found] ` <mailman.2580.1177659117.7795.help-gnu-emacs@gnu.org>
2007-04-27 17:49   ` Mark Elston [this message]
2007-04-27 20:15     ` Mark Elston

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334doc4rfi19b4@corp.supernews.com \
    --to=m.elston@advantest-ard.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.
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.