Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Command Line to load file in read only mode

96 views
Skip to first unread message

Larry James

unread,
Sep 27, 1997, 3:00:00 AM9/27/97
to

Is there a command line option that will load a file in emacs for
viewing only.
Thanks in advance for any comments.

-- Larry

--
----------------------------------------------------------------------
Apollo III Communications (Buffalo's First ISP) Larry James
716-896-0738 Office 716-896-0766 Fax Consultant/Programmer
http://www.apollo3.com/~ljames lja...@apollo3.com Buffalo, New York

Emilio Lopes

unread,
Sep 29, 1997, 3:00:00 AM9/29/97
to

>>>>> "LJ" == Larry James <lja...@apollo3.com> writes:

LJ> Is there a command line option that will load a file in emacs for
LJ> viewing only.

You can always use the "--eval" option:

emacs --eval '(find-file-read-only "my-file.suf")'

or, using `view-mode' if you prefer:

emacs --eval '(view-file "my-file.suf")'

--
Emilio C. Lopes <mailto:Emilio...@Physik.TU-Muenchen.DE>

Kevin Rodgers

unread,
Sep 29, 1997, 3:00:00 AM9/29/97
to

Emilio Lopes <Emilio...@Physik.TU-Muenchen.DE> writes:
>>>>>> "LJ" == Larry James <lja...@apollo3.com> writes:
>LJ> Is there a command line option that will load a file in emacs for
>LJ> viewing only.
>
>You can always use the "--eval" option:
>
> emacs --eval '(find-file-read-only "my-file.suf")'

Here's how to define a new command line option to do the same thing:

(setq command-switch-alist
(cons '("--read-only" . find-file-read-only-command-line-arg) ; "-R"
command-switch-alist))

(defun find-file-read-only-command-line-arg (switch)
"Visit next command line argument (after SWITCH) as a read-only file."
;; (prog1 (car x) (setq x (cdr x))) == (pop x):
(find-file-read-only (prog1 (car command-line-args-left)
(setq command-line-args-left
(cdr command-line-args-left)))))
--
Kevin Rodgers <kev...@ihs.com> Lead Software Engineer
Information Handling Services Electronic Systems Development
15 Inverness Way East, M/S A201 GO BUFFS!
Englewood CO 80112-5776 USA 1+ (303) 397-2807[voice]/-2244[fax]

0 new messages