unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: emacs switch similar to vi's -R, or view equivalent?
Date: Wed, 23 Aug 2006 08:47:35 -0600	[thread overview]
Message-ID: <echpr9$64m$1@sea.gmane.org> (raw)
In-Reply-To: <44EB2081.8060100@an3e.org>

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

  parent reply	other threads:[~2006-08-23 14:47 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 [this message]
2006-08-23 15:37   ` Andrew B. Young

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='echpr9$64m$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /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.
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).