help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] can NTEmacs (20 or 21) completely ignore Alt key?


From: Jason Rumney
Subject: Re: [h-e-w] can NTEmacs (20 or 21) completely ignore Alt key?
Date: 01 Nov 2001 20:28:10 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

Jonathan Epstein <address@hidden> writes:

> Thanks for your response, Jason.  The requirements are that no
> additional keystrokes such as Cntl-Q can be issued.  Emacs must be
> able to detect the pressing and holding of the Alt-Key, the numeric
> keyboard's 0034 keys, and the release of the Alt-Key.

I think I understand now. NaturallySpeaking generates fake keypresses,
and you want Emacs to understand them, right?

How about:


;; Turn off the default mapping of Alt to Meta.
;; Not strictly necessary; you could use meta in place of alt
;; in the keymaps below, but then you would lose the default M-0 - M-9
;; bindings.
(setq w32-alt-is-meta nil)

;; The following is sufficient for Alt-003x
;; For other character ranges, create more keymaps as necessary.
(setq alt-0-map (make-sparse-keymap))
(setq alt-00-map (make-sparse-keymap))
(setq alt-003-map (make-sparse-keymap))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Repeat this bit for every key you need to define

;; Define 
(defun insert-double-quote ()
  "insert double quotes"
  (interactive)
  (insert ?\"))

;; We want Alt-4 in alt-003-map to insert a double quote.
(define-key alt-003-map [(alt ?4)] 'insert-double-quote)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Now map the above to actual keys. I'm not sure if order is
;; important here or not.

;; Alt-3 in alt-00-map takes us into alt-003-map
(define-key alt-00-map [(alt ?3)] alt-003-map)

;; Alt-0 in alt-0-map takes us into alt-00-map
(define-key alt-0-map [(alt ?0)] alt-00-map)

;; Finally, Alt-0 in the global map takes us into alt-0-map
(define-key global-map [(alt ?0)] alt-0-map)




You will have to use Esc as Meta, or remap the Windows keys to Meta
(explained in the FAQ, although it doesn't work for certain
combinations which Windows grabs for itself).


-- 
Jason Rumney





reply via email to

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