Skip to contentSkip to conversation

Try to do things in the right order

PATCH In review Xavier Maillard 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 5/7 Try to do things in the right order

* emacs/vc-git.el: Added an ugly hack to properly reload vc-git. Only add GIT to vc-backends list after loading vc. Do not walk .git directory (add it to the exclusion-list).

Changed installation instructions as discussed on Git mailing list

---
 contrib/emacs/vc-git.el |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
contrib/emacs/vc-git.el +14 -3
index 748cb60..3f37e6d 100644
@@ -22,7 +22,8 @@
 ;; This file contains a VC backend for the git version control
 ;; system.
 ;;
-;; To install: put this file on the load-path.
+;; To install: put this file on the load-path then add this line into
+;;   your .emacs: (require 'vc-git)
 ;;
 ;; TODO
 ;;  - changelog generation
@@ -35,8 +36,14 @@
   (require 'vc)
   (require 'cl))
 
-;; Add it automatically
-(add-to-list 'vc-handled-backends 'GIT)
+;; HACK: clear up the cache to force vc-call to check again and
+;; discover new functions when we reload this file.
+(put 'GIT 'vc-functions nil)
+
+;; Add it automatically when loading vc
+;; FIXME: should be directly put into vc.el
+(eval-after-load "vc"
+  '(add-to-list 'vc-handled-backends 'GIT))
 
 (defgroup vc-git nil
   "*This is GIT backend for vc."
@@ -188,4 +195,8 @@ COMMENT is the new comment."
 ;;;###autoload
 (add-to-list 'completion-ignored-extensions ".git/")
 
+(eval-after-load "vc" 
+    '(add-to-list 'vc-directory-exclusion-list ".git" t))
+
 (provide 'vc-git)
+;;; vc-git.el ends here
\ No newline at end of file
Signature · 1 line
1.5.0
#1 lore raw
Quoted 4 lines · Xavier Maillard
contrib/emacs/vc-git.el +0 -0
@@ -35,8 +36,14 @@
   (require 'vc)
   (require 'cl))
 

contrib/emacs/vc-git.el line 46

Quoted 10 lines
contrib/emacs/vc-git.el +8 -2
-;; Add it automatically
-(add-to-list 'vc-handled-backends 'GIT)
+;; HACK: clear up the cache to force vc-call to check again and
+;; discover new functions when we reload this file.
+(put 'GIT 'vc-functions nil)
+
+;; Add it automatically when loading vc
+;; FIXME: should be directly put into vc.el
+(eval-after-load "vc"
+  '(add-to-list 'vc-handled-backends 'GIT))

That's ugly. Simply recommending that users set vc-handled-backends in their .emacs is easier and cleaner, I still don't see why you want to change it.

Signature · 2 lines
Alexandre Julliard
[email protected]
#2 lore raw

From: Alexandre Julliard <[email protected]>

Quoted 4 lines · Xavier Maillard
contrib/emacs/vc-git.el +0 -0
@@ -35,8 +36,14 @@
   (require 'vc)
   (require 'cl))
 

contrib/emacs/vc-git.el line 46

Quoted 10 lines
contrib/emacs/vc-git.el +8 -2
-;; Add it automatically
-(add-to-list 'vc-handled-backends 'GIT)
+;; HACK: clear up the cache to force vc-call to check again and
+;; discover new functions when we reload this file.
+(put 'GIT 'vc-functions nil)
+
+;; Add it automatically when loading vc
+;; FIXME: should be directly put into vc.el
+(eval-after-load "vc"
+  '(add-to-list 'vc-handled-backends 'GIT))

That's ugly. Simply recommending that users set vc-handled-backends in their .emacs is easier and cleaner, I still don't see why you want to change it.

I'd rather want to just require or load vc-git (and that should not be the way to go too since it should be automatically handled by vc.el when vc-git will become part of GNU Emacs ).

By the way, do you plan to ask for inclusion into emacs ?

That's just a matter of taste, nothing more.

Signature · 1 line
Xavier