boyd@cadovax.UUCP (Boyd Hays) (03/14/85)
Hello,
I'm trying to tailor Gosling Emacs to my liking and
I am having trouble with the following function. What
I've done is created a "command mode" and an "insertion
mode". The problem is that I have the keys bound other
than "self-insert" and need to issue extended commands.
The function "execute-extended-command" when executed
directly is impossible to talk to due to the fact that
all of the keys are bound to other functions. The first
command "\ex command" executes properly but the second
whose intent is to restore my original keymap does not.
The escape appears to be being eaten and the string
"xuse-global-map ¤t-keymap" is being inserted into
my buffer. What am I doing wrong? Your consideration
is greatly appreciated.
(defun
(emacs-extended-command
(progn command
(use-global-map "default-global-keymap")
(setq command (get-tty-command ": "))
(push-back-string "use-global-map ¤t-keymap")
(push-back-string "\ex")
(push-back-string command)
(push-back-string "\ex")
)
)
)
--
Boyd Hays
213/323-8170 x.2058
cadovax!boydconor@Glacier.ARPA (03/17/85)
a copy. Maybe someone else has already done this? -Conor Rafferty conor@su-glacier.ARPA conor@su-sierra.ARPA (more reliable) ...!decwrl!glacier!conor
gallaher@topaz.ARPA (Mike Gallaher) (03/19/85)
The problem is that the strings that are being pushed back need a terminator, just as when you are really typing them in. The string that Emacs sees in the example given is \ex<command>\exuse-global-map ¤t-keymap The second \e is taken to be the terminator for the command, and the rest is just seen as text to be inserted. The corrected code fragment is (push-back-string "use-global-map ¤t-keymap\e") (push-back-string "\e\ex") (push-back-string command) (push-back-string "\ex") You can also do fun things like this by using the fact that keymaps can be executed as if they were functions -- after all, a keymap is considered a macro; that's why keymaps appear in the list generated by ESC-x? Anything that can be bound to a key can be executed. Mike Gallaher