1 |
;;; diff-mode.el --- a mode for viewing/editing context diffs |
;;; diff-mode.el --- a mode for viewing/editing context diffs |
2 |
|
|
3 |
;; Copyright (C) 1998,1999,2000,01,02,03,2004 Free Software Foundation, Inc. |
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
4 |
|
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Stefan Monnier <monnier@cs.yale.edu> |
;; Author: Stefan Monnier <monnier@cs.yale.edu> |
7 |
;; Keywords: convenience patch diff |
;; Keywords: convenience patch diff |
172 |
|
|
173 |
(defface diff-header-face |
(defface diff-header-face |
174 |
'((((class color) (min-colors 88) (background light)) |
'((((class color) (min-colors 88) (background light)) |
175 |
(:background "grey85")) |
:background "grey85") |
176 |
(((class color) (min-colors 88) (background dark)) |
(((class color) (min-colors 88) (background dark)) |
177 |
(:background "grey45")) |
:background "grey45") |
178 |
(((class color) (background light)) |
(((class color) (background light)) |
179 |
(:foreground "blue1" :weight bold)) |
:foreground "blue1" :weight bold) |
180 |
(((class color) (background dark)) |
(((class color) (background dark)) |
181 |
(:foreground "green" :weight bold)) |
:foreground "green" :weight bold) |
182 |
(t (:weight bold))) |
(t :weight bold)) |
183 |
"`diff-mode' face inherited by hunk and index header faces.") |
"`diff-mode' face inherited by hunk and index header faces.") |
184 |
(defvar diff-header-face 'diff-header-face) |
(defvar diff-header-face 'diff-header-face) |
185 |
|
|
186 |
(defface diff-file-header-face |
(defface diff-file-header-face |
187 |
'((((class color) (min-colors 88) (background light)) |
'((((class color) (min-colors 88) (background light)) |
188 |
(:background "grey70" :weight bold)) |
:background "grey70" :weight bold) |
189 |
(((class color) (min-colors 88) (background dark)) |
(((class color) (min-colors 88) (background dark)) |
190 |
(:background "grey60" :weight bold)) |
:background "grey60" :weight bold) |
191 |
(((class color) (background light)) |
(((class color) (background light)) |
192 |
(:foreground "yellow" :weight bold)) |
:foreground "yellow" :weight bold) |
193 |
(((class color) (background dark)) |
(((class color) (background dark)) |
194 |
(:foreground "cyan" :weight bold)) |
:foreground "cyan" :weight bold) |
195 |
(t (:weight bold))) ; :height 1.3 |
(t :weight bold)) ; :height 1.3 |
196 |
"`diff-mode' face used to highlight file header lines.") |
"`diff-mode' face used to highlight file header lines.") |
197 |
(defvar diff-file-header-face 'diff-file-header-face) |
(defvar diff-file-header-face 'diff-file-header-face) |
198 |
|
|
199 |
(defface diff-index-face |
(defface diff-index-face |
200 |
'((t (:inherit diff-file-header-face))) |
'((t :inherit diff-file-header-face)) |
201 |
"`diff-mode' face used to highlight index header lines.") |
"`diff-mode' face used to highlight index header lines.") |
202 |
(defvar diff-index-face 'diff-index-face) |
(defvar diff-index-face 'diff-index-face) |
203 |
|
|
204 |
(defface diff-hunk-header-face |
(defface diff-hunk-header-face |
205 |
'((t (:inherit diff-header-face))) |
'((t :inherit diff-header-face)) |
206 |
"`diff-mode' face used to highlight hunk header lines.") |
"`diff-mode' face used to highlight hunk header lines.") |
207 |
(defvar diff-hunk-header-face 'diff-hunk-header-face) |
(defvar diff-hunk-header-face 'diff-hunk-header-face) |
208 |
|
|
209 |
(defface diff-removed-face |
(defface diff-removed-face |
210 |
'((t (:inherit diff-changed-face))) |
'((t :inherit diff-changed-face)) |
211 |
"`diff-mode' face used to highlight removed lines.") |
"`diff-mode' face used to highlight removed lines.") |
212 |
(defvar diff-removed-face 'diff-removed-face) |
(defvar diff-removed-face 'diff-removed-face) |
213 |
|
|
214 |
(defface diff-added-face |
(defface diff-added-face |
215 |
'((t (:inherit diff-changed-face))) |
'((t :inherit diff-changed-face)) |
216 |
"`diff-mode' face used to highlight added lines.") |
"`diff-mode' face used to highlight added lines.") |
217 |
(defvar diff-added-face 'diff-added-face) |
(defvar diff-added-face 'diff-added-face) |
218 |
|
|
219 |
(defface diff-changed-face |
(defface diff-changed-face |
220 |
'((((type tty pc) (class color) (background light)) |
'((((type tty pc) (class color) (background light)) |
221 |
(:foreground "magenta" :weight bold :slant italic)) |
:foreground "magenta" :weight bold :slant italic) |
222 |
(((type tty pc) (class color) (background dark)) |
(((type tty pc) (class color) (background dark)) |
223 |
(:foreground "yellow" :weight bold :slant italic)) |
:foreground "yellow" :weight bold :slant italic)) |
|
(t ())) |
|
224 |
"`diff-mode' face used to highlight changed lines.") |
"`diff-mode' face used to highlight changed lines.") |
225 |
(defvar diff-changed-face 'diff-changed-face) |
(defvar diff-changed-face 'diff-changed-face) |
226 |
|
|
227 |
(defface diff-function-face |
(defface diff-function-face |
228 |
'((t (:inherit diff-context-face))) |
'((t :inherit diff-context-face)) |
229 |
"`diff-mode' face used to highlight function names produced by \"diff -p\".") |
"`diff-mode' face used to highlight function names produced by \"diff -p\".") |
230 |
(defvar diff-function-face 'diff-function-face) |
(defvar diff-function-face 'diff-function-face) |
231 |
|
|
232 |
(defface diff-context-face |
(defface diff-context-face |
233 |
'((((class color) (background light)) |
'((((class color) (background light)) |
234 |
(:foreground "grey50")) |
:foreground "grey50") |
235 |
(((class color) (background dark)) |
(((class color) (background dark)) |
236 |
(:foreground "grey70")) |
:foreground "grey70")) |
|
(t )) |
|
237 |
"`diff-mode' face used to highlight context and other side-information.") |
"`diff-mode' face used to highlight context and other side-information.") |
238 |
(defvar diff-context-face 'diff-context-face) |
(defvar diff-context-face 'diff-context-face) |
239 |
|
|
240 |
(defface diff-nonexistent-face |
(defface diff-nonexistent-face |
241 |
'((t (:inherit diff-file-header-face))) |
'((t :inherit diff-file-header-face)) |
242 |
"`diff-mode' face used to highlight nonexistent files in recursive diffs.") |
"`diff-mode' face used to highlight nonexistent files in recursive diffs.") |
243 |
(defvar diff-nonexistent-face 'diff-nonexistent-face) |
(defvar diff-nonexistent-face 'diff-nonexistent-face) |
244 |
|
|
1254 |
(save-excursion |
(save-excursion |
1255 |
(when (looking-at diff-hunk-header-re) |
(when (looking-at diff-hunk-header-re) |
1256 |
(forward-line 1) |
(forward-line 1) |
1257 |
(while (and (looking-at " ") (not (zerop (forward-line 1)))))) |
(re-search-forward "^[^ ]" nil t)) |
1258 |
(destructuring-bind (buf line-offset pos src dst &optional switched) |
(destructuring-bind (buf line-offset pos src dst &optional switched) |
1259 |
(diff-find-source-location) |
(diff-find-source-location) |
1260 |
(beginning-of-line) |
(beginning-of-line) |
1354 |
;; use `combine-after-change-calls' to minimize the slowdown of font-lock. |
;; use `combine-after-change-calls' to minimize the slowdown of font-lock. |
1355 |
;; |
;; |
1356 |
|
|
1357 |
;;; arch-tag: 2571d7ff-bc28-4cf9-8585-42e21890be66 |
;; arch-tag: 2571d7ff-bc28-4cf9-8585-42e21890be66 |
1358 |
;;; diff-mode.el ends here |
;;; diff-mode.el ends here |