From edd6a1f60ebc7b6d59458da482fd5e964f2922fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Mo=CC=88ding?= Date: Thu, 30 May 2024 08:29:36 +0200 Subject: [PATCH] Use rx instead of a manually created regex --- puppet-ts-mode.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/puppet-ts-mode.el b/puppet-ts-mode.el index 16422cd..d9684d9 100644 --- a/puppet-ts-mode.el +++ b/puppet-ts-mode.el @@ -6,7 +6,7 @@ ;; Maintainer: Stefan Möding ;; Version: 0.1.0 ;; Created: <2024-03-02 13:05:03 stm> -;; Updated: <2024-05-30 08:28:01 stm> +;; Updated: <2024-05-30 08:29:29 stm> ;; URL: https://github.com/smoeding/puppet-ts-mode ;; Keywords: languages ;; Package-Requires: ((emacs "29.1")) @@ -845,9 +845,11 @@ module and file according to Puppet's autoloading rules." (moddirs (mapcar (lambda (dir) (expand-file-name module dir)) puppet-ts-module-path)) ;; the regexp to find the resource definition in the file - (resdef (concat "^\\(class\\|define\\|type\\|function\\)\\s-+" - resource - "\\((\\|{\\|\\s-\\|$\\)")) + (resdef (rx bol + (or "class" "define" "function" "type") + (1+ whitespace) + (literal resource) + word-boundary)) ;; files to visit when searching for the resource (files '())) ;; Check the current module directory (if the buffer actually