all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andrew B. Young" <andrew@an3e.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: emacs switch similar to vi's -R, or view equivalent?
Date: Wed, 23 Aug 2006 08:37:46 -0700	[thread overview]
Message-ID: <44EC764A.604@an3e.org> (raw)
In-Reply-To: <echpr9$64m$1@sea.gmane.org>

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

      reply	other threads:[~2006-08-23 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=44EC764A.604@an3e.org \
    --to=andrew@an3e.org \
    --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.