all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: opening a buffer as read-only as default
Date: Wed, 11 Nov 2009 07:26:57 -0700	[thread overview]
Message-ID: <hdehj6$e1j$1@ger.gmane.org> (raw)
In-Reply-To: <26282458.post@talk.nabble.com>

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





  parent reply	other threads:[~2009-11-11 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 12:19 opening a buffer as read-only as default rotlas
2009-11-11  9:49 ` Peter Dyballa
2009-11-11 14:26 ` Kevin Rodgers [this message]
2009-11-20  8:08   ` rotlas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='hdehj6$e1j$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.