[comp.emacs] Trouble with save-window/restore-window

decouty@caroline.irisa.fr (Bertrand Decouty) (12/06/89)

I am currently trying to make the following cmd file work.

; readhook
set $readhook   execute-macro-20                
20      store-macro
        set %rctmp &mid $cfname &sub %rctmp 1 2 
        !if &or &seq %rctmp ".c" &seq %rctmp ".h" ; if .c  or .h file
                add-mode "cmode"
                add-mode "magic"
; extract from cpage.cmd
	       	save-window
	       	1 next-window	; should be Function Keys buffer
	        beginning-of-file
	 	set $curcol 40
	       	overwrite-string " F1 PROCEDURE        F2 function      "
	        next-line
		set $curcol 40
		overwrite-string " F3 if then else    F4  while         "
		beginning-of-file
		!force restore-window
	!endif
!endm


Goal: when i load a .c or .h file, i want to load special bindings AND i
want to display in Function Keys buffer more help.

This works fine when the C file is loaded from emacs (^x^f foo.c)
But when i call 'emacs foo.c', emacs executes the cmd file, creates
foo.c buffer (and places the cursor in it) but DO NOT read foo.c. 
It reads it if I do a ^XX (next buffer).

Looking at $cbufname, before the save-window, $cbufname=foo.c, after the
restore-window, $cbufname=main. So, i think there is some trouble with
save/restore window when emacs is called with a file name.

If i do this in bufhook bound macro, all is fine BUT, as bufhook is not called
when finding another file (only readhook), it is not the right place.

Any comment from a microemacs guru?

I use microemacs 3.10, with the patches submitted in this newsgroup (and
with a get1key patch from Richard G. Knowles (richk@pogo.WV.TEK.COM),
thanks to him, which enables you to use, along with termcap function
keys definition, all your function keys (if you write the correct
keycode handler). Really great. Now, me310 runs
(almost) perfectly on my Sun3, no more A B C D in my files!

Last question (to Daniel Lawrence): when do you anticipate to release
the next version?

Thank you very much.

Bertrand Decouty


| Bertrand DECOUTY             | EMAIL : decouty@irisa.fr, decouty@irisa.uucp  |
| IRISA - INRIA                |         {uunet,mcvax,inria}!irisa!decouty     |
| Campus de Beaulieu           | PHONE : +33  99 36 20 00                      |
| F-35042 Rennes Cedex - FRANCE| FAX : +33  99 38 38 32 | TELEX: 950473 UNIRISA|