[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coding guidelines? (was Re: Key bindings proposal)
From: |
Joe Brenner |
Subject: |
Re: coding guidelines? (was Re: Key bindings proposal) |
Date: |
Sat, 31 Jul 2010 12:19:37 -0700 |
Stephen J. Turnbull <address@hidden> wrote:
> Joe Brenner writes:
> > > I would welcome patches that try to make intentions more clear
> > > (e.g. eliminate the massive hardcoding of the "C-c" prefix all over the
>
> > Rather than hardcoding "C-c", what are we supposed to do?
>
> Create a separate map and bind it to a single prefix key sequence.
> Usually the prefix sequence should also be configurable. From
> footnote.el:
>
> ;;;###autoload
> (defvar footnote-prefix [(control ?c) ?!]
> "*When not using message mode, the prefix to bind in `mode-specific-map'")
>
> ;;;###autoload
> (defvar footnote-mode-map nil
> "Keymap used for footnote minor mode.")
>
> ;; Set up our keys
> ;;;###autoload
> (unless footnote-mode-map
> (setq footnote-mode-map (make-sparse-keymap))
> (define-key footnote-mode-map "a" 'Footnote-add-footnote)
> (define-key footnote-mode-map "b" 'Footnote-back-to-message)
> (define-key footnote-mode-map "c" 'Footnote-cycle-style)
> (define-key footnote-mode-map "d" 'Footnote-delete-footnote)
> (define-key footnote-mode-map "g" 'Footnote-goto-footnote)
> (define-key footnote-mode-map "r" 'Footnote-renumber-footnotes)
> (define-key footnote-mode-map "s" 'Footnote-set-style))
>
> ;;;###autoload
> (define-key global-map footnote-prefix footnote-mode-map)
>
> That's not quite verbatim; there's some additional weirdness about
> footnote-minor-mode-map that I don't really understand.
This is pretty good (and much better than the hacks I was trying to get a
customizeable prefix key), but this puts the new bindings in the global
keymap.
I think what's going on in footnote.el is that they wanted the new
bindings in it's own map which is associated with a new minor mode.
That approach makes a little more sense to me (for my immediate problem,
anyway), but I'm a little puzzled that the minor mode bindings don't go
away when you shut off the minor mode.
Do I need to do something in an after mode hook to cleanup?
- Re: Key bindings proposal, (continued)
- Re: Key bindings proposal, Uday S Reddy, 2010/07/29
- Re: Key bindings proposal, Andreas Röhler, 2010/07/29
- Re: Key bindings proposal, Mathias Dahl, 2010/07/31
- Re: Key bindings proposal, Uday S Reddy, 2010/07/31
- Re: Key bindings proposal, Alan Mackenzie, 2010/07/31
- RE: Key bindings proposal, Drew Adams, 2010/07/31
coding guidelines? (was Re: Key bindings proposal), Joe Brenner, 2010/07/29
Re: Key bindings proposal [Was: Emacs learning curve], Noah Lavine, 2010/07/28