From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phil Hagelberg Newsgroups: gmane.emacs.devel Subject: Re: vc-register complains if a file is already registered in a git repository Date: Tue, 28 Oct 2008 10:21:52 -0700 Message-ID: <87od147hzj.fsf@hagelb.org> References: <87prlvm2ms.fsf@hagelb.org> <873aipmvt6.fsf@hagelb.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225214570 25280 80.91.229.12 (28 Oct 2008 17:22:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2008 17:22:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 28 18:23:51 2008 connect(): Connection refused 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 1KusI9-0000tz-Rh for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2008 18:23:42 +0100 Original-Received: from localhost ([127.0.0.1]:58537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KusH2-0008O6-M4 for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2008 13:22:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KusGa-0008BH-7o for emacs-devel@gnu.org; Tue, 28 Oct 2008 13:22:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KusGW-00089I-OE for emacs-devel@gnu.org; Tue, 28 Oct 2008 13:22:03 -0400 Original-Received: from [199.232.76.173] (port=58516 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KusGW-000896-CI for emacs-devel@gnu.org; Tue, 28 Oct 2008 13:22:00 -0400 Original-Received: from sd-green-bigip-207.dreamhost.com ([208.97.132.207]:38108 helo=spunkymail-a4.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KusGV-0007D0-Uc for emacs-devel@gnu.org; Tue, 28 Oct 2008 13:22:00 -0400 Original-Received: from dynabook (unknown [64.81.164.191]) by spunkymail-a4.g.dreamhost.com (Postfix) with ESMTP id E16653B9BA; Tue, 28 Oct 2008 10:21:53 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 21 Oct 2008 21:37:21 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:105085 Archived-At: Stefan Monnier writes: >>> It would probably be better for vc-git to provide another command, for that. >>> We could probably add a `extra-keys' operation similar to `extra-menu' >>> so that vc-git can not only provide a new command but also provide >>> a specific C-x v key binding for it. > >> This would be great if we don't want to make the changes above. I can >> add it. Could I get some details about extra-menu though? I'm not >> familiar with it. > > Grep for extra-menu and extra-status-menu (which should be renamed > extra-dir-menu, BTW) in vc*.el. I've added the vc-git-register-changes command to vc-git-extra-menu-map and will start work on creating extra-keys functionality that works like extra-menu. -Phil diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 51ccc5d..773e6d3 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -622,6 +622,9 @@ or BRANCH^ (where \"^\" can be repeated)." (define-key map [git-grep] '(menu-item "Git grep..." vc-git-grep :help "Run the `git grep' command")) + (define-key map [git-register-changes] + '(menu-item "Register changes" vc-git-register-changes + :help "Register the changes in the current buffer")) map)) (defun vc-git-extra-menu () vc-git-extra-menu-map) @@ -681,6 +684,12 @@ This command shares argument histories with \\[rgrep] and \\[grep]." (compilation-start command 'grep-mode)) (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir)))))) + +(defun vc-git-register-changes () + "Register the changes in the current file to the staging area." + (interactive) + (vc-git-register buffer-file-name)) + ;;; Internal commands