home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.help
- Path: sparky!uunet!stanford.edu!agate!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!uniol!Peter.Bruells
- From: Peter.Bruells@arbi.informatik.uni-oldenburg.de (Peter Bruells)
- Subject: How to properly "lookup-key" ?
- Organization: University of Oldenburg, Germany
- Date: Sun, 8 Nov 1992 17:34:55 GMT
- Message-ID: <1992Nov8.173455.25287@arbi.Informatik.Uni-Oldenburg.DE>
- Sender: news@arbi.Informatik.Uni-Oldenburg.DE
- Lines: 63
-
-
- Hello...
-
-
- I have the following problem:
-
- I defined the following two functions and bound them to ' and , to
- allow easier input of german quotes while in TeX-mode, while I
- disabled " as a special command..
-
- (Had to, since " is a meta-char when using german.sty)
-
-
- Typing ,, produces "` and typing '' produces "', typing a printable
- char after a , or ' inserts the , or ' and the char.
-
- BUT: Typing CTRL<char> inserts ^char, as if I had quoted the character.
-
- I understand WHY this happens, but have no idea how to get rid of it.
-
- With (lookup-key .. .. ) I can check wether a given key ius bound to a
- command, self-insert-command or not bound at all, but I have NO idea
- how to use it.
-
- command-execute ? execute-command ? I'm totally lost...
-
- Can anybode help ?
-
- Thanks in advance...
-
- (defun glatex-close ()
- ""
- (interactive)
- (insert "'")
- (setq x (read-char))
- (if (eq x 39)
- (progn
- (delete-backward-char 1)
- (insert "\"'"))
- (insert x)))
-
-
- (defun glatex-open ()
- ""
- (interactive)
- (insert ",")
- (setq x (read-char))
- (if (eq x 44)
- (progn
- (delete-backward-char 1)
- (insert "\"`"))
- (insert x)))
-
-
-
-
- (setq TeX-mode-hook
- '(lambda ()
- (define-key TeX-mode-map "\"" '(lambda () (interactive) (TeX-insert-quote "1")))
- (define-key TeX-mode-map "\C-c>" '(lambda () (interactive) (insert "\"`")))
- (define-key TeX-mode-map "\C-c<" '(lambda () (interactive) (insert "\"'")))
- (define-key TeX-mode-map "," 'glatex-open)
- (define-key TeX-mode-map "'" 'glatex-close)))
-