From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dan Jacobson Newsgroups: gmane.emacs.bugs Subject: view-read-only causes read-write Date: Thu, 17 Apr 2003 09:59:22 +0800 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87r88128at.fsf@jidanni.org> Reply-To: Dan Jacobson NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1050547998 10277 80.91.224.249 (17 Apr 2003 02:53:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 17 Apr 2003 02:53:18 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 17 04:53:14 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 195zVw-0002dj-00 for ; Thu, 17 Apr 2003 04:52:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 195zVw-0001Wr-03 for gnu-bug-gnu-emacs@m.gmane.org; Wed, 16 Apr 2003 22:52:40 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 195zVp-0001Ss-00 for bug-gnu-emacs@gnu.org; Wed, 16 Apr 2003 22:52:33 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 195zVg-0001BA-00 for bug-gnu-emacs@gnu.org; Wed, 16 Apr 2003 22:52:25 -0400 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 195zVX-0000qI-00 for bug-gnu-emacs@gnu.org; Wed, 16 Apr 2003 22:52:15 -0400 Original-Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 195zTp-0002Z1-00 for ; Thu, 17 Apr 2003 04:50:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: bug-gnu-emacs@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 195zC1-0001gh-00 for ; Thu, 17 Apr 2003 04:32:05 +0200 Original-Lines: 47 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4825 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4825 I did $ emacs --no-site-file -q -nw -eval ' (and(setq view-read-only t) (describe-variable (quote view-read-only)))' Notes: 1. Ok, the help buffer says View mode in the modeline, but how about turning on the -%%- marker in the modeline? 2. Hey, real view-mode doesn't let me eat text with C-k etc, and then you can't repair the damage with undo because no undo record is kept for that buffer. 3. OK, trying again without messing first with view-read-only gives what one expects. Do I smell someone toggling read-only once too much? 4. view-read-only's docstring: "*Non-nil means buffers visiting files read-only, do it in view mode." (P.S. I assume the "*" means "Chef's choice".) OK, but what about read-only buffers not visiting files? Obviously you are over affecting those and at the same time not mentioning them. P.S. I am no lisp pro but above I had to use an "(and ...)" or else only one sexp was used, without any warning to the user. PSS, while we are here, let's examine this docstring: toggle-read-only is an interactive compiled Lisp function in `files'. (toggle-read-only &optional ARG) Change whether this buffer is visiting its file read-only. With arg, set read-only iff arg is positive. Ok, but it doesn't say what will happen if you give it a non positive arg. One can't just assume "common sense". E.g. me, any common sense and I wouldn't be hanging around this pop stand. If visiting file read-only and `view-read-only' is non-nil, enter view mode. Hold on a second. We came here to toggle-read-only and like wham, we are sent into view mode. It's like I do "chmod -w file" and wham, "more file" is invoked as a free bonus. What if I am a batch job? Anyway, docsting looks bad. Didn't check the code. -- http://jidanni.org/ Taiwan(04)25854780