diff options
| author | Juri Linkov | 2018-12-18 01:11:15 +0200 |
|---|---|---|
| committer | Juri Linkov | 2018-12-18 01:11:15 +0200 |
| commit | 6973b1489b24ca4190d24be9e5f887aef2cc9eff (patch) | |
| tree | e3d85774e1b34de4f41103f84e511adcd5a3264d /lisp/vc/diff.el | |
| parent | c5e02f2bce28f3b1f2006ce1f208f4a92ca05ed9 (diff) | |
| download | emacs-6973b1489b24ca4190d24be9e5f887aef2cc9eff.tar.gz emacs-6973b1489b24ca4190d24be9e5f887aef2cc9eff.zip | |
Syntactic fontification of diff hunks (bug#33567)
* lisp/vc/diff-mode.el (diff-font-lock-syntax): New defcustom.
(diff-default-directory): New buffer-local variable.
(diff-indicator-removed, diff-indicator-added)
(diff-indicator-changed): Set foreground to distinctive colors.
(diff-context): Remove colors to make room for syntax highlighting.
(diff-font-lock-keywords): Add diff--font-lock-syntax.
(diff--font-lock-cleanup): Remove diff-mode syntax overlays.
(diff--font-lock-syntax, diff--font-lock-syntax--refresh)
(diff-syntax-fontify-revisions, diff-syntax-fontify-hunk)
(diff-syntax-fontify-props): New functions.
* lisp/vc/diff.el (diff-no-select): Set diff-default-directory to
default-directory.
* doc/emacs/files.texi (Diff Mode): Document diff-font-lock-syntax.
Diffstat (limited to 'lisp/vc/diff.el')
| -rw-r--r-- | lisp/vc/diff.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index ac94586cace..ed5b49d3bf4 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el | |||
| @@ -121,6 +121,8 @@ Possible values are: | |||
| 121 | nil -- no, it does not | 121 | nil -- no, it does not |
| 122 | check -- try to probe whether it does") | 122 | check -- try to probe whether it does") |
| 123 | 123 | ||
| 124 | (defvar diff-default-directory) | ||
| 125 | |||
| 124 | (defun diff-no-select (old new &optional switches no-async buf) | 126 | (defun diff-no-select (old new &optional switches no-async buf) |
| 125 | ;; Noninteractive helper for creating and reverting diff buffers | 127 | ;; Noninteractive helper for creating and reverting diff buffers |
| 126 | (unless (bufferp new) (setq new (expand-file-name new))) | 128 | (unless (bufferp new) (setq new (expand-file-name new))) |
| @@ -165,6 +167,7 @@ Possible values are: | |||
| 165 | (lambda (_ignore-auto _noconfirm) | 167 | (lambda (_ignore-auto _noconfirm) |
| 166 | (diff-no-select old new switches no-async (current-buffer)))) | 168 | (diff-no-select old new switches no-async (current-buffer)))) |
| 167 | (setq default-directory thisdir) | 169 | (setq default-directory thisdir) |
| 170 | (setq diff-default-directory default-directory) | ||
| 168 | (let ((inhibit-read-only t)) | 171 | (let ((inhibit-read-only t)) |
| 169 | (insert command "\n")) | 172 | (insert command "\n")) |
| 170 | (if (and (not no-async) (fboundp 'make-process)) | 173 | (if (and (not no-async) (fboundp 'make-process)) |