Skip to content

Commit a79656e

Browse files
julliardJunio C Hamano
authored andcommitted
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>
1 parent 45033ad commit a79656e

File tree

1 file changed

+54
-31
lines changed

1 file changed

+54
-31
lines changed

contrib/emacs/git.el

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,76 +44,99 @@
4444
;; - switching branches
4545
;; - revlist browser
4646
;; - git-show-branch browser
47-
;; - customize support
4847
;; - menus
4948
;;
5049

5150
(eval-when-compile (require 'cl))
5251
(require 'ewoc)
5352

5453

55-
;;;; Faces
54+
;;;; Customizations
5655
;;;; ------------------------------------------------------------
5756

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+
5889
(defface git-status-face
5990
'((((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)
6193

6294
(defface git-unmerged-face
6395
'((((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)
6598

6699
(defface git-unknown-face
67100
'((((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)
69103

70104
(defface git-uptodate-face
71105
'((((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)
73108

74109
(defface git-ignored-face
75110
'((((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)
77113

78114
(defface git-mark-face
79115
'((((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)
81118

82119
(defface git-header-face
83120
'((((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)
85123

86124
(defface git-separator-face
87125
'((((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)
89128

90129
(defface git-permission-face
91130
'((((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)
112133

113134

114135
;;;; Utilities
115136
;;;; ------------------------------------------------------------
116137

138+
(defconst git-log-msg-separator "--- log message follows this line ---")
139+
117140
(defun git-get-env-strings (env)
118141
"Build a list of NAME=VALUE strings from a list of environment strings."
119142
(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'.
279302
(with-current-buffer buffer
280303
(goto-char (point-min))
281304
(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))
283306
(save-restriction
284307
(narrow-to-region (point-min) log-start)
285308
(goto-char (point-min))

0 commit comments

Comments
 (0)