[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ace9f677558 2/7: Avoid using rx `any` for `not-newline`
From: |
Mattias Engdegård |
Subject: |
master ace9f677558 2/7: Avoid using rx `any` for `not-newline` |
Date: |
Tue, 30 May 2023 11:46:52 -0400 (EDT) |
branch: master
commit ace9f6775580459c35254607d866f3bb22a8c45b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Avoid using rx `any` for `not-newline`
Despite its name, `any` does not match any character (use `anychar`
for that) but is an old synonym for `not-newline` and `nonl`,
retained for compatibility with the obsolete `sregex` package.
(In SRE as defined by SRFI-115, `any` does match any character.)
There is also a mild but unnecessary confusion with the more
frequently used `any` construct for character alternatives.
* lisp/edmacro.el (edmacro-mode-font-lock-keywords):
* lisp/erc/erc.el (erc--ensure-url):
* lisp/org/org.el (org-fontify-meta-lines-and-blocks-1):
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression):
* test/lisp/find-cmd-tests.el (find-cmd-test-find-cmd):
Replace uses of `any` with `nonl`.
---
lisp/edmacro.el | 8 ++++----
lisp/erc/erc.el | 6 +++---
lisp/org/org.el | 6 +++---
lisp/progmodes/scheme.el | 2 +-
test/lisp/find-cmd-tests.el | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 8734f7cbebe..69d20d2bad3 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -91,17 +91,17 @@ Default nil means to write characters above \\177 in octal
notation."
`((,(rx bol (group (or "Command" "Key" "Macro") ":")) 0 'edmacro-label)
(,(rx bol
(group ";; Keyboard Macro Editor. Press ")
- (group (*? any))
+ (group (*? nonl))
(group " to finish; press "))
(1 'font-lock-comment-face)
(2 'help-key-binding)
(3 'font-lock-comment-face)
- (,(rx (group (*? any))
- (group " to cancel" (* any)))
+ (,(rx (group (*? nonl))
+ (group " to cancel" (* nonl)))
nil nil
(1 'help-key-binding)
(2 'font-lock-comment-face)))
- (,(rx (one-or-more ";") (zero-or-more any)) 0 'font-lock-comment-face)))
+ (,(rx (one-or-more ";") (zero-or-more nonl)) 0 'font-lock-comment-face)))
(defvar edmacro-store-hook)
(defvar edmacro-finish-hook)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 5a91285c1d1..2c2df81fa6d 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2398,9 +2398,9 @@ parameters SERVER and NICK."
(defun erc--ensure-url (input)
(unless (string-match (rx bot "irc" (? "6") (? "s") "://") input)
- (when (and (string-match (rx (? (+ any) "@")
- (or (group (* (not "[")) ":" (* any))
- (+ any))
+ (when (and (string-match (rx (? (+ nonl) "@")
+ (or (group (* (not "[")) ":" (* nonl))
+ (+ nonl))
":" (+ (not (any ":]"))) eot)
input)
(match-beginning 1))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index e42704778bd..b81630fdc07 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5374,7 +5374,7 @@ by a #."
(zero-or-more (any " \t"))
(group (group (zero-or-more (not (any " \t\n"))))
(zero-or-more (any " \t"))
- (group (zero-or-more any)))))
+ (group (zero-or-more nonl)))))
limit t)
(let ((beg (match-beginning 0))
(end-of-beginline (match-end 0))
@@ -5400,7 +5400,7 @@ by a #."
"#+end"
,(match-string 4)
word-end
- (zero-or-more any)))))
+ (zero-or-more nonl)))))
;; We look further than LIMIT on purpose.
nil t)
;; We do have a matching #+end line.
@@ -5473,7 +5473,7 @@ by a #."
(beginning-of-line)
(looking-at (rx (group (zero-or-more (any " \t"))
"#+caption"
- (optional "[" (zero-or-more any) "]")
+ (optional "[" (zero-or-more nonl) "]")
":")
(zero-or-more (any " \t")))))
(add-text-properties (line-beginning-position) (match-end 1)
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 38cb19f5a12..e6fcc684729 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -155,7 +155,7 @@
,(rx bol (zero-or-more space)
"(define-module"
(one-or-more space)
- (group "(" (one-or-more any) ")"))
+ (group "(" (one-or-more nonl) ")"))
1)
("Macros"
,(rx bol (zero-or-more space) "("
diff --git a/test/lisp/find-cmd-tests.el b/test/lisp/find-cmd-tests.el
index a0b9a80ef47..3fbd0fc4ea3 100644
--- a/test/lisp/find-cmd-tests.el
+++ b/test/lisp/find-cmd-tests.el
@@ -25,7 +25,7 @@
(ert-deftest find-cmd-test-find-cmd ()
(should
(string-match
- (rx "find " (+ any)
+ (rx "find " (+ nonl)
" \\( \\( -name .svn -or -name .git -or -name .CVS \\)"
" -prune -or -true \\)"
" \\( \\( \\(" " -name \\*.pl -or -name \\*.pm -or -name \\*.t \\)"
- master updated (f8a79c0055f -> 49c56f33352), Mattias Engdegård, 2023/05/30
- master 9ae212fb1e5 4/7: xml.el: remove incorrect and botched attribute whitespace collapse, Mattias Engdegård, 2023/05/30
- master 49c56f33352 7/7: Add function declarations, Mattias Engdegård, 2023/05/30
- master ace9f677558 2/7: Avoid using rx `any` for `not-newline`,
Mattias Engdegård <=
- master 27d68d790f7 6/7: ; * admin/cus-test.el (cus-test-apropos): remove TODO (already done), Mattias Engdegård, 2023/05/30
- master 845f97d475b 5/7: ; * admin/admin.el (cusver-scan): remove broken warning, Mattias Engdegård, 2023/05/30
- master 08291e6f175 1/7: Clean up defcustom type quote check, Mattias Engdegård, 2023/05/30
- master 6e255ddfffa 3/7: * test/lisp/dnd-tests.el (dnd-tests-begin-text-drag): Fix typo., Mattias Engdegård, 2023/05/30