From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.bugs Subject: bug#45183: [PATCH] cperl-mode: Remove obsolete font-lock fallbacks Date: Fri, 11 Dec 2020 18:01:39 +0100 Message-ID: <87k0to8efg.fsf@hajtower> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34668"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: 45183@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 11 18:13:04 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1knlyZ-0008vj-If for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Dec 2020 18:13:03 +0100 Original-Received: from localhost ([::1]:37180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knlyY-0008SD-EC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Dec 2020 12:13:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knlov-0007P5-6o for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2020 12:03:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knlos-0007uL-DO for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2020 12:03:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1knlos-0004PS-9g for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2020 12:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Dec 2020 17:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45183 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.160770612616876 (code B ref -1); Fri, 11 Dec 2020 17:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Dec 2020 17:02:06 +0000 Original-Received: from localhost ([127.0.0.1]:42803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knlny-0004O8-5m for submit@debbugs.gnu.org; Fri, 11 Dec 2020 12:02:06 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knlnv-0004Nx-Nw for submit@debbugs.gnu.org; Fri, 11 Dec 2020 12:02:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knlnu-0006tz-Vw for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2020 12:02:03 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:52787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knlnq-0007Tk-Js for bug-gnu-emacs@gnu.org; Fri, 11 Dec 2020 12:02:02 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 7445D2400FD for ; Fri, 11 Dec 2020 18:01:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1607706100; bh=7UZjQcHSShgTYS1uH7uu9imLlxWtKWVkTeT8dIYhIn8=; h=From:To:Subject:Date:From; b=aT47zVjvIHX76JgtbCCB5MXx2vYGpyC2irH3aGKjngPk8kL4I2/M1sJwbeReHVIvg evMEGgOY1eaclmMZ4C/A/bFOu7TInouV0OlX4V3LtxvqjDhIPqlwSeglpkJb/UiFwp 0P3HxFiHTWDMa2AikxMNP507o5SBKy2I/HVizdzOx+Vt8SmQ0/xo+TgyYmoNklCey3 PbMDUM6OfcJc4d4qUdtTjv2OXZnlZWfdFsTdkiEz34tZj8P2kI+zvaEz0iof7a5XlK NSd1GneXtXb6NB8pzDlS1UpmDkRmJzXf6L1kDRRA9Qzb9nRTwuSQTOeIbtcghhdpVm DRScKZLhyjpxw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Csxrz5hMNz9rxf for ; Fri, 11 Dec 2020 18:01:39 +0100 (CET) Received-SPF: pass client-ip=185.67.36.66; envelope-from=haj@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195789 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-cperl-mode-Eliminate-fallbacks-if-font-lock-isn-t-lo.patch Content-Description: cperl-mode: Eliminate font-lock fallbacks >From e2d7b0bcc865cef5aa8f3f8b891f9fcc97ccbe5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= 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 --=-=-=--