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`.
This commit is contained in:
parent
08291e6f17
commit
ace9f67755
5 changed files with 12 additions and 12 deletions
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) "("
|
||||
|
|
|
@ -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 \\)"
|
||||
|
|
Loading…
Add table
Reference in a new issue