Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news From: norm@athena.mit.edu (Wayne M Miller) Newsgroups: comp.emacs Subject: Mode toggle switch Message-ID: <1991Mar20.183646.9078@athena.mit.edu> Date: 20 Mar 91 18:36:46 GMT Sender: news@athena.mit.edu (News system) Distribution: usa Organization: Massachusetts Institute of Technology Lines: 37 I am trying to use the F5 key on my DEC VAX as a mode toggle switch, in other words, the first press of F5 should put emacs in LaTeX mode, the next should get C mode, the next should get fundamental mode, the next should get LaTeX mode once again, etc. Here is my elisp code: ;; The F5 key is "\e[15~" (defun my-quick-latex-mode() "Quick LaTeX mode." (interactive) (latex-mode) (global-set-key "\e[15~" 'my-quick-c-mode)) (defun my-quick-c-mode() "Quick C mode." (interactive) (c-mode) (global-set-key "\e[15~" 'my-quick-fundamental-mode)) (defun my-quick-fundamental-mode() "Quick fundamental mode." (interactive) (fundamental-mode) (global-set-key "\e[15~" 'my-quick-latex-mode)) (global-set-key "\e[15~" 'my-quick-latex-mode) When I hit F5, emacs loads the correct mode, but does not implement it until I strike a sequence of control characters (i.e. when I hit F5 the mode line echos "Loading TeX-mode... done!", but remains in fundamental mode until I type C-g or some other sequence). I am new to elisp hacking and so I can't figure out what I did wrong. If anyone has any ideas, please email them to the address below. I'll post the best reply. Thank you in advance. -- ============================================================================== Love is a snowmobile racing across | Wayne M Miller the tundra and then suddenly it | norm@athena.mit.edu flips over, pinning you underneath. |--------------------------------------