From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7089: 23.2; slow ansi-color-apply Date: Thu, 23 Sep 2010 11:38:05 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285240288 23168 80.91.229.12 (23 Sep 2010 11:11:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Sep 2010 11:11:28 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 23 13:11:27 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyji2-000746-5p for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Sep 2010 13:11:26 +0200 Original-Received: from localhost ([127.0.0.1]:45486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oyji1-0005zf-Hk for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Sep 2010 07:11:25 -0400 Original-Received: from [140.186.70.92] (port=53731 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oyjhn-0005vZ-SF for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 07:11:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oyjhi-0000DE-59 for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 07:11:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58242) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyjhi-0000D9-21 for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 07:11:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OyjPF-0001zd-OE; Thu, 23 Sep 2010 06:52:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Sep 2010 10:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7089 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.12852390977648 (code B ref -1); Thu, 23 Sep 2010 10:52:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Sep 2010 10:51:37 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyjOq-0001zJ-Ea for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:51:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyjOn-0001zC-Pg for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:51:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyjRJ-00058r-Rt for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:54:11 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:49757) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyjRJ-00058n-P9 for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:54:09 -0400 Original-Received: from [140.186.70.92] (port=40072 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyjRI-00035G-A6 for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:54:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyjBv-0001QA-Fa for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:38:16 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:49710) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyjBv-0001Py-6B for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:38:15 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OyjBt-0001iK-4d for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 12:38:13 +0200 Original-Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 12:38:13 +0200 Original-Received: from sdl.web by cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 12:38:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.4) Cancel-Lock: sha1:A2I97ErAM8FfeAczt7oo/2zmv3I= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 23 Sep 2010 06:52:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40378 Archived-At: The following version fixed some glitches in setting ansi-color-context. Also I have received an email from Alex that welcomes the improvement. Let me know if I should send a patch in. (defun ansi-color-apply* (string) "A more efficient implementation of `ansi-color-apply' (which see)." (let ((face (car ansi-color-context)) start end fragment escape-sequence) ;; If context was saved and is a string, prepend it. (if (cadr ansi-color-context) (setq string (concat (cadr ansi-color-context) string) ansi-color-context nil)) (prog1 (with-temp-buffer (insert string) (setq start (point-min-marker)) (goto-char start) (while (re-search-forward ansi-color-drop-regexp nil t) (replace-match "")) (goto-char start) ;; Find the next escape sequence. (while (re-search-forward ansi-color-regexp nil t) (setq end (match-beginning 0)) (when face (put-text-property start end 'ansi-color t) (put-text-property start end 'face face)) (setq start (copy-marker (match-end 0))) (setq escape-sequence (match-string 1)) (replace-match "") (setq face (ansi-color-apply-sequence escape-sequence face))) ;; search for the possible start of a new escape sequence (if (re-search-forward "\033" nil t) (setq fragment (delete-and-extract-region (match-beginning 0) (point-max)))) ;; if the rest of the string should have a face, put it there (when face (put-text-property start (point-max) 'ansi-color t) (put-text-property start (point-max) 'face face)) ;; return the string (buffer-string)) ;; save context; NB: ansi-color-context is buffer-local so set it after ;; return to the original buffer (if (or face fragment) (setq ansi-color-context (list face fragment)) (setq ansi-color-context nil))))) Leo