Use set-temporary-overlay-map.
[bpt/emacs.git] / lisp / progmodes / f90.el
index 1d2beed..712725f 100644 (file)
@@ -2204,18 +2204,13 @@ Leave point at the end of line."
   "Typing `\\[help-command] or `? lists all the F90 abbrevs.
 Any other key combination is executed normally."
   (interactive "*")
-  (insert last-command-event)
-  (let (char event)
-    (if (fboundp 'next-command-event) ; XEmacs
-        (setq event (next-command-event)
-              char (and (fboundp 'event-to-character)
-                        (event-to-character event)))
-      (setq event (read-event)
-            char event))
-    ;; Insert char if not equal to `?', or if abbrev-mode is off.
-    (if (and abbrev-mode (memq char (list ?? help-char)))
-        (f90-abbrev-help)
-      (setq unread-command-events (list event)))))
+  (self-insert-command 1)
+  (when abbrev-mode
+    (set-temporary-overlay-map
+     (let ((map (make-sparse-keymap)))
+       (define-key map [??] 'f90-abbrev-help)
+       (define-key map (vector help-char) 'f90-abbrev-help)
+       map))))
 
 (defun f90-abbrev-help ()
   "List the currently defined abbrevs in F90 mode."