From 1e4b13c2f21852e5fd65f376d6776324e8ab6830 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 27 Nov 2019 18:07:30 +0200 Subject: [PATCH 1/2] Remove redundant uses of 'one-or-more' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid backtracking and thus improve font-locking performance. Necessary in Emacs 27 because of some correctness improvements in 'rx'. Suggested by Mattias EngdegÄrd in https://debbugs.gnu.org/38104. --- elixir-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elixir-mode.el b/elixir-mode.el index f6993b0d..0c6946bf 100644 --- a/elixir-mode.el +++ b/elixir-mode.el @@ -134,7 +134,7 @@ ;; The first character of an identifier must be a letter or an underscore. ;; After that, they may contain any alphanumeric character + underscore. ;; Additionally, the final character may be either `?' or `!'. - (identifiers . ,(rx (one-or-more (any "A-Z" "a-z" "_")) + (identifiers . ,(rx (any "A-Z" "a-z" "_") (zero-or-more (any "A-Z" "a-z" "0-9" "_")) (optional (or "?" "!")))) (keyword . ,(rx symbol-start @@ -151,11 +151,11 @@ ;; or `!'. (module-names . ,(rx symbol-start (optional (or "%" "&")) - (one-or-more (any "A-Z")) + (any "A-Z") (zero-or-more (any "A-Z" "a-z" "_" "0-9")) (zero-or-more (and "." - (one-or-more (any "A-Z" "_")) + (any "A-Z" "_") (zero-or-more (any "A-Z" "a-z" "_" "0-9")))) (optional (or "!" "?")) symbol-end)) From e35b356ef2df0f419bd0436ea4224fa9aff93ad4 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 27 Nov 2019 20:57:10 +0200 Subject: [PATCH 2/2] Remove two more 'one-or-more' uses They never did anything anyway because 'identifiers' doesn't include any separators, so the resulting construct could only match one identifier anyway. --- elixir-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elixir-mode.el b/elixir-mode.el index 0c6946bf..2c3f29b3 100644 --- a/elixir-mode.el +++ b/elixir-mode.el @@ -304,7 +304,7 @@ is used to limit the scan." (elixir-match-interpolation 0 font-lock-variable-name-face t) ;; Module attributes - (,(elixir-rx (and "@" (1+ identifiers))) + (,(elixir-rx (and "@" identifiers)) 0 elixir-attribute-face) ;; Keywords @@ -399,7 +399,7 @@ is used to limit the scan." 1 font-lock-variable-name-face) ;; Map keys - (,(elixir-rx (group (and (one-or-more identifiers) ":")) space) + (,(elixir-rx (group (and identifiers ":")) space) 1 elixir-atom-face) ;; Pseudovariables