[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vc-register complains if a file is already registered in a git repos
Re: vc-register complains if a file is already registered in a git repository
Tue, 28 Oct 2008 10:21:52 -0700
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)
Stefan Monnier <address@hidden> 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 <foo> 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
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 51ccc5d..773e6d3 100644
@@ -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"))
(defun vc-git-extra-menu () vc-git-extra-menu-map)
@@ -681,6 +684,12 @@ This command shares argument histories with \\[rgrep] and
(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."
+ (vc-git-register buffer-file-name))
;;; Internal commands