[Top][All Lists]

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

Re: Modal Keyboard Layout for EMACS

From: Junia
Subject: Re: Modal Keyboard Layout for EMACS
Date: Thu, 22 Nov 2012 12:52:58 -0800 (PST)
User-agent: G2/1.0

There is a bug in the previously posted program. Nevertheless the new version 
still does not work with the / slash key en lieu de square bracket. Here is 
correct program.

;; Variables for possible keyboards
(defvar default-keyboard
   (copy-keymap (current-global-map)))

(defvar emap
    (copy-keymap (current-global-map)))
(defun tovim()  (interactive)
    (setq minor-mode-alist
      (assq-delete-all 'normal minor-mode-alist))
    (add-to-list 'minor-mode-alist '(normal "<N>"))
    (use-global-map vmap))
(define-key emap "[" 'tovim)

(defvar vmap
    (copy-keymap (current-global-map)))
(define-key vmap (kbd "h") 'backward-char)
(define-key vmap (kbd "j") 'next-line)
(define-key vmap (kbd "k") 'previous-line)
(define-key vmap (kbd "l") 'forward-char)
(defun ademacs()
   (setq minor-mode-alist
    (assq-delete-all 'normal minor-mode-alist))
  (add-to-list 'minor-mode-alist '(normal "<I>"))
  (use-global-map emap) )
(defun toemacs()  (interactive)
(define-key vmap (kbd "i") 'toemacs)
(defun slash()(interactive)
   (ademacs) ; type twice for [
   (insert "["))
(define-key vmap (kbd "[") 'slash)

(defun puremacs()
   (use-global-map default-keyboard))

(define-minor-mode normal
       :lighter " <N> "
      :group 'normal
   (if   normal   (ademacs) (puremacs) ))

(define-globalized-minor-mode gnormal normal
    (lambda()  (normal t)))  

(provide 'normal)

reply via email to

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