diff options
| author | Juri Linkov | 2019-04-14 00:54:14 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-04-14 00:54:14 +0300 |
| commit | ed2b0bdfe24551d6a2f0497601f58faa17f24e3d (patch) | |
| tree | 3a3d1302bc800131363771c236c423cba41063f8 | |
| parent | 3a34f57c7e7ba355c1271c815213fb9c526b27f3 (diff) | |
| download | emacs-ed2b0bdfe24551d6a2f0497601f58faa17f24e3d.tar.gz emacs-ed2b0bdfe24551d6a2f0497601f58faa17f24e3d.zip | |
New faces in xref (bug#23179)
* lisp/progmodes/xref.el (xref-file-header, xref-line-number)
(xref-match): New faces.
(xref--insert-xrefs, xref--collect-matches-1): Use them.
| -rw-r--r-- | lisp/progmodes/xref.el | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index aed92f8db62..e5e59721eb3 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -448,6 +448,18 @@ If SELECT is non-nil, select the target window." | |||
| 448 | (defconst xref-buffer-name "*xref*" | 448 | (defconst xref-buffer-name "*xref*" |
| 449 | "The name of the buffer to show xrefs.") | 449 | "The name of the buffer to show xrefs.") |
| 450 | 450 | ||
| 451 | (defface xref-file-header '((t :inherit compilation-info)) | ||
| 452 | "Face used to highlight file header in the xref buffer." | ||
| 453 | :version "27.1") | ||
| 454 | |||
| 455 | (defface xref-line-number '((t :inherit compilation-line-number)) | ||
| 456 | "Face for displaying line numbers in the xref buffer." | ||
| 457 | :version "27.1") | ||
| 458 | |||
| 459 | (defface xref-match '((t :inherit highlight)) | ||
| 460 | "Face used to highlight matches in the xref buffer." | ||
| 461 | :version "27.1") | ||
| 462 | |||
| 451 | (defmacro xref--with-dedicated-window (&rest body) | 463 | (defmacro xref--with-dedicated-window (&rest body) |
| 452 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) | 464 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) |
| 453 | (xref-w-dedicated (window-dedicated-p xref-w))) | 465 | (xref-w-dedicated (window-dedicated-p xref-w))) |
| @@ -737,18 +749,17 @@ GROUP is a string for decoration purposes and XREF is an | |||
| 737 | for line-format = (and max-line-width | 749 | for line-format = (and max-line-width |
| 738 | (format "%%%dd: " max-line-width)) | 750 | (format "%%%dd: " max-line-width)) |
| 739 | do | 751 | do |
| 740 | (xref--insert-propertized '(face compilation-info) group "\n") | 752 | (xref--insert-propertized '(face xref-file-header) group "\n") |
| 741 | (cl-loop for (xref . more2) on xrefs do | 753 | (cl-loop for (xref . more2) on xrefs do |
| 742 | (with-slots (summary location) xref | 754 | (with-slots (summary location) xref |
| 743 | (let* ((line (xref-location-line location)) | 755 | (let* ((line (xref-location-line location)) |
| 744 | (prefix | 756 | (prefix |
| 745 | (if line | 757 | (if line |
| 746 | (propertize (format line-format line) | 758 | (propertize (format line-format line) |
| 747 | 'face 'compilation-line-number) | 759 | 'face 'xref-line-number) |
| 748 | " "))) | 760 | " "))) |
| 749 | (xref--insert-propertized | 761 | (xref--insert-propertized |
| 750 | (list 'xref-item xref | 762 | (list 'xref-item xref |
| 751 | ;; 'face 'font-lock-keyword-face | ||
| 752 | 'mouse-face 'highlight | 763 | 'mouse-face 'highlight |
| 753 | 'keymap xref--button-map | 764 | 'keymap xref--button-map |
| 754 | 'help-echo | 765 | 'help-echo |
| @@ -1159,7 +1170,7 @@ Such as the current syntax table and the applied syntax properties." | |||
| 1159 | (end-column (- (match-end 0) line-beg)) | 1170 | (end-column (- (match-end 0) line-beg)) |
| 1160 | (loc (xref-make-file-location file line beg-column)) | 1171 | (loc (xref-make-file-location file line beg-column)) |
| 1161 | (summary (buffer-substring line-beg line-end))) | 1172 | (summary (buffer-substring line-beg line-end))) |
| 1162 | (add-face-text-property beg-column end-column 'highlight | 1173 | (add-face-text-property beg-column end-column 'xref-match |
| 1163 | t summary) | 1174 | t summary) |
| 1164 | (push (xref-make-match summary loc (- end-column beg-column)) | 1175 | (push (xref-make-match summary loc (- end-column beg-column)) |
| 1165 | matches))) | 1176 | matches))) |