unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* opening a buffer as read-only as default
@ 2009-11-10 12:19 rotlas
  2009-11-11  9:49 ` Peter Dyballa
  2009-11-11 14:26 ` Kevin Rodgers
  0 siblings, 2 replies; 4+ messages in thread
From: rotlas @ 2009-11-10 12:19 UTC (permalink / raw)
  To: Help-gnu-emacs


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. And also preventing C-x C-f from opening a file as writable. I would
like it to be possible to toggle the read-only state, though.
-- 
View this message in context: http://old.nabble.com/opening-a-buffer-as-read-only-as-default-tp26282458p26282458.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opening a buffer as read-only as default
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2009-11-11  9:49 UTC (permalink / raw)
  To: rotlas; +Cc: Help-gnu-emacs


Am 10.11.2009 um 13:19 schrieb rotlas:

> 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.


'v' to just view it. You could add another hook to find-file-hook  
that all files are opened read-only...

--
Greetings

   Pete

Don't just do something, sit there.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opening a buffer as read-only as default
  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
  2009-11-20  8:08   ` rotlas
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2009-11-11 14:26 UTC (permalink / raw)
  To: help-gnu-emacs

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: opening a buffer as read-only as default
  2009-11-11 14:26 ` Kevin Rodgers
@ 2009-11-20  8:08   ` rotlas
  0 siblings, 0 replies; 4+ messages in thread
From: rotlas @ 2009-11-20  8:08 UTC (permalink / raw)
  To: Help-gnu-emacs


Thanks, Peter and Kevin for great answers. Now I don't have to undo all
unintentional modifications of files everytime I compile...


Kevin Rodgers-2 wrote:
> 
> 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
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/opening-a-buffer-as-read-only-as-default-tp26282458p26429688.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-20  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-11-20  8:08   ` rotlas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).