unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Multiple keymaps for a minor mode
@ 2020-01-23  1:58 Tim Johnson
  2020-01-23 20:49 ` Stefan Monnier
  2020-02-26 12:05 ` Michael Heerdegen
  0 siblings, 2 replies; 15+ messages in thread
From: Tim Johnson @ 2020-01-23  1:58 UTC (permalink / raw)
  To: MLEmacs

Using GNU Emacs 26.1 on ubuntu

;; I use the following code to establish a minor mode

(defvar tj-mode-map (make-sparse-keymap)
   "Keymap for `tj-mode'.")

;;;###autoload
(define-minor-mode tj-minor-mode
   "This minor mode enables my key settings to override conflicting modes."
   :init-value t
   :lighter " -tj-"
   :keymap tj-mode-map)

;;;###autoload
(define-globalized-minor-mode global-tj-minor-mode tj-minor-mode 
tj-minor-mode)

(add-to-list 'emulation-mode-map-alists `((tj-minor-mode . ,tj-mode-map)))
;; End code

I wish to separate `tj-mode-map into a number of individual mode maps 
that are configured by category. This would give me the advantage of 
using a function called

which-key--create-buffer-and-show  from the which-key package to 
implement a menu showing commands bound to keys by functionality or 
category.

the :keymap member of define-mode-map is what binds the keymap to the mode.

Can I use multiple :keymap entries, one for each keymap or must I define 
a minor mode for each of my custom keymaps?

Certainly the latter is doable, but I like to save keystrokes :)

thanks

-- 
Tim
tj49.com




^ permalink raw reply	[flat|nested] 15+ messages in thread
* Multiple keymaps for a minor mode
@ 2020-01-23 18:57 Tim Johnson
  2020-01-24 18:47 ` Tim Johnson
  0 siblings, 1 reply; 15+ messages in thread
From: Tim Johnson @ 2020-01-23 18:57 UTC (permalink / raw)
  To: MLEmacs

Using GNU Emacs 26.1 on ubuntu

;; I use the following code to establish a minor mode

(defvar tj-mode-map (make-sparse-keymap)
   "Keymap for `tj-mode'.")

;;;###autoload
(define-minor-mode tj-minor-mode
   "This minor mode enables my key settings to override conflicting modes."
   :init-value t
   :lighter " -tj-"
   :keymap tj-mode-map)

;;;###autoload
(define-globalized-minor-mode global-tj-minor-mode tj-minor-mode 
tj-minor-mode)

(add-to-list 'emulation-mode-map-alists `((tj-minor-mode . ,tj-mode-map)))
;; End code

I wish to separate `tj-mode-map into a number of individual mode maps 
that are configured by category. This would give me the advantage of 
using a function called

which-key--create-buffer-and-show  from the which-key package to 
implement a menu showing commands bound to keys by functionality or 
category.

the :keymap member of define-mode-map is what binds the keymap to the mode.

Can I use multiple :keymap entries, one for each keymap or must I define 
a minor mode for each of my custom keymaps?

Certainly the latter is doable, but I like to save keystrokes :)

thanks

-- 
Tim
tj49.com




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

end of thread, other threads:[~2020-03-06  0:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-23  1:58 Multiple keymaps for a minor mode Tim Johnson
2020-01-23 20:49 ` Stefan Monnier
2020-02-19 23:26   ` Tim Johnson
2020-02-21 16:16     ` Stefan Monnier
2020-02-21 18:22       ` Tim Johnson
2020-02-26 12:05 ` Michael Heerdegen
2020-02-26 19:05   ` Tim Johnson
2020-02-26 20:24     ` Drew Adams
2020-02-27  0:02       ` Tim Johnson
2020-03-04 15:47     ` Michael Heerdegen
2020-03-05 18:51       ` Tim Johnson
2020-03-05 23:54         ` Michael Heerdegen
2020-03-06  0:45           ` Tim Johnson
  -- strict thread matches above, loose matches on Subject: below --
2020-01-23 18:57 Tim Johnson
2020-01-24 18:47 ` Tim Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).