From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#3973: cleanup view-mode usage in vc-resynch-window Date: Thu, 30 Jul 2009 23:28:10 -0700 (PDT) Message-ID: <200907310628.n6V6SAS7014974@godzilla.ics.uci.edu> References: <200907300744.n6U7iwdl028160@godzilla.ics.uci.edu> <200907302206.n6UM6pBR008840@godzilla.ics.uci.edu> <200907310322.n6V3Mo26012548@godzilla.ics.uci.edu> Reply-To: Dan Nicolaescu , 3973@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249022827 13727 80.91.229.12 (31 Jul 2009 06:47:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Jul 2009 06:47:07 +0000 (UTC) Cc: 3973@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 31 08:46:59 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MWltL-0005Iq-Ip for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Jul 2009 08:46:59 +0200 Original-Received: from localhost ([127.0.0.1]:43170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWltL-0003pa-1J for geb-bug-gnu-emacs@m.gmane.org; Fri, 31 Jul 2009 02:46:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MWltF-0003p3-UA for bug-gnu-emacs@gnu.org; Fri, 31 Jul 2009 02:46:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MWltA-0003on-G2 for bug-gnu-emacs@gnu.org; Fri, 31 Jul 2009 02:46:52 -0400 Original-Received: from [199.232.76.173] (port=59905 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWltA-0003ok-9b for bug-gnu-emacs@gnu.org; Fri, 31 Jul 2009 02:46:48 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:26477) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MWlt9-0006G3-T1 for bug-gnu-emacs@gnu.org; Fri, 31 Jul 2009 02:46:48 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MWlt8-0006PQ-O7 for bug-gnu-emacs@gnu.org; Fri, 31 Jul 2009 02:46:47 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6V6kita029255; Thu, 30 Jul 2009 23:46:44 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n6V6Z7Pk028001; Thu, 30 Jul 2009 23:35:07 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Dan Nicolaescu Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 31 Jul 2009 06:35:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3973 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3973-submit@emacsbugs.donarmstrong.com id=B3973.124902171727350 (code B ref 3973); Fri, 31 Jul 2009 06:35:06 +0000 Original-Received: (at 3973) by emacsbugs.donarmstrong.com; 31 Jul 2009 06:28:37 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from barrelv2.ics.uci.edu (barrelv2.ics.uci.edu [128.195.1.114]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6V6SWj8027340 for <3973@emacsbugs.donarmstrong.com>; Thu, 30 Jul 2009 23:28:33 -0700 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by barrelv2.ics.uci.edu (8.13.8+Sun/8.13.8) with ESMTP id n6V6SASS005030; Thu, 30 Jul 2009 23:28:10 -0700 (PDT) Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n6V6SAS7014974; Thu, 30 Jul 2009 23:28:10 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Thu, 30 Jul 2009 23:43:39 -0400") Original-Lines: 49 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n6V6SASS005030 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Fri, 31 Jul 2009 02:46:52 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29755 Archived-At: Stefan Monnier writes: > >> > I have removed that code locally for a while and didn't see any > >> > problem. But I don't explicitly use view-mode, so... > >> > >> Obiously the code only makes a difference when you use view-read-only, > >> so you'll need to set it to a non-nil value before doing any test. > > > [I've never done anything with view-read-only before...] > > I set view-read-only to t, then played with a file under RCS. > > When the files is checked in view-mode is turned on, when checking it > > out it's turned off. > > > If the code in question is eliminated, view-mode stays turned on after > > checking out. > > > There's some code in `after-find-file' (that gets called from > > `revert-buffer') that looks like it does something very similar to the > > code in question here, but `after-find-file' is called with `nomodes' t, > > so that code does not trigger. > > So it seems the code is still needed. Maybe we could/should replace it > with something more clear: E.g. move that code to a new function > `view-refresh' (or whatever else), which we can then call from VC. The function would look like this: (defun view-maybe-enter-exit (file) (if (file-writable-p file) (and view-mode (let ((view-old-buffer-read-only nil)) (view-mode-exit))) (and (not view-mode) (not (eq (get major-mode 'mode-class) 'special)) (view-mode-enter)))) but the calling convention is strange: it needs to be called with a buffer selected and pass the file name... Not sure it's worth it. At least the TODO comment can go and be replaced with a comment about why changing the state of view-mode is needed there. > Maybe a better option in the longer term is refine the meaning of the > `preserve-modes' arg to revert-buffer, so that some minor modes can > request to be refreshed or not (the VC state is one that would also > benefit from such a change, as can be seen in auto-revert-mode). That sounds like a good idea. Unfortunately I am not familiar with that code, it is quite complex and critical, and I don't think it's too important to fix it now, so I'll punt.