Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!cae780!leadsv!esl!lrs From: lrs@esl.UUCP (Lynn Slater) Newsgroups: comp.emacs Subject: Re: scope rules for "let" Message-ID: <568@esl.UUCP> Date: 24 Feb 88 21:05:21 GMT References: <3292@arthur.cs.purdue.edu> Lines: 31 In-reply-to: narten@cs.purdue.EDU's message of 23 Feb 88 17:01:43 GMT Posting-Front-End: GNU Emacs 18.44.12 of Mon Nov 16 1987 on esl (berkeley-unix) >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. I have solved this in much the manner you suggest. Check that there is not some other problem. For Example code follows: (defun highlight-region (p1 p2) "Highlight the current region." (interactive "r") (let ((s (buffer-substring p1 p2)) (inverse-video t) ;; Do not change the modified flag (modified-flag (buffer-modified-p)) ;; shadow the true local value of read-only (buffer-read-only nil) ;; Prevent the generation of autosave files ;; Don't you just love dynamic variable binding? (buffer-auto-save-file-name nil) ;; we do not have to worry about backup files because ;; they are not generated unless the buffer is saved. ) (delete-region p1 p2) ;; force a redisplay, so that the screen image of the line "changes" later (if (fboundp 'update-display) (update-display) (sit-for 0)) (insert s) (if (fboundp 'update-display) (update-display) (sit-for 0)) (set-buffer-modified-p modified-flag)))