|
44 | 44 | ;; - switching branches |
45 | 45 | ;; - revlist browser |
46 | 46 | ;; - git-show-branch browser |
47 | | -;; - customize support |
48 | 47 | ;; - menus |
49 | 48 | ;; |
50 | 49 |
|
51 | 50 | (eval-when-compile (require 'cl)) |
52 | 51 | (require 'ewoc) |
53 | 52 |
|
54 | 53 |
|
55 | | -;;;; Faces |
| 54 | +;;;; Customizations |
56 | 55 | ;;;; ------------------------------------------------------------ |
57 | 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 | + |
58 | 89 | (defface git-status-face |
59 | 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) |
61 | 93 |
|
62 | 94 | (defface git-unmerged-face |
63 | 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) |
65 | 98 |
|
66 | 99 | (defface git-unknown-face |
67 | 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) |
69 | 103 |
|
70 | 104 | (defface git-uptodate-face |
71 | 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) |
73 | 108 |
|
74 | 109 | (defface git-ignored-face |
75 | 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) |
77 | 113 |
|
78 | 114 | (defface git-mark-face |
79 | 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) |
81 | 118 |
|
82 | 119 | (defface git-header-face |
83 | 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) |
85 | 123 |
|
86 | 124 | (defface git-separator-face |
87 | 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) |
89 | 128 |
|
90 | 129 | (defface git-permission-face |
91 | 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) |
112 | 133 |
|
113 | 134 |
|
114 | 135 | ;;;; Utilities |
115 | 136 | ;;;; ------------------------------------------------------------ |
116 | 137 |
|
| 138 | +(defconst git-log-msg-separator "--- log message follows this line ---") |
| 139 | + |
117 | 140 | (defun git-get-env-strings (env) |
118 | 141 | "Build a list of NAME=VALUE strings from a list of environment strings." |
119 | 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'. |
279 | 302 | (with-current-buffer buffer |
280 | 303 | (goto-char (point-min)) |
281 | 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)) |
283 | 306 | (save-restriction |
284 | 307 | (narrow-to-region (point-min) log-start) |
285 | 308 | (goto-char (point-min)) |
|
0 commit comments