diff options
author | Jim Porter <jporterbugs@gmail.com> | 2021-09-22 18:37:52 -0700 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-09-23 22:57:53 +0200 |
commit | ceb9da3b7125fbdf0da04a3b158ac1e792c87f4f (patch) | |
tree | f91d3765040ae169efbb6bf1e0001dc1e4ae1a5f /lisp/man.el | |
parent | 55083d90a30628d9eaa5b94196291ca15098aed0 (diff) | |
download | emacs-ceb9da3b7125fbdf0da04a3b158ac1e792c87f4f.tar.gz |
Add support for "bright" ANSI colors in ansi-color
* lisp/ansi-color.el (ansi-color-bold, ansi-color-faint, ansi-color-italic)
(ansi-color-underline, ansi-color-slow-blink, ansi-color-fast-blink)
(ansi-color-inverse, ansi-color-red, ansi-color-green, ansi-color-yellow)
(ansi-color-blue, ansi-color-magenta, ansi-color-cyan, ansi-color-white)
(ansi-color-bright-red, ansi-color-bright-green, ansi-color-bright-yellow)
(ansi-color-bright-blue, ansi-color-bright-magenta, ansi-color-bright-cyan)
(ansi-color-bright-white): New faces.
(ansi-color-basic-faces-vector, ansi-color-normal-colors-vector)
(ansi-color-bright-colors-vector): New constants.
(ansi-color-faces-vector, ansi-color-names-vector): Make obsolete.
(ansi-color-bold-is-bright): New defcustom.
(ansi-color--find-face): Sort ANSI codes and check
'ansi-color-bold-is-bright'.
(ansi-color-apply-sequence): Support bright ANSI colors.
(ansi-color-make-color-map, ansi-color-map, ansi-color-map-update):
Make obsolete.
(ansi-color-get-face-1): Add BRIGHT parameter.
* lisp/man.el (Man-ansi-color-basic-faces-vector): New variable.
(Man-ansi-color-map): Make obsolete.
(Man-fontify-manpage): Use 'Man-ansi-color-basic-faces-vector' here.
* test/lisp/ansi-color-tests.el
(ansi-color-apply-on-region-bold-is-bright-test): New function.
Diffstat (limited to 'lisp/man.el')
-rw-r--r-- | lisp/man.el | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/man.el b/lisp/man.el index 6009a319198..84287c9f9d4 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -141,11 +141,21 @@ the manpage buffer." :group 'man :version "24.3") -(defvar Man-ansi-color-map (let ((ansi-color-faces-vector - [ default Man-overstrike default Man-underline - Man-underline default default Man-reverse ])) - (ansi-color-make-color-map)) - "The value used here for `ansi-color-map'.") +(defvar Man-ansi-color-basic-faces-vector + [nil Man-overstrike nil Man-underline Man-underline nil nil Man-reverse] + "The value used here for `ansi-color-basic-faces-vector'.") + +(defvar Man-ansi-color-map + (with-no-warnings + (let ((ansi-color-faces-vector Man-ansi-color-basic-faces-vector)) + [ default Man-overstrike default Man-underline + Man-underline default default Man-reverse ])) + (ansi-color-make-color-map))) + "The value formerly used here for `ansi-color-map'. +This variable is obsolete. To customize the faces used by ansi-color, +set `Man-ansi-color-basic-faces-vector'.") +(make-obsolete-variable 'Man-ansi-color-map + 'Man-ansi-color-basic-faces-vector "28.1") (defcustom Man-notify-method 'friendly "Selects the behavior when manpage is ready. @@ -1243,7 +1253,7 @@ Same for the ANSI bold and normal escape sequences." (goto-char (point-min)) ;; Fontify ANSI escapes. (let ((ansi-color-apply-face-function #'ansi-color-apply-text-property-face) - (ansi-color-map Man-ansi-color-map)) + (ansi-color-basic-faces-vector Man-ansi-color-basic-faces-vector)) (ansi-color-apply-on-region (point-min) (point-max))) ;; Other highlighting. (let ((buffer-undo-list t)) |