From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: C-x v v no longer works the way it used to Date: Mon, 12 Nov 2007 07:32:50 -0800 Message-ID: References: <87r6jxctcv.fsf@rho.meyering.net> <200710192321.l9JNLebF010003@oogie-boogie.ics.uci.edu> <20071020210750.GA7341@thyrsus.com> <200710210259.l9L2xo2x000826@oogie-boogie.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1194881716 17578 80.91.229.12 (12 Nov 2007 15:35:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Nov 2007 15:35:16 +0000 (UTC) Cc: Jim Meyering , Stefan Monnier , Emacs development discussions To: esr@thyrsus.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 12 16:35:20 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IrbJk-000726-M2 for ged-emacs-devel@m.gmane.org; Mon, 12 Nov 2007 16:35:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrbJY-0002cX-Bm for ged-emacs-devel@m.gmane.org; Mon, 12 Nov 2007 10:35:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IrbJU-0002cL-3F for emacs-devel@gnu.org; Mon, 12 Nov 2007 10:35:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IrbJS-0002b0-VR for emacs-devel@gnu.org; Mon, 12 Nov 2007 10:34:59 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IrbJS-0002av-LM for emacs-devel@gnu.org; Mon, 12 Nov 2007 10:34:58 -0500 Original-Received: from oogie-boogie.ics.uci.edu ([128.195.1.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IrbJR-0005Zp-TD for emacs-devel@gnu.org; Mon, 12 Nov 2007 10:34:58 -0500 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by oogie-boogie.ics.uci.edu (8.13.6/8.13.6) with ESMTP id lACFWo1O006730; Mon, 12 Nov 2007 07:32:52 -0800 (PST) In-Reply-To: <200710210259.l9L2xo2x000826@oogie-boogie.ics.uci.edu> (Dan Nicolaescu's message of "Sat, 20 Oct 2007 19:59:42 -0700") Original-Lines: 162 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=1.785, required 5, autolearn=disabled, ALL_TRUSTED -1.44, FS_SINGLE_LETTER 1.00, GAPPY_SUBJECT 1.62, J_CHICKENPOX_22 0.60) X-ICS-MailScanner-SpamScore: s X-ICS-MailScanner-From: dann@ics.uci.edu X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:83057 Archived-At: Dan Nicolaescu writes: > "Eric S. Raymond" writes: > > > Dan Nicolaescu : > > > 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.