From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50806: 27.2; [PATCH] Optimize ansi-color.el Date: Sun, 26 Sep 2021 00:32:36 +0200 Message-ID: <87tui8wakb.fsf@miha-pc> Reply-To: miha@kamnitnik.top Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40953"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jim Porter To: 50806@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 26 00:30:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mUGBR-000ANN-Ir for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Sep 2021 00:30:14 +0200 Original-Received: from localhost ([::1]:38906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUGBP-000321-Dz for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Sep 2021 18:30:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUGBH-00031p-Nn for bug-gnu-emacs@gnu.org; Sat, 25 Sep 2021 18:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUGBH-0006oq-Fb for bug-gnu-emacs@gnu.org; Sat, 25 Sep 2021 18:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mUGBH-0002e6-5y for bug-gnu-emacs@gnu.org; Sat, 25 Sep 2021 18:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: miha@kamnitnik.top Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Sep 2021 22:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50806 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163260896810060 (code B ref -1); Sat, 25 Sep 2021 22:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Sep 2021 22:29:28 +0000 Original-Received: from localhost ([127.0.0.1]:35029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUGAh-0002c8-8b for submit@debbugs.gnu.org; Sat, 25 Sep 2021 18:29:28 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUGAe-0002by-HP for submit@debbugs.gnu.org; Sat, 25 Sep 2021 18:29:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUGAd-0002ze-S9 for bug-gnu-emacs@gnu.org; Sat, 25 Sep 2021 18:29:24 -0400 Original-Received: from kamnitnik.top ([209.250.245.214]:33178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUGAa-0006Jh-8z for bug-gnu-emacs@gnu.org; Sat, 25 Sep 2021 18:29:23 -0400 Original-Received: from localhost (unknown [IPv6:2a00:ee2:e04:9300:e18:5d33:4bd1:d3a4]) by kamnitnik.top (Postfix) with ESMTPSA id 94AD99C700; Sat, 25 Sep 2021 22:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kamnitnik.top; s=mail; t=1632608955; bh=XLzF216Tm97yYUYIei7EVroWgt/3FhhoJCZnPo8MVe0=; h=From:To:Cc:Subject:Date:From; b=ETBIZTcwYexGub0l3ddSJU5whKUZEgIJ2hvd6ARrAW5X19zOvX4AffwIWwyOmPlXm l1m2AYzk/rlU8l9zvK5MHdfo45n+L29Z+M8dWs8nz5q8g5Bfm6FLCoQbk2QGUTNZaE xJuiYiifzlYgCBxrHDRhcmswb1fz47YrCRg/qmx+MV9Ws9a9R+9Gr4FRVJuLWd7UjG dN4jLUEVvsMq9t9koY1cE85hXa5E8Ldh8FysZt4EMoCtWK4g60oHXemRPvE/W4vyBP kcOORc+6QQCVhubGYA5HQeGOEAQqic2xqs011hMq/YnJMSSiMQ61qkz8LCtN3PeetW N30QqoHhg+pbA== Received-SPF: pass client-ip=209.250.245.214; envelope-from=miha@kamnitnik.top; helo=kamnitnik.top X-Spam_score_int: 24 X-Spam_score: 2.4 X-Spam_bar: ++ X-Spam_report: (2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.498, FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=1.997, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:215530 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Attached patch speeds up ansi-color. It tries to eliminate as many allocations (cons and list) as possible. Benchmarks, recorded in emacs -q, are in the second attachments. With the patch applied, there is a 26% speedup in elapsed time, mostly because the garbage collector has to take care of less allocations. Two less important side notes: 1) This patch additionally makes it very straight forward to add support for ANSI color codes 38 and 48 allowing 256-colors and 24bit full-color. I plan to submit such a patch later (for both ansi-color and term-mode). 2) Two vector variables, that were recently added by Jim, were merged into one. Adding him as CC. Best regards. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Optimize-ansi-color.el.patch Content-Transfer-Encoding: quoted-printable From=209b40c13dd83a1c9336ba2eadf90041c07acb82a1 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miha=3D20Rihtar=3DC5=3DA1i=3DC4=3D8D?=3D Date: Sat, 25 Sep 2021 23:05:11 +0200 Subject: [PATCH 1/3] Optimize ansi-color.el * lisp/ansi-color.el (ansi-color-normal-colors-vector): (ansi-color-bright-colors-vector): Merge these two vectors into one. (ansi-color-context-region): (ansi-color-context): Adjust doc string to the new format of ansi-color context. (ansi-color--find-face): Rename to ansi-color--face-vec-face (ansi-color--face-vec-face): Adjust to the new format ansi-color context. (ansi-color-apply): (ansi-color-apply-on-region): Adjust to the new format of ansi-color context in order to speed these two functions up (ansi-color-apply-sequence): Make it obsolete (ansi-color--update-face-vec): New function to handle the new format of ansi-color context. (ansi-color-get-face-1): Make obsolete as this function isn't used any more. =2D-- lisp/ansi-color.el | 308 ++++++++++++++++++++++++++++++--------------- 1 file changed, 206 insertions(+), 102 deletions(-) diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index b1c9cdaeca..d9d6f1c78d 100644 =2D-- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -288,7 +288,7 @@ ansi-color-basic-faces-vector 6 rapidly blinking 7 negative image") =20 =2D(defvar ansi-color-normal-colors-vector +(defvar ansi-color-colors-vector [ansi-color-black ansi-color-red ansi-color-green @@ -296,12 +296,26 @@ ansi-color-normal-colors-vector ansi-color-blue ansi-color-magenta ansi-color-cyan =2D ansi-color-white] + ansi-color-white + + ansi-color-bright-black + 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] + "Faces used for SGR control sequences determining a color. =2DThis vector holds the faces used for SGR control sequence parameters =2D30 to 37 (foreground colors) and 40 to 47 (background colors). +The first eight elements are faces used for SGR control sequence +parameters 30 to 37 (foreground colors) and 40 to 47 (background +colors). The second eight elements are the faces used for SGR +control sequence parameters 90 to 97 (bright foreground colors) +and 100 to 107 (bright background colors). =20 Parameter Color + 30 40 black 31 41 red 32 42 green @@ -309,23 +323,8 @@ ansi-color-normal-colors-vector 34 44 blue 35 45 magenta 36 46 cyan =2D 37 47 white") =2D =2D(defvar ansi-color-bright-colors-vector =2D [ansi-color-bright-black =2D ansi-color-bright-red =2D ansi-color-bright-green =2D ansi-color-bright-yellow =2D ansi-color-bright-blue =2D ansi-color-bright-magenta =2D ansi-color-bright-cyan =2D ansi-color-bright-white] =2D "Faces used for SGR control sequences determining a \"bright\" color. =2DThis vector holds the faces used for SGR control sequence parameters =2D90 to 97 (bright foreground colors) and 100 to 107 (bright background =2Dcolors). + 37 47 white =20 =2DParameter Color 90 100 bright black 91 101 bright red 92 102 bright green @@ -458,11 +457,18 @@ 'ansi-color-unfontify-region ;; Working with strings (defvar-local ansi-color-context nil "Context saved between two calls to `ansi-color-apply'. =2DThis is a list of the form (CODES FRAGMENT) or nil. CODES +This is a list of the form (FACE-VEC FRAGMENT) or nil. FACE-VEC represents the state the last call to `ansi-color-apply' ended =2Dwith, currently a list of ansi codes, and FRAGMENT is a string =2Dstarting with an escape sequence, possibly the start of a new =2Descape sequence.") +with, currently a list of the form + +(BASIC-FACES FG BG). + +BASIC-FACES is a bool-vector that specifies which basic faces +from `ansi-color-basic-faces-vector' to apply. FG and BG are +ANSI color codes for the foreground and background color. + +FRAGMENT is a string starting with an escape sequence, possibly +the start of a new escape sequence.") =20 (defun ansi-color-filter-apply (string) "Filter out all ANSI control sequences from STRING. @@ -494,20 +500,39 @@ ansi-color-filter-apply (setq ansi-color-context (if fragment (list nil fragment)))) (apply #'concat (nreverse result)))) =20 =2D(defun ansi-color--find-face (codes) =2D "Return the face corresponding to CODES." =2D ;; Sort the codes in ascending order to guarantee that "bold" comes be= fore =2D ;; any of the colors. This ensures that `ansi-color-bold-is-bright' is =2D ;; applied correctly. =2D (let (faces bright (codes (sort (copy-sequence codes) #'<))) =2D (while codes =2D (when-let ((face (ansi-color-get-face-1 (pop codes) bright))) =2D (when (and ansi-color-bold-is-bright (eq face 'ansi-color-bold)) =2D (setq bright t)) =2D (push face faces))) +(defun ansi-color--face-vec-face (face-vec) + "Return the face corresponding to FACE-VEC. +FACE-VEC is a list containing information about the ANSI sequence +code. It is usually stored as the car of the variable +`ansi-color-context-region'." + (let* ((basic-faces (car face-vec)) + (colors (cdr face-vec)) + (bright (and ansi-color-bold-is-bright (aref basic-faces 1))) + (faces nil)) + + (when-let ((fg (car colors))) + (push + `(:foreground + ,(face-foreground + (aref ansi-color-colors-vector (logior (if bright 8 0) fg)) + nil 'default)) + faces)) + (when-let ((bg (cadr colors))) + (push + `(:background + ,(face-background + (aref ansi-color-colors-vector (logior (if bright 8 0) bg)) + nil 'default)) + faces)) + + (let ((i 8)) + (while (> i 0) + (setq i (1- i)) + (when (aref basic-faces i) + (push (aref ansi-color-basic-faces-vector i) faces)))) ;; Avoid some long-lived conses in the common case. (if (cdr faces) =2D (nreverse faces) + faces (car faces)))) =20 (defun ansi-color-apply (string) @@ -524,49 +549,71 @@ ansi-color-apply Set `ansi-color-context' to nil if you don't want this. =20 This function can be added to `comint-preoutput-filter-functions'." =2D (let ((codes (car ansi-color-context)) =2D (start 0) end result) + (let* ((context + (or ansi-color-context + (setq ansi-color-context + (list + (list + ;; 8 slots for the basic faces + (make-bool-vector 8 nil) + ;; 2 slots for fg and bg number + nil nil) + "")))) + (face-vec (car context)) + (start 0) + end result) ;; If context was saved and is a string, prepend it. =2D (if (cadr ansi-color-context) =2D (setq string (concat (cadr ansi-color-context) string) =2D ansi-color-context nil)) + (setq string (concat (cadr context) string)) + (setcar (cdr context) "") ;; Find the next escape sequence. (while (setq end (string-match ansi-color-control-seq-regexp string st= art)) (let ((esc-end (match-end 0))) ;; Colorize the old block from start to end using old face. =2D (when codes + (when-let ((face (ansi-color--face-vec-face face-vec))) (put-text-property start end 'font-lock-face =2D (ansi-color--find-face codes) string)) + face string)) (push (substring string start end) result) (setq start (match-end 0)) ;; If this is a color escape sequence, (when (eq (aref string (1- esc-end)) ?m) ;; create a new face from it. =2D (setq codes (ansi-color-apply-sequence =2D (substring string end esc-end) codes))))) + (let ((cur-pos end)) + (ansi-color--update-face-vec + face-vec + (lambda () + (when (string-match ansi-color-parameter-regexp + string cur-pos) + (setq cur-pos (match-end 0)) + (when (<=3D cur-pos esc-end) + (string-to-number (match-string 1 string)))))))))) ;; if the rest of the string should have a face, put it there =2D (when codes + (when-let ((face (ansi-color--face-vec-face face-vec))) (put-text-property start (length string) =2D 'font-lock-face (ansi-color--find-face codes) s= tring)) + 'font-lock-face face string)) ;; save context, add the remainder of the string to the result =2D (let (fragment) =2D (if (string-match "\033" string start) =2D (let ((pos (match-beginning 0))) =2D (setq fragment (substring string pos)) =2D (push (substring string start pos) result)) =2D (push (substring string start) result)) =2D (setq ansi-color-context (if (or codes fragment) (list codes fragm= ent)))) + (if (string-match "\033" string start) + (let ((pos (match-beginning 0))) + (setcar (cdr context) (substring string pos)) + (push (substring string start pos) result)) + (push (substring string start) result)) (apply 'concat (nreverse result)))) =20 ;; Working with regions =20 (defvar-local ansi-color-context-region nil "Context saved between two calls to `ansi-color-apply-on-region'. =2DThis is a list of the form (CODES MARKER) or nil. CODES +This is a list of the form (FACE-VEC MARKER) or nil. FACE-VEC represents the state the last call to `ansi-color-apply-on-region' =2Dended with, currently a list of ansi codes, and MARKER is a =2Dbuffer position within an escape sequence or the last position =2Dprocessed.") +ended with, currently a list of the form + +(BASIC-FACES FG BG). + +BASIC-FACES is a bool-vector that specifies which basic faces +from `ansi-color-basic-faces-vector' to apply. FG and BG are +ANSI color codes for the foreground and background color. + +MARKER is a buffer position within an escape sequence or the last +position processed.") =20 (defun ansi-color-filter-region (begin end) "Filter out all ANSI control sequences from region BEGIN to END. @@ -608,58 +655,63 @@ ansi-color-apply-on-region =20 If PRESERVE-SEQUENCES is t, the sequences are hidden instead of being deleted." =2D (let ((codes (car ansi-color-context-region)) =2D (start-marker (or (cadr ansi-color-context-region) =2D (copy-marker begin))) =2D (end-marker (copy-marker end))) + (let* ((context + (or ansi-color-context-region + (setq ansi-color-context-region + (list + (list + ;; 8 slots for the basic faces + (make-bool-vector 8 nil) + ;; 2 slots for fg and bg numbers + nil nil) + (copy-marker begin))))) + (face-vec (car context)) + (start-marker (cadr context)) + (end-marker (copy-marker end))) (save-excursion (goto-char start-marker) ;; Find the next escape sequence. (while (re-search-forward ansi-color-control-seq-regexp end-marker t) ;; Extract escape sequence. =2D (let ((esc-seq (buffer-substring =2D (match-beginning 0) (point)))) =2D (if preserve-sequences =2D ;; Make the escape sequence transparent. =2D (overlay-put (make-overlay (match-beginning 0) (point)) =2D 'invisible t) =2D ;; Otherwise, strip. =2D (delete-region (match-beginning 0) (point))) =2D + (let ((esc-beg (match-beginning 0)) + (esc-end (point))) ;; Colorize the old block from start to end using old face. (funcall ansi-color-apply-face-function (prog1 (marker-position start-marker) ;; Store new start position. =2D (set-marker start-marker (point))) =2D (match-beginning 0) (ansi-color--find-face codes)) + (set-marker start-marker esc-end)) + esc-beg (ansi-color--face-vec-face face-vec)) ;; If this is a color sequence, =2D (when (eq (aref esc-seq (1- (length esc-seq))) ?m) =2D ;; update the list of ansi codes. =2D (setq codes (ansi-color-apply-sequence esc-seq codes))))) + (when (eq (char-before esc-end) ?m) + (goto-char esc-beg) + (ansi-color--update-face-vec + face-vec (lambda () + (when (re-search-forward ansi-color-parameter-rege= xp + esc-end t) + (string-to-number (match-string 1)))))) + + (if preserve-sequences + ;; Make the escape sequence transparent. + (overlay-put (make-overlay esc-beg esc-end) 'invisible t) + ;; Otherwise, strip. + (delete-region esc-beg esc-end)))) ;; search for the possible start of a new escape sequence (if (re-search-forward "\033" end-marker t) =2D (progn =2D ;; if the rest of the region should have a face, put it there =2D (funcall ansi-color-apply-face-function =2D start-marker (point) (ansi-color--find-face codes)) =2D ;; save codes and point =2D (setq ansi-color-context-region =2D (list codes (copy-marker (match-beginning 0))))) =2D ;; if the rest of the region should have a face, put it there =2D (funcall ansi-color-apply-face-function =2D start-marker end-marker (ansi-color--find-face codes)) =2D ;; Save a restart position when there are codes active. It's =2D ;; convenient for man.el's process filter to pass `begin' =2D ;; positions that overlap regions previously colored; these =2D ;; `codes' should not be applied to that overlap, so we need =2D ;; to know where they should really start. =2D (setq ansi-color-context-region =2D (if codes (list codes (copy-marker (point))))))) =2D ;; Clean up our temporary markers. =2D (unless (eq start-marker (cadr ansi-color-context-region)) =2D (set-marker start-marker nil)) =2D (unless (eq end-marker (cadr ansi-color-context-region)) =2D (set-marker end-marker nil)))) + (progn + (while (re-search-forward "\033" end-marker t)) + (backward-char)) + (goto-char end-marker)) + (funcall ansi-color-apply-face-function + start-marker (point) + (ansi-color--face-vec-face face-vec)) + ;; Save a restart position when there are codes active. It's + ;; convenient for man.el's process filter to pass `begin' + ;; positions that overlap regions previously colored; these + ;; `codes' should not be applied to that overlap, so we need + ;; to know where they should really start. + (set-marker start-marker (point))) + ;; Clean up our temporary marker. + (set-marker end-marker nil))) =20 (defun ansi-color-apply-overlay-face (beg end face) "Make an overlay from BEG to END, and apply face FACE. @@ -767,6 +819,7 @@ ansi-color-apply-sequence is 40-47 (or 100-107) resp. 49, the background color code is replaced or added resp. deleted; any other code is discarded together with the old codes. Finally, the so changed list of codes is returned." + (declare (obsolete "it isn't used any more." "28.1")) (let ((new-codes (ansi-color-parse-sequence escape-sequence))) (while new-codes (let* ((new (pop new-codes)) @@ -795,6 +848,56 @@ ansi-color-apply-sequence (_ nil))))) codes)) =20 +(defun ansi-color--update-face-vec (face-vec iterator) + "Apply escape sequences to FACE-VEC. + +Destructively modify FACE-VEC, which should be a list containing +face information. It is described in +`ansi-color-context-region'. ITERATOR is a function which is +called repeatedly with zero arguments and should return either +the next ANSI code in the current sequence as a number or nil if +there are no more ANSI codes left + +For each new code, the following happens: if it is 1-7, set the +corresponding properties; if it is 21-25 or 27, unset appropriate +properties; if it is 30-37 (or 90-97) or resp. 39, set the +foreground color or resp. unset it; if it is 40-47 (or 100-107) +resp. 49, set the background color or resp. unset it; if it is 38 +or 48, the following codes are used to set the foreground or +background color and the correct color mode; any other code will +unset all properties and colors." + (let ((basic-faces (car face-vec)) + (colors (cdr face-vec)) + new q do-clear) + (while (setq new (funcall iterator)) + (setq q (/ new 10)) + (pcase q + (0 (if (memq new '(0 8 9)) + (setq do-clear t) + (aset basic-faces new t))) + (2 (if (memq new '(20 26 28 29)) + (setq do-clear t) + ;; The standard says `21 doubly underlined' while + ;; https://en.wikipedia.org/wiki/ANSI_escape_code claims + ;; `21 Bright/Bold: off or Underline: Double'. + (aset basic-faces (- new 20) nil) + (aset basic-faces (pcase new (22 1) (25 6) (_ 0)) nil))) + ((or 3 4 9 10) + (let ((r (mod new 10)) + (cell (if (memq q '(3 9)) colors (cdr colors)))) + (pcase r + (8 (setq do-clear t)) + (9 (setcar cell nil)) + (_ (setcar cell (+ (if (memq q '(3 4)) 0 8) r)))))) + (_ (setq do-clear t))) + + (when do-clear + (setq do-clear nil) + ;; Zero out our bool vector without any allocation + (bool-vector-intersection basic-faces #&8"\0" basic-faces) + (setcar colors nil) + (setcar (cdr colors) nil))))) + (defun ansi-color-make-color-map () "Create a vector of face definitions and return it. =20 @@ -859,6 +962,7 @@ ansi-color-get-face-1 "Get face definition for ANSI-CODE. BRIGHT, if non-nil, requests \"bright\" ANSI colors, even if ANSI-CODE is a normal-intensity color." + (declare (obsolete "it isn't used any more." "28.1")) (when (and bright (<=3D 30 ansi-code 49)) (setq ansi-code (+ ansi-code 60))) (cond ((<=3D 0 ansi-code 7) @@ -866,22 +970,22 @@ ansi-color-get-face-1 ((<=3D 30 ansi-code 38) (list :foreground (face-foreground =2D (aref ansi-color-normal-colors-vector (- ansi-code 30)) + (aref ansi-color-colors-vector (- ansi-code 30)) nil 'default))) ((<=3D 40 ansi-code 48) (list :background (face-background =2D (aref ansi-color-normal-colors-vector (- ansi-code 40)) + (aref ansi-color-colors-vector (- ansi-code 40)) nil 'default))) ((<=3D 90 ansi-code 98) (list :foreground (face-foreground =2D (aref ansi-color-bright-colors-vector (- ansi-code 90)) + (aref ansi-color-colors-vector (+ 8 (- ansi-code 90))) nil 'default))) ((<=3D 100 ansi-code 108) (list :background (face-background =2D (aref ansi-color-bright-colors-vector (- ansi-code 100)) + (aref ansi-color-colors-vector (+ 8 (- ansi-code 100))) nil 'default))))) =20 (provide 'ansi-color) =2D-=20 2.33.0 --=-=-= Content-Type: application/vnd.lotus-organizer Content-Disposition: attachment; filename=ansi-color-benchmark.org Content-Transfer-Encoding: base64 SW4gb3JnLW1vZGUsIHByZXNzIEMtYyBDLWMgb24gdGhlIGZvbGxvd2luZyBzb3VyY2UgYmxvY2sg dG8gcHJvZHVjZSBhCm5ldyBiZW5jaG1hcmsgcmVzdWx0LgoKIytiZWdpbl9zcmMgZW1hY3MtbGlz cCA6cmVzdWx0cyBhcHBlbmQKICAocmVxdWlyZSAnYW5zaS1jb2xvcikKICAoZXZhbC13aGVuLWNv bXBpbGUKICAgIChyZXF1aXJlICdjbC1saWIpKQoKICAoZGVmdW4gYW5zaS1jb2xvci1iZW5jaC1y YW5kb20tZXNjLXNlcSAoKQogICAgKGNvbmNhdAogICAgICJcZVsiCiAgICAgKG1hcGNvbmNhdAog ICAgICAjJ2lkZW50aXR5CiAgICAgIChjbC1sb29wCiAgICAgICBmb3IgaSBiZWxvdyAocmFuZG9t IDEyKQogICAgICAgY29sbGVjdAogICAgICAgKHBjYXNlIChyYW5kb20gNikKICAgICAgICAgKDAg KG51bWJlci10by1zdHJpbmcgKDErIChyYW5kb20gNykpKSkKICAgICAgICAgKDEgKG51bWJlci10 by1zdHJpbmcgKCsgMjEgKHJhbmRvbSA3KSkpKQogICAgICAgICAoMiAobnVtYmVyLXRvLXN0cmlu ZyAoKyAzMCAocmFuZG9tIDgpKSkpCiAgICAgICAgICgzIChudW1iZXItdG8tc3RyaW5nICgrIDQw IChyYW5kb20gOCkpKSkKICAgICAgICAgKDQgKG51bWJlci10by1zdHJpbmcgKCsgOTAgKHJhbmRv bSA4KSkpKQogICAgICAgICAoNSAobnVtYmVyLXRvLXN0cmluZyAoKyAxMDAgKHJhbmRvbSA4KSkp KSkpCiAgICAgICI7IikKICAgICAibSIpKQoKICAod2l0aC10ZW1wLWJ1ZmZlcgogICAgKGRvdGlt ZXMgKF8gNTAwMDApCiAgICAgIChpbnNlcnQgKGFuc2ktY29sb3ItYmVuY2gtcmFuZG9tLWVzYy1z ZXEpKQogICAgICAoaW5zZXJ0ICJhYmNkZSIpKQogICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkK ICAgIChsZXQgKChhbnNpLWNvbG9yLWFwcGx5LWZhY2UtZnVuY3Rpb24gIydhbnNpLWNvbG9yLWFw cGx5LXRleHQtcHJvcGVydHktZmFjZSkpCiAgICAgIChiZW5jaG1hcmstcnVuLWNvbXBpbGVkIDEK ICAgICAgICAod2hpbGUgKG5vdCAoZW9icCkpCiAgICAgICAgICAoYW5zaS1jb2xvci1hcHBseS1v bi1yZWdpb24KICAgICAgICAgICAocG9pbnQpCiAgICAgICAgICAgKHByb2duIChnb3RvLWNoYXIg KCsgKHBvaW50KSAocmFuZG9tIDQwMCkpKSAocG9pbnQpKSkpKSkpCiMrZW5kX3NyYwoKIytSRVNV TFRTOgp8ICAgICAgIEVsYXBzZWQgdGltZSB8IEdDcyB8ICAgICAgICAgICAgR0MgdGltZSB8Cnwt LS0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLXwKfCAgICAgICAg IFdpdGggcGF0Y2ggfCAgICAgfCAgICAgICAgICAgICAgICAgICAgfAp8LS0tLS0tLS0tLS0tLS0t LS0tLS0rLS0tLS0rLS0tLS0tLS0tLS0tLS0tLS0tLS18CnwgMi4wODEwNTgwNzIwMDAwMDAzIHwg IDE5IHwgMC44ODA5ODYyODE5OTk5OTg1IHwKfCAgICAgICAgMi4wODQzODIxNjggfCAgMTggfCAw Ljg5MjAyMjA0MzAwMDAwMDggfAp8IDIuMDMwNDc4MTAxMDAwMDAwNCB8ICAxNyB8IDAuODQzMTUx MDg5OTk5OTk5MiB8CnwgICAgICAgIDIuMDg3OTkwMzc5IHwgIDE4IHwgMC44OTc3NTE3NTIwMDAw MDEzIHwKfCAyLjA3ODAzOTg4MDAwMDAwMDQgfCAgMTggfCAwLjg5MDI1NDM1OTAwMDAwMzYgfAp8 LS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0rLS0tLS0tLS0tLS0tLS0tLS0tLS18CnwgICAgICBX aXRob3V0IHBhdGNoIHwgICAgIHwgICAgICAgICAgICAgICAgICAgIHwKfC0tLS0tLS0tLS0tLS0t LS0tLS0tKy0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tfAp8IDIuODQzMTk5MTk5MDAwMDAwMyB8 ICAzMSB8IDEuNTAwNTMyMjM1OTk5OTk4OSB8CnwgICAgICAgICAyLjc4OTE2ODcyIHwgIDI4IHwg ICAgICAgIDEuNDU3MDA3NjM0IHwKfCAyLjc4Nzc0NDM3Njk5OTk5OTcgfCAgMjggfCAxLjQ0OTQ5 OTI3NDAwMDAwMDggfAp8ICAgICAgICAgMi44MDcxNTc5NSB8ICAyOCB8IDEuNDU3NTAzMjkzOTk5 OTk4NiB8CnwgICAgICAgIDIuNzkxNzMyMjQ1IHwgIDI4IHwgMS40NTYxOTc2ODQ5OTk5OTk0IHwK --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCAAxFiEEmxVnesoT5rQXvVXnswkaGpIVmT8FAmFPo4QTHG1paGFAa2Ft bml0bmlrLnRvcAAKCRCzCRoakhWZP7heEADAhI/VD7idYJgGLNGlzAfHYqTgJRa8 WFvpGeJ+ASiZkJjfx+34xYlfGz1OO+5E1Qur1VShPx/mNoFI5YJpdPWbh+tAdtna q1oOMkqqiVIrT6Se6bK9ugdOhFp0y7JIwr4UT6emvxtHMLKtLcubursZynJxfjfZ +Q/P1pYljRlLDDrx4B2HERwCJOs9fa+0gHFKzgtN0G5dSEkiXqzO0zIpgTZL1w3j /yPRtAXLyfGuOFd4qzKhsrm68CCIw3xrawkyCvCHZTmYFdsF2U1jctgbHo2HvMbU cvQdgMJTdmMqDURP6GKe/J0BDEuZvJ0X6doBRu0VTD7I44OS6GCI/6O7O2M9CZRc 46LjqVnVc+vI7BJ1mOEgLY4x5C4oH67uZa3sDaTzCQLYRd3sjRfGyAza8qFx0vln eAx6vs4m8xVgAYOrYdaR3j1UE4k5oY6np9XKWKs2ygY2O5fNtZIVTPFfeQg3i024 9U1rXfUIc8V3cXAtrB0oHMrAYtyT37IdjEnRm+j6hHZyvQmKexyBFL4Hm3fIyrD+ dXYnhbtsoNkWlNVtqVlovQTLO6TLs7KBwdC42+bVVTZSjuGYVbz5q5xSMN0nAljK +jkCh8tT82P+3XkROcxUh4IhbofMQbrJ6u/Gju+X4k62cNDZOJ3hr92fIxJEPft1 XPr9WELoWQKQnQ== =5WLh -----END PGP SIGNATURE----- --==-=-=--