Path: utzoo!mnetor!uunet!husc6!purdue!narten From: narten@cs.purdue.EDU (Thomas Narten) Newsgroups: comp.emacs Subject: scope rules for "let" Message-ID: <3292@arthur.cs.purdue.edu> Date: 23 Feb 88 17:01:43 GMT Sender: news@cs.purdue.EDU Organization: Department of Computer Science, Purdue University Lines: 36 I have buffer that is readonly for keystrokes, but is made writable by functions operating on the buffer. I want the default to be readonly, with explicit action required to make the buffer write only. Based on other packages, I use the following trick: 1) the buffer is made readonly via (setq buffer-read-only "t") 2) whenever the buffer is to be modified, the following code is used: (let (buffer-read-only) /* muck with the buffer */ ) I want the buffer-read-only variable to be nil only during the invocation of "let", reverting to its non-nil value upon exit. This is apparently not taking place. I find that the buffer-read-only is being left set to nil. I conclude that "let" is not doing what I want. What I would like is for let to push the variables onto the symbol table stack, and use dynamic scope rules to have all subsequent references to the variables with those name find the "recent" bindings. When "let" exits, I would expect the temporary binding of those variables to pop off of the stack and the previous meanings be restored. Why does the above not work? Do I really have to use setq to explicitly toggle the value of buffer-read-only? I am running gnu emacs 18.49. -- Thomas Narten narten@cs.purdue.edu or {ihnp4, allegra}!purdue!narten