unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45183: [PATCH] cperl-mode: Remove obsolete font-lock fallbacks
@ 2020-12-11 17:01 Harald Jörg
  2020-12-11 19:19 ` Stefan Kangas
  0 siblings, 1 reply; 2+ messages in thread
From: Harald Jörg @ 2020-12-11 17:01 UTC (permalink / raw)
  To: 45183

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

Severity: minor

This is a followup inspired by a recent commit by Stefan Kangas
"Assume font-lock is provided; it's preloaded since 22.1".

In that case, we can safely shave off some fallback conditionals.
Patch attached.

--
Cheers,
haj

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cperl-mode: Eliminate font-lock fallbacks --]
[-- Type: text/x-diff, Size: 2933 bytes --]

From e2d7b0bcc865cef5aa8f3f8b891f9fcc97ccbe5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Harald=20J=C3=B6rg?= <haj@posteo.de>
Date: Fri, 11 Dec 2020 17:48:30 +0100
Subject: [PATCH] ; cperl-mode: Eliminate fallbacks if font-lock isn't loaded

* lisp/progmodes/cperl-mode.el (cperl-find-pods-heres):
Eliminate conditionals which always evaluate to true if
font-lock is preloaded (since Emacs 22.1).
---
 lisp/progmodes/cperl-mode.el | 45 ++++++------------------------------
 1 file changed, 7 insertions(+), 38 deletions(-)

diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index ed9b234d69..ae839a6622 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3473,49 +3473,18 @@ cperl-find-pods-heres
 	 (font-lock-string-face (if (boundp 'font-lock-string-face)
 				    font-lock-string-face
 				  'font-lock-string-face))
-	 (my-cperl-delimiters-face (if (boundp 'font-lock-constant-face)
-				      font-lock-constant-face
-				    'font-lock-constant-face))
+	 (my-cperl-delimiters-face
+	  font-lock-constant-face)
 	 (my-cperl-REx-spec-char-face	; [] ^.$ and wrapper-of ({})
-	  (if (boundp 'font-lock-function-name-face)
-	      font-lock-function-name-face
-	    'font-lock-function-name-face))
-	 (font-lock-variable-name-face	; interpolated vars and ({})-code
-	  (if (boundp 'font-lock-variable-name-face)
-	      font-lock-variable-name-face
-	    'font-lock-variable-name-face))
-	 (font-lock-function-name-face	; used in `cperl-find-sub-attrs'
-	  (if (boundp 'font-lock-function-name-face)
-	      font-lock-function-name-face
-	    'font-lock-function-name-face))
-	 (font-lock-constant-face	; used in `cperl-find-sub-attrs'
-	  (if (boundp 'font-lock-constant-face)
-	      font-lock-constant-face
-	    'font-lock-constant-face))
+          font-lock-function-name-face)
 	 (my-cperl-REx-0length-face ; 0-length, (?:)etc, non-literal \
-	  (if (boundp 'font-lock-builtin-face)
-	      font-lock-builtin-face
-	    'font-lock-builtin-face))
-	 (font-lock-comment-face
-	  (if (boundp 'font-lock-comment-face)
-	      font-lock-comment-face
-	    'font-lock-comment-face))
-	 (font-lock-warning-face
-	  (if (boundp 'font-lock-warning-face)
-	      font-lock-warning-face
-	    'font-lock-warning-face))
+          font-lock-builtin-face)
 	 (my-cperl-REx-ctl-face		; (|)
-	  (if (boundp 'font-lock-keyword-face)
-	      font-lock-keyword-face
-	    'font-lock-keyword-face))
+          font-lock-keyword-face)
 	 (my-cperl-REx-modifiers-face	; //gims
-	  (if (boundp 'cperl-nonoverridable-face)
-	      cperl-nonoverridable-face
-	    'cperl-nonoverridable-face))
+	  'cperl-nonoverridable-face)
 	 (my-cperl-REx-length1-face	; length=1 escaped chars, POSIX classes
-	  (if (boundp 'font-lock-type-face)
-	      font-lock-type-face
-	    'font-lock-type-face))
+          font-lock-type-face)
 	 (stop-point (if ignore-max
 			 (point-max)
 		       max))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#45183: [PATCH] cperl-mode: Remove obsolete font-lock fallbacks
  2020-12-11 17:01 bug#45183: [PATCH] cperl-mode: Remove obsolete font-lock fallbacks Harald Jörg
@ 2020-12-11 19:19 ` Stefan Kangas
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2020-12-11 19:19 UTC (permalink / raw)
  To: Harald Jörg, 45183

tags 45183 fixed
close 45183 28.1
thanks

haj@posteo.de (Harald Jörg) writes:

> Severity: minor
>
> This is a followup inspired by a recent commit by Stefan Kangas
> "Assume font-lock is provided; it's preloaded since 22.1".
>
> In that case, we can safely shave off some fallback conditionals.
> Patch attached.

Thanks for the patch!  This looks good to me, so I've pushed it to
master.  I'm therefore closing this bug report.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-11 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 17:01 bug#45183: [PATCH] cperl-mode: Remove obsolete font-lock fallbacks Harald Jörg
2020-12-11 19:19 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).