emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coding guidelines? (was Re: Key bindings proposal)


From: Stephen J. Turnbull
Subject: coding guidelines? (was Re: Key bindings proposal)
Date: Fri, 30 Jul 2010 18:32:35 +0900

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.



 > 
 > Are these guidelines documented anywhere?
 > 
 > (The elisp manual is full of examples where "C-c" is hardcoded.)
 > 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]