* Help in Emacs
@ 2008-10-17 9:57 Rupam Jaiswal
0 siblings, 0 replies; 4+ messages in thread
From: Rupam Jaiswal @ 2008-10-17 9:57 UTC (permalink / raw
To: johnw; +Cc: help-gnu-emacs, cyd, monnier
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Hi,
I am using emacs. Many times, I have to open files just for viewing
and not
for editing.but by mistake some or the other lines get edited.
In order to avoid editing. Is there any way to open emacs in view mode
and not edit mode.(Just like in vi editior,where file can be open in
view mode by command view FileName).
Regards
Rupam
[-- Attachment #2: Type: text/html, Size: 3226 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20081017095807.BB30CD5074@spunkymail-mx9.g.dreamhost.com>]
* Re: Help in Emacs
[not found] <20081017095807.BB30CD5074@spunkymail-mx9.g.dreamhost.com>
@ 2008-10-17 20:03 ` Chong Yidong
2008-10-18 4:47 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2008-10-17 20:03 UTC (permalink / raw
To: Rupam Jaiswal; +Cc: help-gnu-emacs, johnw, monnier
"Rupam Jaiswal" <rupamj@rediff.co.in> writes:
> In order to avoid editing. Is there any way to open emacs in view mode
> and not edit mode.(Just like in vi editior,where file can be open in
> view mode by command view FileName).
C-x C-r visits a file in read-only mode.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help in Emacs
2008-10-17 20:03 ` Chong Yidong
@ 2008-10-18 4:47 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2008-10-18 4:47 UTC (permalink / raw
To: help-gnu-emacs
Chong Yidong wrote:
> "Rupam Jaiswal" <rupamj@rediff.co.in> writes:
>
>> In order to avoid editing. Is there any way to open emacs in view mode
>> and not edit mode.(Just like in vi editior,where file can be open in
>> view mode by command view FileName).
>
> C-x C-r visits a file in read-only mode.
Or from the command line:
emacs --eval "(find-file-read-only \"Please Hammer Don't Hurt 'Em.txt\")"
You can also define a new command line option, like this:
;; Usage: emacs --read-only FILE
(defun command-line-find-file-read-only (switch)
(find-file-read-only (pop command-line-args-left)))
(add-to-list 'command-switch-alist
'("--read-only" . command-line-find-file-read-only))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.1419.1224301974.25473.help-gnu-emacs@gnu.org>]
* Re: Help in Emacs
[not found] <mailman.1419.1224301974.25473.help-gnu-emacs@gnu.org>
@ 2008-10-18 14:32 ` Michael Ekstrand
0 siblings, 0 replies; 4+ messages in thread
From: Michael Ekstrand @ 2008-10-18 14:32 UTC (permalink / raw
To: help-gnu-emacs
"Rupam Jaiswal" <rupamj@rediff.co.in> writes:
> I am using emacs. Many times, I have to open files just for viewing
> and not
> for editing.but by mistake some or the other lines get edited.
> In order to avoid editing. Is there any way to open emacs in view mode
> and not edit mode.(Just like in vi editior,where file can be open in
> view mode by command view FileName).
There is the command `view-file' which will open a file read-only; in my
Emacs, it does not seem to be bound to any key, but you could bind it to
some convenient key in your .emacs.
Also, after opening a file, you can type C-x C-q (`toggle-read-only') to
put it in read-only mode. In the default mode line, this will also
result in two % characters in the left end of the mode line, indicating
that the file is read-only.
- Michael
--
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files? I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-18 14:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-17 9:57 Help in Emacs Rupam Jaiswal
[not found] <20081017095807.BB30CD5074@spunkymail-mx9.g.dreamhost.com>
2008-10-17 20:03 ` Chong Yidong
2008-10-18 4:47 ` Kevin Rodgers
[not found] <mailman.1419.1224301974.25473.help-gnu-emacs@gnu.org>
2008-10-18 14:32 ` Michael Ekstrand
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).