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: CPerl-mode bug [Re: Relation with package authors (CPerl-mode follow-ups)] Date: Wed, 29 Jun 2005 04:00:23 -0400 Message-ID: <87mzp9bnrm.fsf-monnier+emacs@gnu.org> References: <1115190893.4278766d8332a@imp5-q.free.fr> <87wtqdn563.fsf-monnier+emacs@gnu.org> <87wtq6olso.fsf@marant.org> <877jgrj22g.fsf_-_@marant.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120038051 27140 80.91.229.2 (29 Jun 2005 09:40:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Jun 2005 09:40:51 +0000 (UTC) Cc: Ilya Zakharevich , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 29 11:40:48 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DnZ3h-0001Q3-JR for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2005 11:40:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnZBi-0002vi-QS for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2005 05:48:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DnYqM-00011b-R6 for emacs-devel@gnu.org; Wed, 29 Jun 2005 05:26:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DnYqG-0000xo-4Z for emacs-devel@gnu.org; Wed, 29 Jun 2005 05:26:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DnYqF-0000wc-UM for emacs-devel@gnu.org; Wed, 29 Jun 2005 05:26:47 -0400 Original-Received: from [209.226.175.24] (helo=toq4-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DnYrh-00050L-LV for emacs-devel@gnu.org; Wed, 29 Jun 2005 05:28:17 -0400 Original-Received: from alfajor ([70.49.80.233]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050629080015.MCRA21470.tomts22-srv.bellnexxia.net@alfajor>; Wed, 29 Jun 2005 04:00:15 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 7DDAAD73EF; Wed, 29 Jun 2005 04:00:23 -0400 (EDT) Original-To: =?iso-8859-1?Q?J=3Fr=3Fme?= Marant In-Reply-To: <877jgrj22g.fsf_-_@marant.org> (=?iso-8859-1?Q?J=3Fr=3Fme?= Marant's message of "Sat, 18 Jun 2005 14:12:55 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:39880 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39880 [ Hi Ilya, I've installed another minor patch in Emacs's CVS repository. It's not needed for your version of cperl-mode, but you might still be interested. ] > After trying to reproduce all cperl-mode bugs from the Debian BTS, > it seems that most of them have been fixed in the CVS trunk, but > one which is a regression from the original CPerl-mode from > Ilya. > Could you please take care of this? [...] > subroutine names which contain built in keywords/function-names > delimited by _ characters get highlighted incorrectly: > For example, in emacs20-el: > sub foo_print_desc () > { > } > 'foo_print_desc' gets highlighted in font-lock-function-name-face So the bug is indeed absent from Ilya's cperl-mode and it is triggered by the fact that Emacs's cperl-mode.el does not give _ word syntax. To make up for it, the normal answer is to set font-lock-defaults so that _ does have word syntax during font-locking (but not while editing). To get it to work I had to remove an apparently spurious set-syntax-table in cperl-find-pods-heres. See the patch below which seems to fix it, Stefan --- cperl-mode.el 20 jun 2005 09:35:15 -0400 1.70 +++ cperl-mode.el 29 jun 2005 03:53:37 -0400 @@ -1516,7 +1516,8 @@ (t '((cperl-load-font-lock-keywords cperl-load-font-lock-keywords-1 - cperl-load-font-lock-keywords-2))))) + cperl-load-font-lock-keywords-2) + nil nil ((?_ . "w")))))) (make-local-variable 'cperl-syntax-state) (if cperl-use-syntax-table-text-property (progn @@ -3840,7 +3841,11 @@ (and (buffer-modified-p) (not modified) (set-buffer-modified-p nil)) - (set-syntax-table cperl-mode-syntax-table)) + ;; I do not understand what this is doing here. It breaks font-locking + ;; because it resets the syntax-table from font-lock-syntax-table to + ;; cperl-mode-syntax-table. + ;; (set-syntax-table cperl-mode-syntax-table) + ) (car err-l))) (defun cperl-backward-to-noncomment (lim)