help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: opening a buffer as read-only as default


From: Kevin Rodgers
Subject: Re: opening a buffer as read-only as default
Date: Wed, 11 Nov 2009 07:26:57 -0700
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

rotlas wrote:
Which is the simplest way to have Emacs opening all files as read-only? That
is not only by using C-x C-r  but also when selecting a file in a directory
buffer.

,----[ C-h k v ]
| v runs the command dired-view-file
|   which is an interactive compiled Lisp function in `dired.el'.
| It is bound to v, <menu-bar> <immediate> <view>.
| (dired-view-file)
|
| In Dired, examine a file in view mode, returning to Dired when done.
| When file is a directory, show it in this buffer if it is inserted.
| Otherwise, display it in another buffer.
|
| [back]
`----

And also preventing C-x C-f from opening a file as writable.

(add-hook 'find-file-hook (lambda () (setq buffer-read-only t)))

I would like it to be possible to toggle the read-only state, though.

,----[ C-h k C-x C-q ]
| C-x C-q runs the command toggle-read-only
|   which is an interactive compiled Lisp function in `files.el'.
| It is bound to C-x C-q.
| (toggle-read-only &optional arg)
|
| Change whether this buffer is visiting its file read-only.
| With prefix argument arg, make the buffer read-only if arg is
| positive, otherwise make it writable.  If visiting file read-only
| and `view-read-only' is non-nil, enter view mode.
|
| [back]
`----

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]