all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs switch similar to vi's -R, or view equivalent?
@ 2006-08-22 15:19 Andrew B. Young
  2006-08-22 15:41 ` Peter Dyballa
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrew B. Young @ 2006-08-22 15:19 UTC (permalink / raw)


Hello,

Is there an emacs switch similar to vi's -R, or view equivalent?

I use emacs regularly but find "view this_file" very comforting,
e.g., sudo view /etc/aliases.  This forces me to ! the write as
an extra measure of safety.

My guess is that I need a special init file that gets loaded via an 
alias, i.e., "ev this_file".

Thanks,
Andrew

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

* Re: emacs switch similar to vi's -R, or view equivalent?
  2006-08-22 15:19 emacs switch similar to vi's -R, or view equivalent? Andrew B. Young
@ 2006-08-22 15:41 ` Peter Dyballa
  2006-08-22 16:03 ` William Xu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2006-08-22 15:41 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 22.08.2006 um 17:19 schrieb Andrew B. Young:

> Is there an emacs switch similar to vi's -R, or view equivalent?

Have you tried view-buffer (when file has already been opened) or  
view-file?

--
Greetings

   Pete

"We have to expect it, otherwise we would be surprised."

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

* Re: emacs switch similar to vi's -R, or view equivalent?
  2006-08-22 15:19 emacs switch similar to vi's -R, or view equivalent? Andrew B. Young
  2006-08-22 15:41 ` Peter Dyballa
@ 2006-08-22 16:03 ` William Xu
       [not found] ` <mailman.5455.1156268793.9609.help-gnu-emacs@gnu.org>
  2006-08-23 14:47 ` Kevin Rodgers
  3 siblings, 0 replies; 6+ messages in thread
From: William Xu @ 2006-08-22 16:03 UTC (permalink / raw)


"Andrew B. Young" <andrew@an3e.org> writes:

> My guess is that I need a special init file that gets loaded via an
> alias, i.e., "ev this_file".

You mean visting a file in read only mode?

M-x find-file-read-only

-- 
William

Barometer, n.:
	An ingenious instrument which indicates what kind of weather we
	are having.
		-- Ambrose Bierce, "The Devil's Dictionary"

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

* Re: emacs switch similar to vi's -R, or view equivalent?
       [not found] ` <mailman.5455.1156268793.9609.help-gnu-emacs@gnu.org>
@ 2006-08-23  1:51   ` Edward Dodge
  0 siblings, 0 replies; 6+ messages in thread
From: Edward Dodge @ 2006-08-23  1:51 UTC (permalink / raw)


William Xu <william.xwl@gmail.com> writes:

> "Andrew B. Young" <andrew@an3e.org> writes:
>
>> My guess is that I need a special init file that gets loaded via an
>> alias, i.e., "ev this_file".
>
> You mean visting a file in read only mode?
>
> M-x find-file-read-only

Better known as "C-x C-r"

-- 
Edward Dodge
          
   __o    
 _`\(,_   
(_)/ (_)  ---  --- 

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

* Re: emacs switch similar to vi's -R, or view equivalent?
  2006-08-22 15:19 emacs switch similar to vi's -R, or view equivalent? Andrew B. Young
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.5455.1156268793.9609.help-gnu-emacs@gnu.org>
@ 2006-08-23 14:47 ` Kevin Rodgers
  2006-08-23 15:37   ` Andrew B. Young
  3 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2006-08-23 14:47 UTC (permalink / raw)


Andrew B. Young wrote:
> Is there an emacs switch similar to vi's -R, or view equivalent?
> 
> I use emacs regularly but find "view this_file" very comforting,
> e.g., sudo view /etc/aliases.  This forces me to ! the write as
> an extra measure of safety.
> 
> My guess is that I need a special init file that gets loaded via an 
> alias, i.e., "ev this_file".

Here's a gem from 1997 
(http://groups.google.com/group/gnu.emacs.help/msg/46410ee284d11cc0):

(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

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

* Re: emacs switch similar to vi's -R, or view equivalent?
  2006-08-23 14:47 ` Kevin Rodgers
@ 2006-08-23 15:37   ` Andrew B. Young
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew B. Young @ 2006-08-23 15:37 UTC (permalink / raw)
  Cc: help-gnu-emacs

EXACTLY what I'm after!  Thanks so much Kevin.

Thanks also to Peter, William, and Edward for their helpful replies.
I am aware of their suggestions and that's what I have been doing for years.
But it's the command line switch I really wanted--saves keystrokes.

Cheers,
Andrew

Kevin Rodgers wrote:
> Andrew B. Young wrote:
>> Is there an emacs switch similar to vi's -R, or view equivalent?
>>
>> I use emacs regularly but find "view this_file" very comforting,
>> e.g., sudo view /etc/aliases.  This forces me to ! the write as
>> an extra measure of safety.
>>
>> My guess is that I need a special init file that gets loaded via an 
>> alias, i.e., "ev this_file".
>
> Here's a gem from 1997 
> (http://groups.google.com/group/gnu.emacs.help/msg/46410ee284d11cc0):
>
> (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)))))
>

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

end of thread, other threads:[~2006-08-23 15:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 15:19 emacs switch similar to vi's -R, or view equivalent? Andrew B. Young
2006-08-22 15:41 ` Peter Dyballa
2006-08-22 16:03 ` William Xu
     [not found] ` <mailman.5455.1156268793.9609.help-gnu-emacs@gnu.org>
2006-08-23  1:51   ` Edward Dodge
2006-08-23 14:47 ` Kevin Rodgers
2006-08-23 15:37   ` Andrew B. Young

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.