git.el: Added customize support for all parameters.
Also fixed quoting of git-log-msg-separator. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Alexandre Julliard committed
Mar 4, 2006 at 17:38 UTC
a79656e6af627d40d934ba8b73f58b816a9f0ac1
1 file changed
+54
-31
contrib/emacs/git.el
+54
-31
@@ -44,7 +44,6 @@
44
;; - switching branches
45
;; - revlist browser
46
;; - git-show-branch browser
47
-;; - customize support
47
;; - menus
48
;;
49
@@ -52,68 +51,92 @@
51
(require 'ewoc)
52
53
55
-;;;; Faces
54
+;;;; Customizations
55
;;;; ------------------------------------------------------------
56
57
+(defgroup git nil
58
+ "Git user interface")
59
+
60
+(defcustom git-committer-name nil
61
+ "User name to use for commits.
62
+The default is to fall back to `add-log-full-name' and then `user-full-name'."
63
+ :group 'git
64
+ :type '(choice (const :tag "Default" nil)
65
+ (string :tag "Name")))
66
+
67
+(defcustom git-committer-email nil
68
+ "Email address to use for commits.
69
+The default is to fall back to `add-log-mailing-address' and then `user-mail-address'."
70
+ :group 'git
71
+ :type '(choice (const :tag "Default" nil)
72
+ (string :tag "Email")))
73
+
74
+(defcustom git-commits-coding-system 'utf-8
75
+ "Default coding system for the log message of git commits."
76
+ :group 'git
77
+ :type 'coding-system)
78
+
79
+(defcustom git-append-signed-off-by nil
80
+ "Whether to append a Signed-off-by line to the commit message before editing."
81
+ :group 'git
82
+ :type 'boolean)
83
+
84
+(defcustom git-per-dir-ignore-file ".gitignore"
85
+ "Name of the per-directory ignore file."
86
+ :group 'git
87
+ :type 'string)
88
+
89
(defface git-status-face
90
'((((class color) (background light)) (:foreground "purple")))
60
- "Git mode face used to highlight added and modified files.")
91
+ "Git mode face used to highlight added and modified files."
92
+ :group 'git)
93
94
(defface git-unmerged-face
95
'((((class color) (background light)) (:foreground "red" :bold t)))
64
- "Git mode face used to highlight unmerged files.")
96
+ "Git mode face used to highlight unmerged files."
97
+ :group 'git)
98
99
(defface git-unknown-face
100
'((((class color) (background light)) (:foreground "goldenrod" :bold t)))
68
- "Git mode face used to highlight unknown files.")
101
+ "Git mode face used to highlight unknown files."
102
+ :group 'git)
103
104
(defface git-uptodate-face
105
'((((class color) (background light)) (:foreground "grey60")))
72
- "Git mode face used to highlight up-to-date files.")
106
+ "Git mode face used to highlight up-to-date files."
107
+ :group 'git)
108
109
(defface git-ignored-face
110
'((((class color) (background light)) (:foreground "grey60")))
76
- "Git mode face used to highlight ignored files.")
111
+ "Git mode face used to highlight ignored files."
112
+ :group 'git)
113
114
(defface git-mark-face
115
'((((class color) (background light)) (:foreground "red" :bold t)))
80
- "Git mode face used for the file marks.")
116
+ "Git mode face used for the file marks."
117
+ :group 'git)
118
119
(defface git-header-face
120
'((((class color) (background light)) (:foreground "blue")))
84
- "Git mode face used for commit headers.")
121
+ "Git mode face used for commit headers."
122
+ :group 'git)
123
124
(defface git-separator-face
125
'((((class color) (background light)) (:foreground "brown")))
88
- "Git mode face used for commit separator.")
126
+ "Git mode face used for commit separator."
127
+ :group 'git)
128
129
(defface git-permission-face
130
'((((class color) (background light)) (:foreground "green" :bold t)))
92
- "Git mode face used for permission changes.")
93
-
94
-(defvar git-committer-name nil
95
- "*User name to use for commits.
96
-If not set, fall back to `add-log-full-name' and then `user-full-name'.")
97
-
98
-(defvar git-committer-email nil
99
- "*Email address to use for commits.
100
-If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.")
101
-
102
-(defvar git-commits-coding-system 'utf-8
103
- "Default coding system for git commits.")
104
-
105
-(defvar git-append-signed-off-by nil
106
- "Whether to append a Signed-off-by line to the commit message.")
107
-
108
-(defconst git-log-msg-separator "--- log message follows this line ---")
109
-
110
-(defconst git-per-dir-ignore-file ".gitignore"
111
- "Name of the per-directory ignore file.")
131
+ "Git mode face used for permission changes."
132
+ :group 'git)
133
134
135
;;;; Utilities
136
;;;; ------------------------------------------------------------
137
138
+(defconst git-log-msg-separator "--- log message follows this line ---")
139
+
140
(defun git-get-env-strings (env)
141
"Build a list of NAME=VALUE strings from a list of environment strings."
142
(mapcar (lambda (entry) (concat (car entry) "=" (cdr entry))) env))
@@ -279,7 +302,7 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
302
(with-current-buffer buffer
303
(goto-char (point-min))
304
(if
282
- (setq log-start (re-search-forward (concat "^" git-log-msg-separator "\n") nil t))
305
+ (setq log-start (re-search-forward (concat "^" (regexp-quote git-log-msg-separator) "\n") nil t))
306
(save-restriction
307
(narrow-to-region (point-min) log-start)
308
(goto-char (point-min))