home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / emacs / help / 4737 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.5 KB  |  39 lines

  1. Path: sparky!uunet!stanford.edu!agate!doc.ic.ac.uk!news!dbh
  2. From: dbh@doc.ic.ac.uk (Denis Howe)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: Read-Only Mode in Emacs
  5. Date: 9 Nov 92 18:16:34
  6. Organization: Computing Department, Imperial College, London, UK
  7. Lines: 26
  8. Message-ID: <DBH.92Nov9181634@wombat.doc.ic.ac.uk>
  9. References: <1992Nov9.104519.12975@fzi.de> <BxGH8y.LMA.1@cs.cmu.edu>
  10. NNTP-Posting-Host: wombat.doc.ic.ac.uk
  11. In-reply-to: rudis+@cs.cmu.edu's message of 9 Nov 92 15:48:30 GMT
  12.  
  13. In article <BxGH8y.LMA.1@cs.cmu.edu> rudis+@cs.cmu.edu (Rujith S
  14. DeSilva) wrote:
  15.  
  16. >In article <1992Nov9.104519.12975@fzi.de> fzi.de writes: could
  17. >>someone tell me if there is any option for Read-Only mode in Emacs
  18. >>like the view editor. I couldn't find them in the manuel.
  19. >
  20. >Two things that you may find useful:
  21. >
  22. >(1) The view-mode, conveniently accessed by using view-file or view-buffer.
  23. >(2) The variable buffer-read-only.  I use this via find-file-read-only.
  24. >
  25. >I prefer (2), because the commands work as usual, but anything that would
  26. >modify the buffer simply generates an error and a warning beep.
  27.  
  28. I wrote the following because I was always hitting space to view the
  29. next screenful of read-only files (I'm easily confused like that :-).
  30.  
  31. (defun insert-or-scroll (arg) "Insert a space or scroll-forward"
  32.   (interactive "p")
  33.   (if buffer-read-only (scroll-up ()) (self-insert-command arg)))
  34.  
  35. (define-key global-map " " 'insert-or-scroll)
  36. --
  37. Denis Howe <dbh@doc.ic.ac.uk>
  38. So Biggs, you're the idiot who bought all these IBM PCs.  You're fired!
  39.