all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Harald Jörg" <haj@posteo.de>
Cc: Stefan Kangas <stefankangas@gmail.com>, 22867@debbugs.gnu.org
Subject: bug#22867: cperl-mode: Commit d0ad6306 suppresses fontification of hash/array declarations
Date: Fri, 04 Sep 2020 05:46:03 +0200	[thread overview]
Message-ID: <87a6y6fblw.fsf@gnus.org> (raw)
In-Reply-To: <1738df57-6707-a08d-80a2-c581808dbaef@posteo.de> ("Harald Jörg"'s message of "Tue, 1 Sep 2020 21:44:02 +0200")

Harald Jörg <haj@posteo.de> writes:

>> Is the fix worse than the problem?  If yes, maybe it should be reverted?
>
> The fix isn't _worse_.  Strings like "%s" and "%d" in the argument
> list of printf being fontified as hashes is indeed idiotic.  Also,
> more than once I was annoyed by fontification in POD sections.

The change in the offending commit just ensured that we don't re-fontify
already-fontified stuff as hashes.  This means that the reason stuff
like "my %foo = ..." isn't fontified as a hash is because something has
already fontified it as something else, so I wondered whether just
flipping the order of some of these regexp would do the trick.  After
poking around a bit, I came up with this patch:

diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 5dee5007e2..7a1c2e4d24 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -5776,8 +5776,8 @@ cperl-init-faces
 		  t-font-lock-keywords)
 		cperl-font-lock-keywords cperl-font-lock-keywords-1
 		cperl-font-lock-keywords-2 (append
-					   cperl-font-lock-keywords-1
-					   t-font-lock-keywords-1)))
+					   t-font-lock-keywords-1
+					   cperl-font-lock-keywords-1)))
 	(if (fboundp 'ps-print-buffer) (cperl-ps-print-init))
 	(if (or (featurep 'choose-color) (featurep 'font-lock-extra))
 	    (eval			; Avoid a warning


It seems to fix all the test cases in Harald's .pl file, and the cperl
test file still passes (but its coverage isn't, ahem, extensive).

Does anybody see any problems with just doing fixing it like this?  I
had a peek at a couple of other perl files here, and nothing immediately
looked wonky, but I'm a bit out of practice writing perl...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-09-04  3:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01  6:52 bug#22867: cperl mode highlights %d, but misses %.6f 積丹尼 Dan Jacobson
2016-04-10 23:17 ` Alexis
2020-08-07 10:09 ` Lars Ingebrigtsen
2020-08-07 11:13   ` Andreas Schwab
2020-08-07 12:07     ` Lars Ingebrigtsen
2020-09-01 16:02 ` bug#22867: cperl-mode: Commit d0ad6306 suppresses fontification of hash/array declarations Harald Jörg
2020-09-01 16:34   ` Stefan Kangas
2020-09-01 19:44     ` Harald Jörg
2020-09-04  3:46       ` Lars Ingebrigtsen [this message]
2020-09-04 16:04         ` Harald Jörg
2020-09-05 12:37           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6y6fblw.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=22867@debbugs.gnu.org \
    --cc=haj@posteo.de \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.