unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 3973@emacsbugs.donarmstrong.com
Subject: bug#3973: cleanup view-mode usage in vc-resynch-window
Date: Thu, 30 Jul 2009 23:28:10 -0700 (PDT)	[thread overview]
Message-ID: <200907310628.n6V6SAS7014974@godzilla.ics.uci.edu> (raw)
In-Reply-To: <jwvbpn1sesi.fsf-monnier+emacsbugreports@gnu.org> (Stefan Monnier's message of "Thu, 30 Jul 2009 23:43:39 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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.





  reply	other threads:[~2009-07-31  6:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30  7:44 bug#3973: cleanup view-mode usage in vc-resynch-window Dan Nicolaescu
2009-07-30 21:14 ` Stefan Monnier
2009-07-30 22:06   ` Dan Nicolaescu
     [not found]     ` <jwv1vnxbowd.fsf-monnier+emacsbugreports@gnu.org>
2009-07-31  3:22       ` Dan Nicolaescu
2009-07-31  3:43         ` Stefan Monnier
2009-07-31  6:28           ` Dan Nicolaescu [this message]
2009-07-31 19:19             ` Stefan Monnier
2011-07-12 20:17               ` Lars Magne Ingebrigtsen

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=200907310628.n6V6SAS7014974@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=3973@emacsbugs.donarmstrong.com \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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