From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Re: junk in *grep* buffers Date: Tue, 10 May 2005 13:36:43 -0400 Message-ID: References: <873bswvyd0.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115746434 5590 80.91.229.2 (10 May 2005 17:33:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 May 2005 17:33:54 +0000 (UTC) Cc: Juri Linkov , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 10 19:33:50 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVYbC-000408-7z for ged-emacs-devel@m.gmane.org; Tue, 10 May 2005 19:32:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVYjl-00082P-P3 for ged-emacs-devel@m.gmane.org; Tue, 10 May 2005 13:41:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DVYhr-0006iN-RL for emacs-devel@gnu.org; Tue, 10 May 2005 13:39:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DVYho-0006fN-9y for emacs-devel@gnu.org; Tue, 10 May 2005 13:39:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVYhn-0006em-Hp for emacs-devel@gnu.org; Tue, 10 May 2005 13:39:39 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DVYlH-00064k-5w; Tue, 10 May 2005 13:43:15 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 7F8BC34000E; Tue, 10 May 2005 13:36:48 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 00FE14AC008; Tue, 10 May 2005 13:36:44 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id E22CDE6C16; Tue, 10 May 2005 13:36:43 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Tue, 10 May 2005 12:26:01 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.839, requis 5, autolearn=not spam, AWL 0.06, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36953 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36953 > The following hack fixes the problem, but this is an imperfect solution. > It sets the local variable `pos' from `font-lock-fontify-keywords-region' > to avoid changing the current position on the line: > Could the code in font-lock-fontify-keywords-region use a marker to > maintain that position? Then it would be relocated automatically. Would the patch below do the trick? Stefan --- font-lock.el 05 mai 2005 16:09:23 -0400 1.245 +++ font-lock.el 10 mai 2005 13:35:07 -0400 @@ -1405,6 +1405,7 @@ (let ((case-fold-search font-lock-keywords-case-fold-search) (keywords (cddr font-lock-keywords)) (bufname (buffer-name)) (count 0) + (pos (make-marker)) keyword matcher highlights) ;; ;; Fontify each item in `font-lock-keywords' from `start' to `end'. @@ -1439,12 +1440,13 @@ (while highlights (if (numberp (car (car highlights))) (font-lock-apply-highlight (car highlights)) - (let ((pos (point))) + (set-marker pos (point)) (font-lock-fontify-anchored-keywords (car highlights) end) ;; Ensure forward progress. - (if (< (point) pos) (goto-char pos)))) + (if (< (point) pos) (goto-char pos))) (setq highlights (cdr highlights)))) - (setq keywords (cdr keywords))))) + (setq keywords (cdr keywords))) + (set-marker pos nil))) ;;; End of Keyword regexp fontification functions.