From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Junia Newsgroups: gmane.emacs.help Subject: Re: Modal Keyboard Layout for EMACS Date: Thu, 22 Nov 2012 12:52:58 -0800 (PST) Message-ID: <4df5addb-a19c-4b3f-b79d-27e308a2b3ab@googlegroups.com> References: <5f81bc03-eafb-4330-96b1-383d17886c0c@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1353617713 19378 80.91.229.3 (22 Nov 2012 20:55:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Nov 2012 20:55:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 22 21:55:23 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tbdnv-00072I-6A for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Nov 2012 21:55:23 +0100 Original-Received: from localhost ([::1]:42180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbdnk-0001ZD-JG for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Nov 2012 15:55:12 -0500 Original-Received: by 10.224.205.65 with SMTP id fp1mr1517698qab.4.1353617579862; Thu, 22 Nov 2012 12:52:59 -0800 (PST) Original-Received: by 10.182.131.105 with SMTP id ol9mr7805obb.18.1353617578746; Thu, 22 Nov 2012 12:52:58 -0800 (PST) Original-Path: usenet.stanford.edu!i9no9089351qap.0!news-out.google.com!gf5ni2982588qab.0!nntp.google.com!i9no9130512qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <5f81bc03-eafb-4330-96b1-383d17886c0c@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=200.131.199.26; posting-account=MljCOQoAAACk1WgCrNhKvnt6QY-OIvBm Original-NNTP-Posting-Host: 200.131.199.26 User-Agent: G2/1.0 Injection-Date: Thu, 22 Nov 2012 20:52:59 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:195525 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87849 Archived-At: 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 "")) (force-mode-line-update) (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 "")) (force-mode-line-update) (use-global-map emap) ) (defun toemacs() (interactive) (ademacs)) (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 nil :lighter " " '(emap) :group 'normal (if normal (ademacs) (puremacs) )) (define-globalized-minor-mode gnormal normal (lambda() (normal t))) (provide 'normal)