From: Dan Nicolaescu <dann@ics.uci.edu>
To: esr@thyrsus.com
Cc: Jim Meyering <jim@meyering.net>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: C-x v v no longer works the way it used to
Date: Mon, 12 Nov 2007 07:32:50 -0800 [thread overview]
Message-ID: <ur9oddzxyvx.fsf@mothra.ics.uci.edu> (raw)
In-Reply-To: <200710210259.l9L2xo2x000826@oogie-boogie.ics.uci.edu> (Dan Nicolaescu's message of "Sat, 20 Oct 2007 19:59:42 -0700")
Dan Nicolaescu <dann@ics.uci.edu> writes:
> "Eric S. Raymond" <esr@thyrsus.com> writes:
>
> > Dan Nicolaescu <dann@ics.uci.edu>:
> > > This patch fixes it.
> > > vc-next-action still has the logic to deal with unregistered files,
> > > but vc-deduce-fileset would not return one...
> > > This patch is technically incorrect because it changes
> > > vc-deduce-fileset to not do what it's docs says it has to do.
> > > Not sure how the new VC design is supposed to work to fix it
> > > properly...
> >
> > You had the right general idea; the strategy has to go through
> > vc-deduce-fileset in order not to break the design. But your patch
> > produces behavior that won't be welcome in commands other than
> > vc-next-action, so I put the arm you added under control of
> > a new boolean argument ALLOW-UNREGISTERED.
>
> Now this points to another issue:
> vc-next-action does this:
>
> (mapc 'vc-register files))
>
> But vc-register is defined like this:
>
> (defun vc-register (&optional set-revision comment)
>
> i.e. it does not have a file parameter, it works on the current
> buffer.
>
> The easy fix would probably be to change the mapc call to do a
> with-current-buffer. But it might be better to change vc-register to
> take a fileset parameter...
Here's a patch that changes vc-register to take a file parameter. In the
end should take a fileset, but it seems better to first make sure that
the simpler case works.
Jim: this also should not ask the question about "Initial revision
level".
Should I check this in?
Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.480
diff -c -3 -p -c -r1.480 vc.el
*** vc.el 11 Nov 2007 14:55:55 -0000 1.480
--- vc.el 12 Nov 2007 15:19:51 -0000
*************** merge in the changes into your working c
*** 1535,1542 ****
(vc-call-backend backend 'create-repo))
;;;###autoload
! (defun vc-register (&optional set-revision comment)
! "Register the current file into a version control system.
With prefix argument SET-REVISION, allow user to specify initial revision
level. If COMMENT is present, use that as an initial comment.
--- 1535,1543 ----
(vc-call-backend backend 'create-repo))
;;;###autoload
! (defun vc-register (&optional fname set-revision comment)
! "Register into a version control system.
! If FNAME is given register that file, otherwise register the current file.
With prefix argument SET-REVISION, allow user to specify initial revision
level. If COMMENT is present, use that as an initial comment.
*************** directory are already registered under t
*** 1547,1586 ****
register the file. If no backend declares itself responsible, the
first backend that could register the file is used."
(interactive "P")
! (unless buffer-file-name (error "No visited file"))
! (when (vc-backend buffer-file-name)
! (if (vc-registered buffer-file-name)
! (error "This file is already registered")
! (unless (y-or-n-p "Previous master file has vanished. Make a new one? ")
! (error "Aborted"))))
! ;; Watch out for new buffers of size 0: the corresponding file
! ;; does not exist yet, even though buffer-modified-p is nil.
! (if (and (not (buffer-modified-p))
! (zerop (buffer-size))
! (not (file-exists-p buffer-file-name)))
! (set-buffer-modified-p t))
! (vc-buffer-sync)
! (vc-start-entry (list buffer-file-name)
! (if set-revision
! (read-string (format "Initial revision level for %s: "
! (buffer-name)))
! (vc-call-backend (vc-responsible-backend buffer-file-name)
! 'init-revision))
! (or comment (not vc-initial-comment))
! nil
! "Enter initial comment."
! (lambda (files rev comment)
! (dolist (file files)
! (message "Registering %s... " file)
! (let ((backend (vc-responsible-backend file t)))
! (vc-file-clearprops file)
! (vc-call-backend backend 'register (list file) rev comment)
! (vc-file-setprop file 'vc-backend backend)
! (unless vc-make-backup-files
! (make-local-variable 'backup-inhibited)
! (setq backup-inhibited t)))
! (message "Registering %s... done" file)))))
(defun vc-register-with (backend)
"Register the current file with a specified back end."
--- 1548,1591 ----
register the file. If no backend declares itself responsible, the
first backend that could register the file is used."
(interactive "P")
! (when (and (null fname) (null buffer-file-name)) (error "No visited file"))
! (let ((bname (if fname (get-file-buffer fname) buffer-file-name)))
! (unless fname (setq fname buffer-file-name))
! (when bname
! (with-current-buffer bname
! (when (vc-backend buffer-file-name)
! (if (vc-registered buffer-file-name)
! (error "This file is already registered")
! (unless (y-or-n-p "Previous master file has vanished. Make a new one? ")
! (error "Aborted"))))
! ;; Watch out for new buffers of size 0: the corresponding file
! ;; does not exist yet, even though buffer-modified-p is nil.
! (if (and (not (buffer-modified-p))
! (zerop (buffer-size))
! (not (file-exists-p buffer-file-name)))
! (set-buffer-modified-p t))
! (vc-buffer-sync)))
! (vc-start-entry (list fname)
! (if set-revision
! (read-string (format "Initial revision level for %s: "
! fname))
! (vc-call-backend (vc-responsible-backend fname)
! 'init-revision))
! (or comment (not vc-initial-comment))
! nil
! "Enter initial comment."
! (lambda (files rev comment)
! (dolist (file files)
! (message "Registering %s... " file)
! (let ((backend (vc-responsible-backend file t)))
! (vc-file-clearprops file)
! (vc-call-backend backend 'register (list file) rev comment)
! (vc-file-setprop file 'vc-backend backend)
! (unless vc-make-backup-files
! (make-local-variable 'backup-inhibited)
! (setq backup-inhibited t)))
! (message "Registering %s... done" file))))))
(defun vc-register-with (backend)
"Register the current file with a specified back end."
Diffs between working revision and workfile end here.
next prev parent reply other threads:[~2007-11-12 15:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-14 20:51 C-x v v no longer works the way it used to Jim Meyering
2007-10-14 21:01 ` Eric Hanchrow
2007-10-14 22:51 ` Miles Bader
2007-10-15 0:50 ` Stefan Monnier
2007-10-15 2:09 ` Eric S. Raymond
2007-10-19 23:21 ` Dan Nicolaescu
2007-10-20 16:56 ` Jim Meyering
2007-10-20 21:07 ` Eric S. Raymond
2007-10-21 2:59 ` Dan Nicolaescu
2007-11-12 15:32 ` Dan Nicolaescu [this message]
2007-11-13 16:48 ` Dan Nicolaescu
2007-11-14 10:54 ` Jim Meyering
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=ur9oddzxyvx.fsf@mothra.ics.uci.edu \
--to=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=esr@thyrsus.com \
--cc=jim@meyering.net \
--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 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.