all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Binding Keymap prefix to Major Mode
@ 2005-04-01 23:59 Tim Johnson
  2005-04-02  2:26 ` rgb
  2005-04-02 20:13 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Johnson @ 2005-04-01 23:59 UTC (permalink / raw)


Hi:
I've been working on a major mode for the rebol programming language.
The following code has been evaluated:
(defvar rebol-keymap (make-sparse-keymap) "Rebol mode keymap")
(defcustom rebol-keymap-prefix [(control ?')]
   "*Keymap prefix string for rebol-keymap"
   :type 'string
   :group 'rebol)
(local-set-key rebol-keymap-prefix rebol-keymap)
(define-key rebol-keymap "b" 'previous-rebol-definition)
;; When I load a file that auto-loads the mode, I find
;; that "b" is bound to 'previous-rebol-definition, not
;; to "\C-' b" which is what I hope for.
NOTE: I've tried [(control \')] and [(control c)(control c)]
as prefix symbols with the same (lack of) results.
I presume that something else needs to be done to properly bind
this prefix to the keymap.

All help, docs and examples are welcome.

TIA
Tim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
  2005-04-01 23:59 Binding Keymap prefix to Major Mode Tim Johnson
@ 2005-04-02  2:26 ` rgb
  2005-04-02  3:08   ` Tim Johnson
  2005-04-02 20:13 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: rgb @ 2005-04-02  2:26 UTC (permalink / raw)



Tim Johnson wrote:
> Hi:
> I've been working on a major mode for the rebol programming language.
> The following code has been evaluated:
> (defvar rebol-keymap (make-sparse-keymap) "Rebol mode keymap")
> (defcustom rebol-keymap-prefix [(control ?')]
>    "*Keymap prefix string for rebol-keymap"
>    :type 'string
>    :group 'rebol)
> (local-set-key rebol-keymap-prefix rebol-keymap)
> (define-key rebol-keymap "b" 'previous-rebol-definition)
> ;; When I load a file that auto-loads the mode, I find
> ;; that "b" is bound to 'previous-rebol-definition, not
> ;; to "\C-' b" which is what I hope for.
> NOTE: I've tried [(control \')] and [(control c)(control c)]
> as prefix symbols with the same (lack of) results.
> I presume that something else needs to be done to properly bind
> this prefix to the keymap.
>
> All help, docs and examples are welcome.
>
It works for me.
I'm thinking the problem is in your rebol-mode function.
What does your (use-local-map ...) statement look like?
If it says (use-local-map rebol-keymap) that would
certainly explain it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
  2005-04-02  2:26 ` rgb
@ 2005-04-02  3:08   ` Tim Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Johnson @ 2005-04-02  3:08 UTC (permalink / raw)


rgb wrote:
<...>
> It works for me.
> I'm thinking the problem is in your rebol-mode function.
> What does your (use-local-map ...) statement look like?
> If it says (use-local-map rebol-keymap) that would
> certainly explain it.

Hello rgb:
   You're right! What would be the correct form?
thanks
tim

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
  2005-04-01 23:59 Binding Keymap prefix to Major Mode Tim Johnson
  2005-04-02  2:26 ` rgb
@ 2005-04-02 20:13 ` Stefan Monnier
  2005-04-02 21:57   ` Tim Johnson
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2005-04-02 20:13 UTC (permalink / raw)


> (defvar rebol-keymap (make-sparse-keymap) "Rebol mode keymap")
> (defcustom rebol-keymap-prefix [(control ?')]
>    "*Keymap prefix string for rebol-keymap"
>    :type 'string
>    :group 'rebol)
> (local-set-key rebol-keymap-prefix rebol-keymap)
> (define-key rebol-keymap "b" 'previous-rebol-definition)

Seeing the code above, I *strongly* suggest you google for "sample-mode.el"
and try to start from that instead.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
  2005-04-02 20:13 ` Stefan Monnier
@ 2005-04-02 21:57   ` Tim Johnson
  2005-04-02 22:30     ` Daniel Wright
       [not found]     ` <mailman.79.1112481245.30898.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Johnson @ 2005-04-02 21:57 UTC (permalink / raw)


Stefan Monnier wrote:
>>(defvar rebol-keymap (make-sparse-keymap) "Rebol mode keymap")
>>(defcustom rebol-keymap-prefix [(control ?')]
>>   "*Keymap prefix string for rebol-keymap"
>>   :type 'string
>>   :group 'rebol)
>>(local-set-key rebol-keymap-prefix rebol-keymap)
>>(define-key rebol-keymap "b" 'previous-rebol-definition)
> 
> 
> Seeing the code above, I *strongly* suggest you google for "sample-mode.el"
> and try to start from that instead.
> 
> 
>         Stefan

Hello Stefan:

Thank you very much,that is something that I have been looking for - an 
example of how to set up a mode.

FYI: The solution has proven to be just to change
(use-local-map rebol-keymap)  ;; to
(local-set-key rebol-keymap-prefix rebol-keymap)

Now keybindings work as I would expect them to.

I have googled for "sample-mode.el" and have found only two
references, but no code. In fact what I find are emails from
you and since you appear to be the author, I would deeply appreciate it
if you could provide a link for this file.

Regards
Tim Johnson
   ----------------------------
   Senior Programer/Analyst
   Alaska Internet Solutions

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
  2005-04-02 21:57   ` Tim Johnson
@ 2005-04-02 22:30     ` Daniel Wright
       [not found]     ` <mailman.79.1112481245.30898.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Wright @ 2005-04-02 22:30 UTC (permalink / raw)


Tim Johnson wrote:
> I have googled for "sample-mode.el" and have found only two
Hi Tim,
Try googling for "emacswiki samplemode".
Many greetings,
Daniel.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Binding Keymap prefix to Major Mode
       [not found]     ` <mailman.79.1112481245.30898.help-gnu-emacs@gnu.org>
@ 2005-04-02 22:58       ` Tim Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Tim Johnson @ 2005-04-02 22:58 UTC (permalink / raw)


Daniel Wright wrote:
> Tim Johnson wrote:
> 
>> I have googled for "sample-mode.el" and have found only two
> 
> Hi Tim,
> Try googling for "emacswiki samplemode".
> Many greetings,
> Daniel.
Thanks! This is great! Just what I have been
looking for.
tj

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-04-02 22:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-01 23:59 Binding Keymap prefix to Major Mode Tim Johnson
2005-04-02  2:26 ` rgb
2005-04-02  3:08   ` Tim Johnson
2005-04-02 20:13 ` Stefan Monnier
2005-04-02 21:57   ` Tim Johnson
2005-04-02 22:30     ` Daniel Wright
     [not found]     ` <mailman.79.1112481245.30898.help-gnu-emacs@gnu.org>
2005-04-02 22:58       ` Tim Johnson

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.