[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

READ-ONLY Fred windows

   From: burke@ils.nwu.edu (Robin Burke)
   Newsgroups: comp.lang.lisp.mcl
   Date: 26 Jan 92 19:10:12 GMT
   I need a way to make locked files READ-ONLY, so that typing
   in the window has no effect or beeps. I've considered replacing
   the local COMTAB, but I would have to have each key that can
   cause a modification defined as "beep", and even this would fail
   if the user has some crazy set of key definitions. There must be
   a better way.

I hope you're planning to share your VC system when it's done!

I poked around a bit and there are some promising looking places to
start.  Both buffer-delete and buffer-insert call ccl::%%buf-changed
and ccl::%%buf-read-only, so it looks like Fred might already have
some basic support for what you want to do.  ccl::%%buf-read-only
seems to just call error unconditionally, but I couldn't figure out
how to set a buffer to read-only (if there is a way).  Maybe someone
else who is better at deciphering assembly can figure it out.

Anyway, on the theory that Apple set things up so that any time the
buffer is modified ccl::%%buf-changed would be called, maybe it is
enough to ADVISE the callers of ccl::%%buf-changed to not do anything
if the buffer is read-only, or to warn the user that their changes
will be thrown away.  Here are some of the callers, but I don't
guarantee this is a complete list:

? (get-callers 'ccl::%%buf-changed)
? (get-callers 'ccl::%%buf-read-only)

Note that advising or redefining a kernel function causes MCL to die